Commit Graph

55 Commits

Author SHA1 Message Date
Craig Small
c03aa80ad1 Fixed warning about error_at_line
ps/display.c:65:7: warning: implicit declaration of function
‘error_at_line’ [-Wimplicit-function-declaration]

Applied Gentoo patch created by ssuominen

References:
  http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-process/procps/files/procps-3.3.6-error_at_line.patch?annotate=1.1&diff_format=f
  http://www.freelists.org/post/procps/procpsng-337,17

Signed-off-by: Craig Small <csmall@enc.com.au>
2013-03-26 21:27:38 +11:00
Jaromir Capik
c1f10d11bc Allow core file generation by ps command (rhbz#871825, rhbz#512857)
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>
2012-12-13 22:17:03 +11:00
Jaromir Capik
f62fd63d9e Fix for : procps states a bug is hit when receiving a signal (rhbz#871824, rhbz#441656)
Bug-Redhat: http://bugzilla.redhat.com/871824
Bug-Redhat: http://bugzilla.redhat.com/441656
2012-12-13 21:37:58 +11:00
Jan Grig
cdeb9a071a ps: fix cpu utilization sorting
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>
2012-04-25 09:34:06 +10:00
Sami Kerola
52269d22f3 all: check stdout and stderr status at exit
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>
2012-03-23 15:57:53 +01:00
Sami Kerola
ce61089059 docs: clarification to license headers in files
Add license header to all files.  The summary of licensing is below,
taken from Craig Small's email which is referred in commit message
tail.

sysctl and pgrep are GPL 2+
The rest is LGPL 2.1+

Reference: http://www.freelists.org/post/procps/Incorrect-FSF-address-in-the-license-files,8
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=797962
CC: Craig Small <csmall@enc.com.au>
CC: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:41:11 +11:00
Sami Kerola
79ceb30b5c ps: unify cases and remove trailing dots in messages
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>
2012-01-15 20:52:58 +01:00
Sami Kerola
809906b6a7 ps: add catastrophic_failure()
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>
2012-01-13 22:42:38 +01:00
Jim Warner
4fb48c0bdb ps: generalize help text logic, add related translator hints
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
2012-01-04 08:58:53 +11:00
Jim Warner
b8c3288594 ps: exclude debugging only code from participation in nls support
This commit is prmarily concerned with elimnating deugging only
code from the nls template file.

It also eliminates any remaing useless trailing whitespace.
2012-01-04 08:58:53 +11:00
Jim Warner
71b72b36ce ps: minor reformatting and trailing whitespace elimination
This patch mostly reorganizes include files and eliminates
some useless trailing whitespace.

It also adopts the standard procps-ng unconditional approach
to nls initialization.
2012-01-04 08:58:53 +11:00
Sami Kerola
c862a4caa5 nls: add functions which take translations to be used
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>
2011-12-20 17:30:53 +01:00
Sami Kerola
4bd36d1483 ps: add gettext support
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:45 +01:00
Craig Small
2865ded64e Removed xalloc type functions from library
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.
2011-12-20 22:56:17 +11:00
Jim Warner
229be7b160 ps: exploit enhanced library memory allocation provisions
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)
2011-12-11 22:29:25 +11:00
Jim Warner
0e663aacbc redhat analysis: ps/display 2011-10-15 08:26:28 +02:00
Craig Small
b9a408372e Merge branch 'master', remote-tracking branch 'sami/ng' 2011-10-01 23:23:30 +10:00
Craig Small
e4c45d6984 added ps etimes, miscellaneous top enhancements
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
2011-09-12 22:18:23 +10:00
Craig Small
bb4f08ba29 refined library i/f and improved performance
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
2011-08-11 07:42:14 +10:00
Craig Small
3ef4823f90 supgid/supgrp support, improved library interface
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
2011-08-01 21:28:46 +10:00
Sami Kerola
71d10d3a49 name change: procps -> procps-ng
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-04 20:50:12 +02:00
Jim Warner
7b0fc19e9d enhanced libproc cgroup/cmdline support, exploited by top
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>
2011-05-18 10:33:44 +02:00
Jan Görig
af25453d9a ps displays cgroup
Author: Swann Perarnau <swann.perarnau@imag.fr>
Bug-Debian: http://bugs.debian.org/469669
Reviewed-by: Craig Small <csmall@debian.org>
2010-12-16 10:23:49 +01:00
albert
95cc4c37bb variable-width %CPU,PPID,PID 2005-01-06 00:13:12 +00:00
albert
55aee6a969 SIGTSTP not a bug 2005-01-05 20:34:51 +00:00
albert
c961f2604a leftovers in the 3.2.4 release 2004-11-04 20:50:59 +00:00
albert
cb8bd84b21 CodingStyle left out of tarball. Tweak top. Leftovers? 2004-02-23 18:47:42 +00:00
albert
a760a2c22d "top -p1" then hit "=" did SIGSEGV; flags not regenerated right 2004-01-28 21:53:44 +00:00
albert
e583724fff H m -m -L -T are all working 2003-10-21 00:51:36 +00:00
albert
7dfe80961a sorted threads might work 2003-10-19 23:37:47 +00:00
albert
e180e4875f more goodies 2003-10-16 03:30:41 +00:00
albert
3a16c12ce3 top on wyse60, whitespace doc, thread fixes 2003-10-07 03:12:50 +00:00
albert
71312f1516 more per-process stuff 2003-09-29 04:09:52 +00:00
albert
35859fb0a8 ugly wart gone 2003-09-28 17:23:29 +00:00
albert
c462dcfad5 ps thread support 2003-09-20 08:29:55 +00:00
albert
8b04273f89 EVIL_PROC_HACK 2003-09-17 21:58:32 +00:00
albert
0db94e6a1a GPLONLY_ and PID-related stuff 2003-07-03 05:20:19 +00:00
albert
aa6fd01f1d SKIP 2003-03-19 01:15:58 +00:00
albert
1351592110 top: do not refresh like crazy 2003-03-17 23:42:00 +00:00
albert
cc5c6955be warning directs users to the FAQ 2003-02-18 03:51:03 +00:00
albert
f5702f2c75 ps --ppid 2003-02-09 07:31:11 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
5087f3dbf6 big header clean-up 2002-12-09 07:00:07 +00:00
albert
98895d57c1 Jim needs restrictions 2002-11-27 00:24:01 +00:00
albert
5007f548ce 3.1.0 2002-11-09 03:01:35 +00:00
albert
4b57916ac9 ps --sort bug 2002-10-14 05:12:14 +00:00
albert
81a4a3d281 gcc 3.0 warnings 2002-10-12 04:25:57 +00:00
albert
667b1bc2fa sort by %cpu redone 2002-10-09 23:40:30 +00:00
albert
201c31886d args/comm in needs 2002-10-08 21:48:19 +00:00
albert
9736b7be92 +/- debug code 2002-10-02 13:35:39 +00:00