Since the ps command handles signals with it's own handler, it doesn't create
core files when something wrong happens. The attached patch restores the ps
command ability to create core files by calling the default handler once we
print our custom message. The original RH's workaround masked SIGABRT and
SIGSEGV signals and that would conflict with the original intention of the
custom signal handler and also with the filtering patch I sent in my previous
email. Moreover, this solution generates core for all relevant signals (SIGFPE,
etc.).
Bug-Redhat: http://bugzilla.redhat.com/871825
Bug-Redhat: http://bugzilla.redhat.com/512857
Reference: http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857
Signed-off-by: Craig Small <csmall@enc.com.au>
The sniplet below resulted not to be sorted correctly.
for i in $(seq 1 50); do ls -R /usr &>/dev/null 2>&1 & done
sleep 1; ps -e --sort=pcpu -o pcpu,comm=; pkill ls
Issue is present since older versions of procps (3.2.7/3.2.8).
Reference: http://www.freelists.org/post/procps/top-incorrect-sort,2
Reported-by: Jaromir Capik <jcapik@redhat.com>
Backported-by: Sami Kerola <kerolasa@iki.fi>
If stream status is not checked at the end of execution below problem
would not report error, or non-zero exit code. The uptime is just an
example same was true with all commands of the project.
$ uptime >&- ; echo $?
uptime: write error: Bad file descriptor
1
$ uptime >/dev/full ; echo $?
uptime: write error: No space left on device
1
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Strings with lower caps & no trailing dots have greater change to
have multiple occurences, meaning less effort for translators, than
strings with them.
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.
This patch mostly reorganizes include files and eliminates
some useless trailing whitespace.
It also adopts the standard procps-ng unconditional approach
to nls initialization.
Add the following three functions to most of the commands.
setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
These xalloc functions are a private function for the library. If using
programs need them, then they should make their own error reporting or
use a common file.
There were numerous ps memory allocation inconsistencies.
Some were checked for failure and others were not.
The program was modified to utilize the library memory
rouines which are consistent in dealing with errors.
(a few changes simply removed 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
Library changes
readproc
. added readeither to more efficiently
fill both process and thread proc_t
. added readproctab3, uses readeither
. included task path support in:
fill_cgroup_cvt, fill_cmdline_cvt,
read_unvectored
. QUICK_THREADS #define allows copying
process info vs. repeatedly reading
. simple_nexttid no longer values ppid
. path var made non-static in readtask
. documented 'proc_data_t' in .h file
. tweaked some c comments & formatting
library.map
. added new readeither, readproctab3
Program changes
ps
. exploits readproctab3 where possible
. improved args/comm compliance
top
. exploits readeither
Library changes
readproc
. added support for supplementary groups
. eliminated 2 potential mem leak sources
. shortcut used for multi-threaded str
vectors & ptrs was obsoleted
. freeing of proc_t related dynamic
memory now rests with the library
. standardized/normalized many c comments
sysinfo
. corrected note regarding glibc & cpuinfo
library.map
. made the visible freeproc accessable
Program changes
pmap
. initialized buffer for new readproc i/f
. eliminated now obsolete free() call
ps
. added width aware supgrp support
. initialized buffers for new readproc i/f
. eliminated now obsolete free() calls
top
. added supgrp support as variable width
. eliminated now obsolete free() calls
. expoilted library freeproc function
. corrected -h|v args text & spacing
. updated some c comments
Documentation changes
ps.1
. added supgid and supgrp
top.1
. added supgid and supgrp
. addition of above required renumbering
many fields in section 3a. DESCRIPTIONS
Library Changes
. added PROC_EDITCMDLCVT flag
. added an internal (static) fill_cmdline_cvt function:
- reads and "escapes" /proc/#/cmdline
- returns result as a single string in a single vector
- callers are guaranteed a cmdline (no more NULL)
. added vectorize_this_str function, exploited by
fill_cgroup_cvt, fill_cmdline_cvt
. generalized read_cmdline function as read_unvectored, now
exploited by fill_cgroup_cvt, fill_cmdline_cvt, read_cmdline
( cgroup and cmdline no longer need be converted to string )
( vectors before being transformed to final representation )
. fixed bug regarding skipped group numbers (when enabled)
. escape_str made responsible for all single byte translation
with distinction between control chars + other unprintable
. added escaped_copy function for already escaped strings
. reorganized parts of proc_t to restore formatting standards
( displacement changes shouldn't matter with new version # )
. former ZAP_SUSEONLY #define now OOMEM_ENABLE
. added to library.map: escaped_copy; read_cmdline
Top Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. eliminated now obsolete #include "proc/escape.h"
. changed the P_WCH display format if no kernel symbol table
. fixed very old bug in lflgs for out-of-view sort fields
. former ZAP_SUSEONLY #define now OOMEM_ENABLE
Ps Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. exploited the new escaped_copy function
. consolidated pr_args and pr_comm into pr_argcom
Signed-off-by: Jan Görig <jgorig@redhat.com>