ps --ppid
This commit is contained in:
parent
b8e27a1ecf
commit
f5702f2c75
1
NEWS
1
NEWS
@ -1,5 +1,6 @@
|
|||||||
procps-3.1.5 --> procps-3.1.6
|
procps-3.1.5 --> procps-3.1.6
|
||||||
|
|
||||||
|
ps: new --ppid option selects by PPID
|
||||||
watch: new --no-title option
|
watch: new --no-title option
|
||||||
handle SPARC Linux badness
|
handle SPARC Linux badness
|
||||||
rare crash fixed
|
rare crash fixed
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#define SEL_TTY 11
|
#define SEL_TTY 11
|
||||||
#define SEL_SESS 12
|
#define SEL_SESS 12
|
||||||
#define SEL_COMM 13
|
#define SEL_COMM 13
|
||||||
|
#define SEL_PPID 14
|
||||||
|
|
||||||
/* Since an enum could be smashed by a #define, it would be bad. */
|
/* Since an enum could be smashed by a #define, it would be bad. */
|
||||||
#define U98 0 /* Unix98 standard */ /* This must be 0 */
|
#define U98 0 /* Unix98 standard */ /* This must be 0 */
|
||||||
@ -143,6 +144,7 @@
|
|||||||
|
|
||||||
typedef union sel_union {
|
typedef union sel_union {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
pid_t ppid;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
dev_t tty;
|
dev_t tty;
|
||||||
|
@ -143,6 +143,7 @@ static void arg_show(void){
|
|||||||
case SEL_FGID: show_gid("FGID", walk->n, walk->u); break;
|
case SEL_FGID: show_gid("FGID", walk->n, walk->u); break;
|
||||||
case SEL_PGRP: show_pid("PGRP", walk->n, walk->u); break;
|
case SEL_PGRP: show_pid("PGRP", walk->n, walk->u); break;
|
||||||
case SEL_PID : show_pid("PID ", walk->n, walk->u); break;
|
case SEL_PID : show_pid("PID ", walk->n, walk->u); break;
|
||||||
|
case SEL_PPID: show_pid("PPID", walk->n, walk->u); break;
|
||||||
case SEL_TTY : show_tty("TTY ", walk->n, walk->u); break;
|
case SEL_TTY : show_tty("TTY ", walk->n, walk->u); break;
|
||||||
case SEL_SESS: show_pid("SESS", walk->n, walk->u); break;
|
case SEL_SESS: show_pid("SESS", walk->n, walk->u); break;
|
||||||
case SEL_COMM: show_cmd("COMM", walk->n, walk->u); break;
|
case SEL_COMM: show_cmd("COMM", walk->n, walk->u); break;
|
||||||
|
@ -30,7 +30,7 @@ const char *help_message =
|
|||||||
"r only running processes U processes for specified users\n"
|
"r only running processes U processes for specified users\n"
|
||||||
"x processes w/o controlling ttys t by tty\n"
|
"x processes w/o controlling ttys t by tty\n"
|
||||||
"*********** output format ********** *********** long options ***********\n"
|
"*********** output format ********** *********** long options ***********\n"
|
||||||
"-o,o user-defined -f full --Group --User --pid --cols\n"
|
"-o,o user-defined -f full --Group --User --pid --cols --ppid\n"
|
||||||
"-j,j job control s signal --group --user --sid --rows\n"
|
"-j,j job control s signal --group --user --sid --rows\n"
|
||||||
"-O,O preloaded -o v virtual memory --cumulative --format --deselect\n"
|
"-O,O preloaded -o v virtual memory --cumulative --format --deselect\n"
|
||||||
"-l,l long u user-oriented --sort --tty --forest --version\n"
|
"-l,l long u user-oriented --sort --tty --forest --version\n"
|
||||||
|
@ -753,6 +753,7 @@ static const char *parse_gnu_option(void){
|
|||||||
{"noheading", &&case_noheading},
|
{"noheading", &&case_noheading},
|
||||||
{"noheadings", &&case_noheadings},
|
{"noheadings", &&case_noheadings},
|
||||||
{"pid", &&case_pid},
|
{"pid", &&case_pid},
|
||||||
|
{"ppid", &&case_ppid},
|
||||||
{"rows", &&case_rows},
|
{"rows", &&case_rows},
|
||||||
{"secsid", &&case_secsid},
|
{"secsid", &&case_secsid},
|
||||||
{"sid", &&case_sid},
|
{"sid", &&case_sid},
|
||||||
@ -881,6 +882,14 @@ static const char *parse_gnu_option(void){
|
|||||||
if(err) return err;
|
if(err) return err;
|
||||||
selection_list->typecode = SEL_PID;
|
selection_list->typecode = SEL_PID;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
case_ppid:
|
||||||
|
trace("--ppid\n");
|
||||||
|
arg = grab_gnu_arg();
|
||||||
|
if(!arg) return "List of process IDs must follow --ppid.";
|
||||||
|
err=parse_list(arg, parse_pid);
|
||||||
|
if(err) return err;
|
||||||
|
selection_list->typecode = SEL_PPID;
|
||||||
|
return NULL;
|
||||||
case_rows:
|
case_rows:
|
||||||
case_lines:
|
case_lines:
|
||||||
trace("--rows\n");
|
trace("--rows\n");
|
||||||
|
1
ps/ps.1
1
ps/ps.1
@ -72,6 +72,7 @@ t select by tty
|
|||||||
--User select by real user name or ID
|
--User select by real user name or ID
|
||||||
--group select by effective group name or ID
|
--group select by effective group name or ID
|
||||||
--pid select by process ID
|
--pid select by process ID
|
||||||
|
--ppid select by parent process ID
|
||||||
--sid select by session ID
|
--sid select by session ID
|
||||||
--tty select by terminal
|
--tty select by terminal
|
||||||
--user select by effective user name or ID
|
--user select by effective user name or ID
|
||||||
|
@ -102,6 +102,7 @@ static int proc_was_listed(proc_t *buf){
|
|||||||
|
|
||||||
break; case SEL_PGRP: return_if_match(pgrp,pid);
|
break; case SEL_PGRP: return_if_match(pgrp,pid);
|
||||||
break; case SEL_PID : return_if_match(pid,pid);
|
break; case SEL_PID : return_if_match(pid,pid);
|
||||||
|
break; case SEL_PPID: return_if_match(ppid,ppid);
|
||||||
break; case SEL_TTY : return_if_match(tty,tty);
|
break; case SEL_TTY : return_if_match(tty,tty);
|
||||||
break; case SEL_SESS: return_if_match(session,pid);
|
break; case SEL_SESS: return_if_match(session,pid);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user