diff options
author | Ron Yorston <rmy@pobox.com> | 2017-08-31 17:52:40 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-08-31 17:52:40 +0100 |
commit | ec3ecac715b299766c101be92caf8b7cffb2a8b5 (patch) | |
tree | 90b1a0c5f0af80822ce3fba4ea44c74aaeb637af | |
parent | 97e7593785e4be972383d8018e33af7d3dd409b9 (diff) | |
download | busybox-w32-ec3ecac715b299766c101be92caf8b7cffb2a8b5.tar.gz busybox-w32-ec3ecac715b299766c101be92caf8b7cffb2a8b5.tar.bz2 busybox-w32-ec3ecac715b299766c101be92caf8b7cffb2a8b5.zip |
ps: add parent process id as a supported column
-rw-r--r-- | procps/ps.c | 6 | ||||
-rw-r--r-- | win32/process.c | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/procps/ps.c b/procps/ps.c index 742d1715e..a8541e6cf 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -257,12 +257,12 @@ static void func_pid(char *buf, int size, const procps_status_t *ps) | |||
257 | sprintf(buf, "%*u", size, ps->pid); | 257 | sprintf(buf, "%*u", size, ps->pid); |
258 | } | 258 | } |
259 | 259 | ||
260 | #if !ENABLE_PLATFORM_MINGW32 | ||
261 | static void func_ppid(char *buf, int size, const procps_status_t *ps) | 260 | static void func_ppid(char *buf, int size, const procps_status_t *ps) |
262 | { | 261 | { |
263 | sprintf(buf, "%*u", size, ps->ppid); | 262 | sprintf(buf, "%*u", size, ps->ppid); |
264 | } | 263 | } |
265 | 264 | ||
265 | #if !ENABLE_PLATFORM_MINGW32 | ||
266 | static void func_pgid(char *buf, int size, const procps_status_t *ps) | 266 | static void func_pgid(char *buf, int size, const procps_status_t *ps) |
267 | { | 267 | { |
268 | sprintf(buf, "%*u", size, ps->pgid); | 268 | sprintf(buf, "%*u", size, ps->pgid); |
@@ -393,8 +393,8 @@ static const ps_out_t out_spec[] = { | |||
393 | { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, | 393 | { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, |
394 | #endif | 394 | #endif |
395 | { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, | 395 | { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, |
396 | #if !ENABLE_PLATFORM_MINGW32 | ||
397 | { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, | 396 | { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, |
397 | #if !ENABLE_PLATFORM_MINGW32 | ||
398 | { 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID }, | 398 | { 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID }, |
399 | #endif | 399 | #endif |
400 | #if ENABLE_FEATURE_PS_TIME | 400 | #if ENABLE_FEATURE_PS_TIME |
@@ -556,7 +556,7 @@ static void format_process(const procps_status_t *ps) | |||
556 | # define SELINUX_O_PREFIX "label," | 556 | # define SELINUX_O_PREFIX "label," |
557 | # define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") | 557 | # define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") |
558 | #elif ENABLE_PLATFORM_MINGW32 | 558 | #elif ENABLE_PLATFORM_MINGW32 |
559 | # define DEFAULT_O_STR ("pid,comm") | 559 | # define DEFAULT_O_STR ("pid,ppid,comm") |
560 | #else | 560 | #else |
561 | # define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") | 561 | # define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") |
562 | #endif | 562 | #endif |
diff --git a/win32/process.c b/win32/process.c index 192eeab56..c0ff78105 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -362,6 +362,7 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags UNUSED_PAR | |||
362 | } | 362 | } |
363 | 363 | ||
364 | sp->pid = pe.th32ProcessID; | 364 | sp->pid = pe.th32ProcessID; |
365 | sp->ppid = pe.th32ParentProcessID; | ||
365 | safe_strncpy(sp->comm, pe.szExeFile, COMM_LEN); | 366 | safe_strncpy(sp->comm, pe.szExeFile, COMM_LEN); |
366 | return sp; | 367 | return sp; |
367 | } | 368 | } |