[Bug 5216] 1.20 ps lacks -w and -l options for DESKTOP case
bugzilla at busybox.net
bugzilla at busybox.net
Sun May 27 23:10:07 UTC 2012
https://bugs.busybox.net/show_bug.cgi?id=5216
--- Comment #3 from Denys Vlasenko <vda.linux at googlemail.com> 2012-05-27 23:10:06 UTC ---
(In reply to comment #2)
> I see where it goes:
>
> #if ENABLE_SELINUX
> # define SELINUX_O_PREFIX "label,"
> # define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user"
> IF_FEATURE_PS_TIME(",time") ",args")
> #else
> # define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args")
> #endif
>
> ...
> #if ENABLE_SELINUX
> if (!(opt & OPT_Z) || !is_selinux_enabled()) {
> /* no -Z or no SELinux: do not show LABEL */
> strcpy(default_o, DEFAULT_O_STR +
> sizeof(SELINUX_O_PREFIX)-1);
> } else
> #endif
> {
> strcpy(default_o, DEFAULT_O_STR);
> }
>
>
> This default_o and DEFAULT_O_STR stuff should be rearranged for this to work.
> Something like,
>
> default_o[0] = '\0';
> if ((opt & OPT_Z) && is_selinux_enabled()) strcat(default_o,"label,");
> strcat(default_o,"pid,user"IF_FEATURE_PS_TIME(",time"));
> if (opt & OPT_L) strcat(default_o,"...");
> if (opt & OPT_W) strcat(default_o,"...");
>
> (with proper values for "...").
>
> But it quickly becomes rather complicated. Also, -w is cumulative really (-www
> is "more w" than -w). I'll try to cook something when I'll have time.
Yes, it is complicated because it tries to be space-efficient.
It will get way too ugly if we want to support -l and -f.
I recommend making it more simple even if this needs a few additional bytes.
> BTW, current busybox ps does not conform to neither POSIX nor procps in default
> output too. For example, default ps shows pid, tty, time and cmd of all
> processes run on current tty (so listing tty column is sort of wrong), while
> default bysybox ps shows pid, user and cmd of all processes (user instead of
> tty). Looks like if this should be fixed, it should be fixed together with
> -l/-w.
Yes, patches are welcome.
--
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