Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ ifeq ($(ARCH), x86)
CC=gcc
AR=ar
LD=ld
CFLAGS := -lev -lm -lrt -static -I$(PROJECT_INC_DIR) -D_SYSTEM_FUNC
CFLAGS := -lev -lm -lrt -static -I$(PROJECT_INC_DIR) -D_BUILTIN_FUNC
LDFLAG :=
else
CROSS_COMPILE=arm-linux-gnueabi-
CC=$(CROSS_COMPILE)gcc
AR=$(CROSS_COMPILE)ar
LD=$(CROSS_COMPILE)ld
CFLAGS := -lev -lm -lrt -static -I$(PROJECT_INC_DIR) -D_SYSTEM_FUNC
CFLAGS := -lev -lm -lrt -static -I$(PROJECT_INC_DIR) -D_BUILTIN_FUNC
LDFLAG := -L$(PROJECT_EV_DIR)
endif

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ root@bob-VirtualBox:~# git clone git@www.linuxep.com:repo/lep/lepd lepd-src

For X86(电脑需要安装libev-dev库):

root@bob-VirtualBox:~/lepd-src# ./build_x86.sh
#root@bob-VirtualBox:~/lepd-src# ./build_x86.sh
make ARCH=x86

For ARM(电脑需要安装arm-linux-gnueabi-gcc):

root@bob-VirtualBox:~/lepd-src# ./build_arm.sh
#root@bob-VirtualBox:~/lepd-src# ./build_arm.sh
make ARCH=arm

## 如何运行

Expand Down
Binary file added arm-toolbox/df
Binary file not shown.
Binary file added arm-toolbox/dmesg
Binary file not shown.
Binary file added arm-toolbox/free
Binary file not shown.
Binary file added arm-toolbox/iostat
Binary file not shown.
Binary file added arm-toolbox/mpstat
Binary file not shown.
Binary file added arm-toolbox/perf
Binary file not shown.
Binary file added arm-toolbox/ps
Binary file not shown.
Binary file added arm-toolbox/top
Binary file not shown.
Binary file added libs/libbusybox.a
Binary file not shown.
Binary file added libs/libprocrank.a
Binary file not shown.
Binary file added libs/libsysstat.a
Binary file not shown.
9 changes: 5 additions & 4 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ cJSON * read_proc(jrpc_context * ctx, cJSON * params, cJSON *id)
}

#ifdef _BUILTIN_FUNC

#include "sysstat.h"
#include "busybox.h"
#include "procrank.h"
Expand Down Expand Up @@ -177,13 +176,15 @@ cJSON * run_cmd(jrpc_context * ctx, cJSON * params, cJSON *id)
//dup2( old, 1 );

//read_result(cmd_buff);

memset(cmd_buff, 0, CMD_BUFF);
fflush(stdout);
int fd[2];
if(pipe(fd)) {
printf("pipe error!\n");
return NULL;
}

fflush(stdout);



Expand Down Expand Up @@ -259,7 +260,7 @@ cJSON * list_all(jrpc_context * ctx, cJSON * params, cJSON *id)
}

int main(void) {
daemon(0, 0);
//daemon(0, 0);
jrpc_server_init(&my_server, PORT);
jrpc_register_procedure(&my_server, say_hello, "SayHello", NULL);
jrpc_register_procedure(&my_server, list_all, "ListAllMethod", NULL);
Expand Down Expand Up @@ -287,7 +288,7 @@ int main(void) {
jrpc_register_procedure(&my_server, run_cmd, "GetCmdVmstat", "vmstat");
//jrpc_register_procedure(&my_server, run_cmd, "GetCmdTop", "top -n 1 -b | head -n 50");
jrpc_register_procedure(&my_server, run_cmd, "GetCmdTop", "ps -e -o pid,user,pri,ni,vsize,rss,s,%cpu,%mem,time,cmd --sort=-%cpu | head -n 50");
jrpc_register_procedure(&my_server, run_cmd, "GetCmdTopH", "top -n 1 -b | head -n 50");
jrpc_register_procedure(&my_server, run_cmd, "GetCmdTopH", "top -n 1 -b");
jrpc_register_procedure(&my_server, run_cmd, "GetCmdIotop", "iotop -n 1 -b | head -n 50");
jrpc_register_procedure(&my_server, run_cmd, "GetCmdSmem", "smem -p -s pss -r -n 50");
jrpc_register_procedure(&my_server, run_cmd, "GetCmdDmesg", "dmesg");
Expand Down