Use NULL in format_array to indicate that the print function shall be
used also for sorting. Change sr_nop() to NULL for all fields which
don't use pr_nop() for printing.
Before the commit (note that '--sort label' has no effect: the rows
are not sorted according to label field):
$ ps -A -o command,label --sort label | grep /lib/systemd
/lib/systemd/systemd-journa system_u:system_r:syslogd_t:s0
/lib/systemd/systemd-udevd system_u:system_r:udev_t:s0-s0:c0.c1023
/lib/systemd/systemd-networ system_u:system_r:systemd_networkd_t:s0
/lib/systemd/systemd-resolv system_u:system_r:systemd_resolved_t:s0
/lib/systemd/systemd-timesy system_u:system_r:ntpd_t:s0
/lib/systemd/systemd-logind system_u:system_r:systemd_logind_t:s0
/lib/systemd/systemd --user user_u:user_r:user_t:s0
/lib/systemd/systemd --user root:sysadm_r:sysadm_t:s0-s0:c0.c1023
grep /lib/systemd user_u:user_r:user_t:s0
After the commit, '--sort label' works and the output is sorted:
$ ps -A -o command,label --sort label | grep /lib/systemd
/lib/systemd/systemd --user root:sysadm_r:sysadm_t:s0-s0:c0.c1023
/lib/systemd/systemd-timesy system_u:system_r:ntpd_t:s0
/lib/systemd/systemd-journa system_u:system_r:syslogd_t:s0
/lib/systemd/systemd-logind system_u:system_r:systemd_logind_t:s0
/lib/systemd/systemd-networ system_u:system_r:systemd_networkd_t:s0
/lib/systemd/systemd-resolv system_u:system_r:systemd_resolved_t:s0
/lib/systemd/systemd-udevd system_u:system_r:udev_t:s0-s0:c0.c1023
/lib/systemd/systemd --user user_u:user_r:user_t:s0
grep /lib/systemd user_u:user_r:user_t:s0
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
The library now presents command names up to 64 characters, in line with
the kernel changes. ps command name selection (the -C option) now also
is 64 characters long.
References:
commit 2cfdbbe897
ps previously followed the Unix98 standard when it comes to
user-defined output, sometimes. This meant you could have
user output format with a header that included commas and
equals signs. It was dependent on if ps thought you wanted
sysv or bsd format and THAT was dependent on things in previous
options.
It was very confusing to a user because
ps p $$ -o pid=,comm=
gave you a two-column output but
ps -p $$ -o pid=,comm=
would give you a one column output with the header ",comm="
The -p versus p means (to ps) you want sysv or bsd parsing.
Unix98 standard or not, this is plainly just silly.
The commit removes any of the quirks Unix98 has with user defined
output. If you really wanted a ps header with commas in the output,
today isn't your day.
Signed-off-by: Craig Small <csmall@enc.com.au>
This patch was made necessary by those library changes
in support of recently revised/simplified wchan logic.
In addition, this commit eliminates a broken alternate
'namelist' provision which was intended to allow users
to specify a System.map file to be used in translating
addresses into function names. But, the real effect of
the now defunct 'N' and '-n' options was to indirectly
force addresses (not names) to be displayed since such
user named map files could not be successfully parsed.
Besides when the required FRAME_POINTER kconfig option
is absent there is no address to translate and when it
is present /proc/PID/wchan is already translated. Thus
an alternate mapping is unnecessary and inappropriate.
[ we'll forgive POSIX for documenting '-n namelist' ]
Reference(s):
http://www.freelists.org/post/procps/WCHAN,11
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit introduces a new option q/-q/--quick-pid
to the 'ps' command. The option does a similar job
to the p/-p/--pid option (i.e. selection of PIDs
listed in the comma separated list that follows
the option), but the new option is optimized
for speed.
In cases where users only need to specify a list
of PIDs to be shown and don't need other selection
options, forest type output and sorting options,
the new option is recommended as it decreases
the initial processing delay by avoiding reading
the necessary information from all the processes
running on the system and by simplifying
the internal filtering logic.
common.h:23:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
global.c:499:3: warning: ISO C does not support the '%Ld' gnu_printf format [-Wformat]
output.c:134:1: warning: 'sr_cstime' defined but not used [-Wunused-function]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The catastrophic_failure function tries to make bug reporting useful
by telling in which line error occured, and drops core.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit represents an experiment in nls help text support.
The word --help itself been made translatable along with the
help section names and their abbreviations. Thus, the work of
the translators will ultimately alter program run-time behavior.
Perhaps someday all "long" options can behave in a similar way
which could offer a considerable benefit to other languages.
Instead of translationg just option descriptions, the long
forms of those options could also be transalated.
This commit also:
. includes the section abbreviations in --help output
. isolates all --help support in the ps/help.c module
. provides (hopefully) meaningful Translator guidance
. removes --help support from the ps/common.h header
. removes --help support from the ps/parser.c module
. eliminates tabs in line with the style of other ps modules
. eliminates the need for the include/c.h header file
This commit is prmarily concerned with elimnating deugging only
code from the nls template file.
It also eliminates any remaing useless trailing whitespace.
ps program
. etimes added for ELAPSED expressed in seconds
. time_t used in place of former unsigned long
top program
. corrected scroll message bug when 'x' toggle on
. fixed forest view potential missing libflags bug
. improved 'k' default signal invocation logic
. enhanced logic for %CPU maximums displayed
. made signal handling more robust and efficient