Commit Graph

684 Commits

Author SHA1 Message Date
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
Craig Small
562b4a039f Added news item for top search capability 2011-12-20 22:16:40 +11:00
Jim Warner
ff67012161 top: update man document for new search capability
This commit documents the top search provisons as a
new section entitled:
   5d. SEARCHING in a window

It also adds minor unrelated content and tweaks some
miscellaneous formatting and spacing inconsistencies.
2011-12-20 22:15:37 +11:00
Jim Warner
d6e6a9aa38 top: add a search capability 2011-12-20 22:15:31 +11:00
Craig Small
367b8bb616 Fixed watch 8 bit so its optional
You can make watch 8bit clean by using the configure option
--enable-watch8bit
2011-12-20 22:12:37 +11:00
Jarrod Lowe
8967f0fca3 watch: support unicode
A patch from Debian.

Bug-Debian: http://bugs.debian.org/240989
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/procps/+bug/318221
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-19 21:57:09 +11:00
Anthony DeRobertis
0dbdb862b1 watch: add precision wait time option -p
A patch from Debian.

Bug-Debian: http://bugs.debian.org/183486
Reviewed-by: Craig Small <csmall@debian.org>
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-19 21:57:09 +11:00
Craig Small
39a2f5d717 watch: interpret ANSI color code sequences
A patch from Debian.

