Merge "Add ps --ppid."
This commit is contained in:
commit
0114e1243a
1 changed files with 9 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ static char *nexttok(char **strp)
|
||||||
#define SHOW_ABI 64
|
#define SHOW_ABI 64
|
||||||
|
|
||||||
static int display_flags = 0;
|
static int display_flags = 0;
|
||||||
|
static int ppid_filter = 0;
|
||||||
|
|
||||||
static void print_exe_abi(int pid);
|
static void print_exe_abi(int pid);
|
||||||
|
|
||||||
|
|
@ -145,6 +146,10 @@ static int ps_line(int pid, int tid, char *namefilter)
|
||||||
strcpy(user,pw->pw_name);
|
strcpy(user,pw->pw_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ppid_filter != 0 && ppid != ppid_filter) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(!namefilter || !strncmp(cmdline[0] ? cmdline : name, namefilter, strlen(namefilter))) {
|
if(!namefilter || !strncmp(cmdline[0] ? cmdline : name, namefilter, strlen(namefilter))) {
|
||||||
if (display_flags & SHOW_MACLABEL) {
|
if (display_flags & SHOW_MACLABEL) {
|
||||||
fd = open(macline, O_RDONLY);
|
fd = open(macline, O_RDONLY);
|
||||||
|
|
@ -266,6 +271,10 @@ int ps_main(int argc, char **argv)
|
||||||
display_flags |= SHOW_CPU;
|
display_flags |= SHOW_CPU;
|
||||||
} else if(!strcmp(argv[1],"--abi")) {
|
} else if(!strcmp(argv[1],"--abi")) {
|
||||||
display_flags |= SHOW_ABI;
|
display_flags |= SHOW_ABI;
|
||||||
|
} else if(!strcmp(argv[1],"--ppid")) {
|
||||||
|
ppid_filter = atoi(argv[2]);
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
} else if(isdigit(argv[1][0])){
|
} else if(isdigit(argv[1][0])){
|
||||||
pidfilter = atoi(argv[1]);
|
pidfilter = atoi(argv[1]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue