[Bug 3835] The 'ps' command doesn't show real thread names

bugzilla at busybox.net bugzilla at busybox.net
Sat Jun 18 13:45:52 UTC 2011


https://bugs.busybox.net/show_bug.cgi?id=3835

--- Comment #4 from Denys Vlasenko <vda.linux at googlemail.com>  ---
-       { MAX_WIDTH          , "args"  ,"COMMAND",func_args  ,PSSCAN_COMM    },
+       { MAX_WIDTH          , "args"  ,"COMMAND",func_args  ,0              },

Why?


-               if (flags & PSSCAN_STAT) {
+               if ( (flags & PSSCAN_STAT) || (flags & PSSCAN_COMM) ) {

Seems wrong. PSSCAN_STAT already contains COMM bit. See libbb.h


-#define DEFAULT_O_STR    (SELINUX_O_PREFIX "pid,user"
IF_FEATURE_PS_TIME(",time") ",args")
+#endif
+#if ENABLE_FEATURE_SHOW_THREADS
+#define THREADS_O_SUFFIX ",comm"
+#endif
+
+#define DEFAULT_O_STR_BASE    ("pid,user" IF_FEATURE_PS_TIME(",time"))
+#define DEFAULT_O_STR_SUFFIX ",args"
+#if ENABLE_SELINUX
+#define MAX_DEFAULT_O_STR_SIZE (sizeof(DEFAULT_O_STR_BASE) +
sizeof(DEFAULT_O_STR_SUFFIX) \
+                               + sizeof(SELINUX_O_PREFIX)).
 #else
-#define DEFAULT_O_STR    ("pid,user" IF_FEATURE_PS_TIME(",time") ",args")
+#define MAX_DEFAULT_O_STR_SIZE (sizeof(DEFAULT_O_STR_BASE) +
sizeof(DEFAULT_O_STR_SUFFIX))

I don't understand what you are trying to achieve here. Aha, conditionally add
",comm"? This will show comm for _every_ process, even the vast majority which
has comm = argv0.

I have a different proposal: modify read_cmdline() so that it prepends {comm}
only if it's different from argv0. This will also fix top.

Going to commit the fix to git.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list