aboutsummaryrefslogtreecommitdiff
path: root/procps/ps.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-01-08 15:51:04 +0000
committerRon Yorston <rmy@pobox.com>2019-01-08 15:51:04 +0000
commitbade8b3460ea3cf1182cd1bda9faf8b6ccee6a25 (patch)
tree6b0c855e3d0688e07f512e61d17d76d09c64c6cb /procps/ps.c
parent59701e7f6a483d4aad4dc7088c673cd69fe294c8 (diff)
downloadbusybox-w32-bade8b3460ea3cf1182cd1bda9faf8b6ccee6a25.tar.gz
busybox-w32-bade8b3460ea3cf1182cd1bda9faf8b6ccee6a25.tar.bz2
busybox-w32-bade8b3460ea3cf1182cd1bda9faf8b6ccee6a25.zip
ps: add support for the args column
Implement read_cmdline() for WIN32 by storing the command line in the same way as the applet name. The applet name is actually used for the comm column which is truncated to COMM_LEN. Using this as the size of the bb_comm array avoids the need to calculate MAX_APPLET_NAME_LEN.
Diffstat (limited to 'procps/ps.c')
-rw-r--r--procps/ps.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/procps/ps.c b/procps/ps.c
index 1f14844e6..c08d03146 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -244,12 +244,12 @@ static void func_state(char *buf, int size, const procps_status_t *ps)
244{ 244{
245 safe_strncpy(buf, ps->state, size+1); 245 safe_strncpy(buf, ps->state, size+1);
246} 246}
247#endif
247 248
248static void func_args(char *buf, int size, const procps_status_t *ps) 249static void func_args(char *buf, int size, const procps_status_t *ps)
249{ 250{
250 read_cmdline(buf, size+1, ps->pid, ps->comm); 251 read_cmdline(buf, size+1, ps->pid, ps->comm);
251} 252}
252#endif
253 253
254static void func_pid(char *buf, int size, const procps_status_t *ps) 254static void func_pid(char *buf, int size, const procps_status_t *ps)
255{ 255{
@@ -386,9 +386,7 @@ static const ps_out_t out_spec[] = {
386 { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, 386 { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID },
387 { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, 387 { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID },
388 { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM }, 388 { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM },
389#if !ENABLE_PLATFORM_MINGW32
390 { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, 389 { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM },
391#endif
392 { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, 390 { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID },
393 { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, 391 { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID },
394#if !ENABLE_PLATFORM_MINGW32 392#if !ENABLE_PLATFORM_MINGW32
@@ -553,7 +551,7 @@ static void format_process(const procps_status_t *ps)
553# define SELINUX_O_PREFIX "label," 551# define SELINUX_O_PREFIX "label,"
554# define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") 552# define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args")
555#elif ENABLE_PLATFORM_MINGW32 553#elif ENABLE_PLATFORM_MINGW32
556# define DEFAULT_O_STR ("pid,ppid,user" IF_FEATURE_PS_TIME(",time,etime") ",comm") 554# define DEFAULT_O_STR ("pid,ppid,user" IF_FEATURE_PS_TIME(",time,etime") ",args")
557#else 555#else
558# define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") 556# define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args")
559#endif 557#endif