diff --git a/Makefile b/Makefile index 7231e70..f217108 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index f7448af..246686e 100644 --- a/README.md +++ b/README.md @@ -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 ## 如何运行 diff --git a/arm-toolbox/df b/arm-toolbox/df new file mode 100755 index 0000000..3790e3e Binary files /dev/null and b/arm-toolbox/df differ diff --git a/arm-toolbox/dmesg b/arm-toolbox/dmesg new file mode 100755 index 0000000..3790e3e Binary files /dev/null and b/arm-toolbox/dmesg differ diff --git a/arm-toolbox/free b/arm-toolbox/free new file mode 100755 index 0000000..3790e3e Binary files /dev/null and b/arm-toolbox/free differ diff --git a/arm-toolbox/iostat b/arm-toolbox/iostat new file mode 100755 index 0000000..3790e3e Binary files /dev/null and b/arm-toolbox/iostat differ diff --git a/arm-toolbox/mpstat b/arm-toolbox/mpstat new file mode 100755 index 0000000..3790e3e Binary files /dev/null and b/arm-toolbox/mpstat differ diff --git a/arm-toolbox/perf b/arm-toolbox/perf new file mode 100755 index 0000000..ab7b215 Binary files /dev/null and b/arm-toolbox/perf differ diff --git a/arm-toolbox/ps b/arm-toolbox/ps new file mode 100755 index 0000000..3790e3e Binary files /dev/null and b/arm-toolbox/ps differ diff --git a/arm-toolbox/top b/arm-toolbox/top new file mode 100755 index 0000000..3790e3e Binary files /dev/null and b/arm-toolbox/top differ diff --git a/libs/libbusybox.a b/libs/libbusybox.a new file mode 100644 index 0000000..6bee39d Binary files /dev/null and b/libs/libbusybox.a differ diff --git a/libs/libprocrank.a b/libs/libprocrank.a new file mode 100644 index 0000000..46081ad Binary files /dev/null and b/libs/libprocrank.a differ diff --git a/libs/libsysstat.a b/libs/libsysstat.a new file mode 100644 index 0000000..dab2829 Binary files /dev/null and b/libs/libsysstat.a differ diff --git a/src/server.c b/src/server.c index 9ba286c..658c5e3 100644 --- a/src/server.c +++ b/src/server.c @@ -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" @@ -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); @@ -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); @@ -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");