aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-08-29 14:55:24 +0100
committerRon Yorston <rmy@pobox.com>2023-08-29 15:11:14 +0100
commit89e67c6f7a77e0e16cbf394f18d4cb121e37f544 (patch)
treec286c985453ff263dc6d84774e18b298399e35e5
parentd6fb7a2c36f8a6d5fac4754cdfdb5483a03f2892 (diff)
downloadbusybox-w32-89e67c6f7a77e0e16cbf394f18d4cb121e37f544.tar.gz
busybox-w32-89e67c6f7a77e0e16cbf394f18d4cb121e37f544.tar.bz2
busybox-w32-89e67c6f7a77e0e16cbf394f18d4cb121e37f544.zip
ps: increase length of 'comm' field
In Linux the command name associated with a process (as can be obtained from '/proc/<PID>/comm') is truncated to 16 characters. Thus upstream BusyBox only allows 16 characters for the 'comm' field in 'ps'. There's no need for such a constraint in busybox-w32. Moreover, the command name is used for the full command line ('args' field) in most cases. This field is allowed to be rather long in 'ps' so it's not expected to be truncated. Still, to avoid diverging too much from upstream it's best to have some measure of truncation. Increase the allowed length of the command name to 32 characters. Adds 16 bytes. (GitHub issue #358)
-rw-r--r--include/libbb.h4
-rw-r--r--procps/ps.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index e3b17655c..2cdfac639 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -2088,6 +2088,10 @@ int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC;
2088 read_line_input(prompt, command, maxsize) 2088 read_line_input(prompt, command, maxsize)
2089#endif 2089#endif
2090 2090
2091#if ENABLE_PLATFORM_MINGW32
2092# undef COMM_LEN
2093# define COMM_LEN 32
2094#endif
2091#ifndef COMM_LEN 2095#ifndef COMM_LEN
2092# ifdef TASK_COMM_LEN 2096# ifdef TASK_COMM_LEN
2093enum { COMM_LEN = TASK_COMM_LEN }; 2097enum { COMM_LEN = TASK_COMM_LEN };
diff --git a/procps/ps.c b/procps/ps.c
index 823539b9a..329576eb8 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -383,7 +383,11 @@ static const ps_out_t out_spec[] ALIGN_PTR = {
383/* Mandated by http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html: */ 383/* Mandated by http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html: */
384 { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, 384 { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID },
385 { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, 385 { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID },
386#if ENABLE_PLATFORM_MINGW32
387 { COMM_LEN , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM },
388#else
386 { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM }, 389 { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM },
390#endif
387 { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, 391 { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM },
388 { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, 392 { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID },
389 { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, 393 { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID },