Show threads feature is not used if ps wide option is not enabled

Sinan Nalkaya snalkaya at ubicom.com
Tue Apr 6 06:51:51 UTC 2010


Hi,

I intended to use "Show Threads" feature in ps without -w option is enabled, but i couldn't.

Is there a specific reason for that?

This patch seems to be fixing the issue if there is no specific reason for that.


diff --git a/procps/ps.c b/procps/ps.c
index 91ebd68..c44ea7e 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -548,8 +548,11 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
         unsigned terminal_width;
  #endif

-#if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX
+#if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX || ENABLE_FEATURE_SHOW_THREADS
         int opts;
+#endif
+
+#if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX
  # if ENABLE_FEATURE_PS_WIDE
         int w_count = 0;
         opt_complementary = "-:ww";
@@ -573,11 +576,14 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
                 psscan_flags = PSSCAN_PID | PSSCAN_CONTEXT
                                 | PSSCAN_STATE | PSSCAN_COMM;
  # endif
+# elif ENABLE_FEATURE_SHOW_THREADS
+       opts = getopt32(argv, "T");
+#endif /* ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX */
+
  # if ENABLE_FEATURE_SHOW_THREADS
         if (opts & (1 << ENABLE_SELINUX))
                 psscan_flags |= PSSCAN_TASKS;
-# endif
-#endif /* ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX */
+#endif

         if (psscan_flags & PSSCAN_CONTEXT)
                 puts("  PID CONTEXT                          STAT COMMAND");

Thanks,
Sinan.


More information about the busybox mailing list