Bug-Debian: http://bugs.debian.org/129334
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-19 21:56:02 +11:00
Mordechai T. Abzug
db552d38bc watch: add -exec and -beep flags and has better quoting
Additionally add -errexit flag (#183346).

A patch from Debian.

Bug-Debian: http://bugs.debian.org/410967
Bug-Debian: http://bugs.debian.org/183346
Reviewed-by: Craig Small <csmall@debian.org>
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:59:15 +11:00
Craig Small
99bebff06a w: use environment to set user and from/host column widths
A patch from Debian.

Bug-Debian: http://bugs.debian.org/396423
Bug-Debian: http://bugs.debian.org/341439
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:57:35 +11:00
Craig Small
88f485e20a w: use COLUMNS environment if TIOCGWINSZ fails
A patch from Debian.

Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:56:59 +11:00
Craig Small
a0a51eb921 w: bassman emulation with -o option
A patch from Debian.

Bug-Debian: http://bugs.debian.org/414906
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:56:41 +11:00
Michael Tokarev
04ce4db830 vmstat: do not scale si/so just like bi/bo
Use strtoull insteadof strtoul for some counters.

A patch from Debian.

Bug-Debian: http://bugs.debian.org/558361
Bug-Debian: http://bugs.debian.org/558134
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:54:20 +11:00
David Fries
3cea313cf3 libprocps-ng: sysinfo.c: truncate the vmstat figure to 32 bits
A patch from Debian.

Bug-Debian: http://bugs.debian.org/620557
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:53:59 +11:00
Craig Small
426941f8a3 tload: remote unneeded optarg and optind variables
A patch from Debian.

Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:53:30 +11:00
Craig Small
ff211c2f2e sysctl: fix up some option processing
A patch from Debian.

Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:53:08 +11:00
Justin Pryzby
db4751c216 skill: kill prints perror
A patch from Debian.

Bug-Debian: http://bugs.debian.org/468363
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:52:03 +11:00
WANG Yunfeng
15b853c02b skill: do not treat skill null parameter as 0
A patch from Debian.

Bug-Debian: http://bugs.debian.org/551173
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:51:32 +11:00
Craig Small
057f895529 skill: fix too greedy option parser
Patch based on submitted patch by Yoshio Nakamura

A patch from Debian.

Bug-Debian: http://bugs.debian.org/331419
Bug-Debian: http://bugs.debian.org/569030
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:50:58 +11:00
Craig Small
16329a7c3c libprocps-ng: readproc.c: some type conversion help
Return if unable to open /proc

A patch from Debian.

Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:50:40 +11:00
Craig Small
0c82b0ceda ps: rename SZ to SIZE
Means we do not follow SCO but less confusion.

A patch from Debian.

Bug-Debian: http://bugs.debian.org/541061
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:50:12 +11:00
Jessica McKellar
9ecd3c8414 ps: add sorting to %mem for ps
A patch from Debian.

Bug-Debian: http://bugs.debian.org/599043
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:48:38 +11:00
Craig Small
380cc1e908 pmap: provide information for -x option
A patch from Debian.

Similiar idea to pmap written by Robert Love.

Bug-Debian: http://bugs.debian.org/347476
Bug-Debian: http://bugs.debian.org/505571
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:47:34 +11:00
Jan Christoph Nordholz
c73a449482 pgrep: distinguish between invalid commandline parameters and '-?'
A patch from Debian.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=413383
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:38:03 +11:00
Craig Small
551d7e4114 pgrep: fix compiler warning saved_start_time might be used uninitialized
A patch from Debian.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=197342
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:34:11 +11:00
Craig Small
6bc22a379f pgrep: add -c option for counting number of matched proceesses
A patch from Debian.

Bug-Debian: http://bugs.debian.org/375791
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:30:41 +11:00
Daniel Novotny
5d29bfedc8 pwdx & libprocps-ng: Hurd does not have MAX_PATH defined
A patch from Debian.

Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=485243
Bug-Debian: http://bugs.debian.org/588677
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:30:00 +11:00
Alfredo Esteban
daf4014205 ps: --sort does not work with time argument
A patch from Debian.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508435
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508435
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:29:12 +11:00
Craig Small
86fb879a0d skill: add CR to warning line
A patch from Debian.

Bug-Debian: http://bugs.debian.org/331419
Bug-Debian: http://bugs.debian.org/331419
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:26:24 +11:00
Ciaran McCreesh
f78352f10a contrib: minimal ps: define mips PAGE_SIZE
A patch from Gentoo.

Bug-Gentoo: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-process/procps/files/procps-mips-define-pagesize.patch?revision=1.1&view=markup
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 22:25:11 +11:00
Armin van Buuren
90b201f1f4 libproc-ng: prettyfy proc mount messages
A patch from Gentoo.

Bug-Gentoo: https://bugs.gentoo.org/138029?id=138029
Bug-Gentoo: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-process/procps/files/procps-3.2.7-proc-mount.patch?revision=1.1&view=markup
Bug-Gentoo: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-process/procps/files/procps-3.2.7-proc-mount.patch?revision=1.1&view=markup
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 10:58:02 +11:00
unknown
fe82a3246a ps: add build option to disable ps option warning
Slackware seems to have this patch, while it is not in use(?) Well,
the upstream procps-ng allows one to disable warnings if that is
wanted. After all having this sort of 'feature' does not cost much,
while lacking it might annoy someone.

A patch from Slackware.

Reference: http://www.ftp.be/packages/slackware/slackware_source/a/procps/procps.nowarning.diff.gz
Backported-by: Sami Kerola <kerolasa@iki.fi>

Conflicts:

	proc/ksym.c
2011-12-18 10:53:44 +11:00
Hamish Moffatt
86fe50d179 libproc-ng: support building without WCHAR support
The uClibc might not have wchar.

A patch from Buildroot.

Reference: http://git.buildroot.net/buildroot/tree/package/procps/procps-wchar.patch?id=fc333e7d083d144e0f8d1c4bac061b8de2ee7510
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 10:36:07 +11:00
Steven J. Hill
dd03003edd sysctl: remove index() for buildroot
The uClibc does not support index() function.

A patch from Buildroot.

Reference: http://git.buildroot.net/buildroot/patch/?id=f460603f02092b4f514d108dd8b4167a7a056213
Backported-by: Sami Kerola <kerolasa@iki.fi>
2011-12-18 10:28:21 +11:00
Craig Small
2019cbfded forgot to change the interface name for sym file 2011-12-17 22:38:19 +11:00
Craig Small
38763ede40 Rename library and use proper versioning
Previously the version of libproc always tracked the version of procps.
This doesn't work when other non-procps programs link to the library as
they are always playing catch up.

This change makes the library version independent of the procps version.
It will only be incremented when needed.
2011-12-17 22:35:05 +11:00
Craig Small
5a991f0444 updated to version 3.3.2 2011-12-14 23:10:55 +11:00
Jim Warner
c3a1239efe library: once again properly ignore a final empty cgroup
Commit a5881b5a4e, addressing
command lines with a trailing space, produced an undesirable
side effect in the fill_cgroup_cvt() function.

This patch restores correct cgroup behavior while still
producing command lines with no trailing space.
2011-12-14 23:02:51 +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
8fbe2dea04 top: correct man doc max header width (new fields added) 2011-12-11 22:29:19 +11:00
Jim Warner
80e2f59e05 top: provide own SIGRTMAX, if not already defined
Protect against a compile failure, as on HURD.

Reference:
  https://buildd.debian.org/status/package.php?p=procps&suite=sid
  top.c:2102:13: error: 'SIGRTMAX' undeclared (first use in this function)
2011-12-11 22:28:11 +11:00
Jim Warner
1e4447d171 top: circumvent a false positive smatch error
The smatch error --------------
top.c +1414 calibrate_fields(78) error: buffer overflow 'Fieldstab' 39 <= 39

  The code -----------------------
if (P_MAXPFLGS < f) { w->endpflg = i; continue; }

  The background -----------------
The enum P_MAXPFLGS is strictly a fencepost and can *never* appear in
the arrays pflgsall or procflgs.  Thus it (39th element) cannot be used
in referencing Fieldstab.

However, two enums of higher value (X_XON=40 and X_XOF=41) *can* appear
in those arrays.  But the test against the fencepost ensures that those
two enums are *never* used in referencing Fieldstab.

When the analyzer sees the conditional using '<' and not '<='
it reports a false positive.

The source was changed to accommodate the tool's deficiency
2011-12-11 22:28:03 +11:00
Jim Warner
cd608f462e top: forest view segmentation fault, the final solution
With forest view mode under procps-ng-3.3.0, top would catch
a SEGV and exit.  The problem was thought to be related to
some linux version 3 anamoly.

In procps-ng-3.3.1, top was protected from abnormal exit and
would display the offending processes with the special orphan
notation '?', instead of the usual artwork.

As it turns out, the problem wasn't with linux and could
surface under a 2.6.xx kernel,  The cause was an occasional
abnormal ordering of tid/tgid/ppid which went unresolved
due to a progressive proc table scan in the recursive
function forest_add().

By default the proc table scan now restarts at the beginning.
However, a #define TREE_ONEPASS is provided should one wish
to restore the 3.3.1 behavior with its reduced overhead.
2011-12-11 22:27:56 +11:00
Jim Warner
242be5194c top: correct an obscure column highlighting buglet
An anomaly would surface whenever the sort column was
made non-display under fields management.

The scroll message would report incorrect x coordinates
and the 'x' toggle would produce an unintentional
horizontal scroll.

This patch forces column highlighting off whenever field
changes are made (as is done for horizontal scrolling).
It also inactivates the 'x' toggle whenever the sort
column is not visible.

This bug has yet to be reported.
2011-12-11 22:27:47 +11:00
Jim Warner
c8bbcec5db top: improve the most heavily used library interface
In the procs_refresh() function:
. the proctable scan was simplified
. memory allocation is now much more efficient
. window ppts will usually not now need xrealloc
2011-12-11 22:27:34 +11:00
Jim Warner
88087ec5a5 top: exploit enhanced library memory allocation provisions
Now that the library allows for customizing the response to
memory allocation errors, it is no longer necessary for top
to provide its own.

This library extension was necessary since top modifies the
termios structure and there would otherwise be no way to
restore the users tty.
2011-12-11 22:27:27 +11:00
Jim Warner
e048aa0e7e library: eliminate one redundant 'extern' qualifier 2011-12-11 22:27:19 +11:00
Jim Warner
a5881b5a4e library: create cmdlines consistently with no trailing space
When PROC_FILLARG was used (invoking file2strvec)
command lines contained no trailing space.

When PROC_EDITCMDLCVT was used (invoking read_unvectored)
command lines contained a trailing space.

Now both routes to a cmdline act the same -- no trailing space.
2011-12-11 22:27:12 +11:00
Jim Warner
ed59472307 library: provide for huge cmdlines, like old libproc
The CodingStyle document suggests programs should allow for
cmdlines of at least 128k.  Only the ps program can display
such a cmdline, and only with multiple -w switches.

The library function file2strvec can essentially return
a cmdline of unlimited length.  However, the library function
fill_cmdline_cvt used an arbitrary upper limit of 2048 for
buffers automatically allocated on the stack.

This patch raises the fill_cmdline_cvt upper limit to 128k via
dymaically acquired utility buffers ensured by the openproc
function.

It also makes indentation consistent in the openproc function.
2011-12-11 22:27:06 +11:00
Jim Warner
827334870d library: exploit enhanced library memory allocation provisions
There were numerous library memory allocation inconsistencies.
Some were checked for failure and others were not.

All library source modules were modified to utilize the alloc.h
memory rouines which are consistent in dealing with errors.
2011-12-11 22:26:55 +11:00