fix the global var in .h file
This commit is contained in:
parent
c6a798458b
commit
6e9efcbfcc
9
main.c
9
main.c
@ -1,5 +1,6 @@
|
||||
#include "src/init.h"
|
||||
#include "src/server.h"
|
||||
#include "src/MonitorProcess.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <pthread.h>
|
||||
@ -11,14 +12,10 @@ int main() {
|
||||
//init
|
||||
//get /data/data/dir
|
||||
//get whitelist
|
||||
//
|
||||
//init Proc_List
|
||||
printf("%ld",Proc_List[0].pid);
|
||||
init();
|
||||
|
||||
//test
|
||||
char buf[80];
|
||||
getcwd(buf, sizeof(buf));
|
||||
printf("current working directory: %s\n", buf);
|
||||
|
||||
//server
|
||||
rc = pthread_create(&unix_domain_server, NULL, (void *)&server, NULL);
|
||||
if (rc != 0) {
|
||||
|
||||
@ -12,6 +12,10 @@
|
||||
#define STAT_VSZ 22
|
||||
#define STAT_RSS 23
|
||||
|
||||
extern int Proc_List_Free_ID;
|
||||
extern int Proc_List_ID;
|
||||
extern Proc_Info Proc_List[64]; //max monitor 64 process
|
||||
|
||||
//update process cpu time and mem info by /proc/PID/stat
|
||||
//example: 1 (systemd) S 0 1 1 0 -1 4194560 16465 675919 50 519 44 100 678 258 20 0 1 0 13 44421120 1253 18446744073709551615 94869015482368 94869016924823 140724538057904 0 0 0 671173123 4096 1260 1 0 0 17 0 0 0 14 0 0 94869019025816 94869019170360 94869036843008 140724538064796 140724538064863 140724538064863 140724538064863 0
|
||||
/* pid 进程ID 0
|
||||
|
||||
@ -25,14 +25,14 @@ typedef struct Proc_Info_ {
|
||||
Proc_Mem memInfo[30];
|
||||
} Proc_Info;
|
||||
|
||||
int Proc_List_Free_ID = 0;
|
||||
int Proc_List_ID = 0;
|
||||
Proc_Info Proc_List[64]; //max monitor 64 process
|
||||
|
||||
//kill this process
|
||||
void findProcListByMem();
|
||||
|
||||
//kill this process
|
||||
void findProcListByCPU();
|
||||
|
||||
int Proc_List_Free_ID;
|
||||
int Proc_List_ID;
|
||||
Proc_Info Proc_List[64]; //max monitor 64 process
|
||||
|
||||
#endif //ATOP_MONITORPROCESS_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user