Commit Graph

644 Commits

Author SHA1 Message Date
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
Jim Warner
7126cc4491 library: expanded/generalized memory allocation provisions
A callback provision in the form of xalloc_err_handler
(of type message_fn) was added to the alloc module.

This change allowed a program like top, who alters the
termios structure, to override the default fprint(stderr...)
behavior in the event of an error.

The new function xstrdup was also added for symmetry.
2011-12-11 22:26:49 +11:00
Craig Small
f9ab2fec43 Added Debian bug note for pgrep -u and testsuite
Makefile.am testsuite needed to explicitly state the files because while
everything else works, make distcheck fails.

NEWS got updated with the Debian bug number for pgrep -u
2011-12-06 21:37:45 +11:00
Jim Warner
41ed28aa5d top: avoid potential forest view segmentation fault 2011-12-06 08:51:15 +11:00
Craig Small
497428d770 revert sentinel code for top 2011-12-06 08:51:06 +11:00
Jim Warner
be4d00ffe9 top: forest view contingency sentinal code added 2011-12-05 08:44:46 +11:00
Craig Small
db602e1d44 slabtop check has optional spaces at start of line
There is a race condition between expect script consuming the output
from slabtop. There were a sequences of lines that looked like
^\d+ ... \s*
with the last \s* consuming the first space on the start of the line.
However if the line takes too long to print, then expect stops there and
the space at the start of the subsquent line does not match.

The solution is a \s* at the start ofthe line.
2011-12-04 22:08:23 +11:00
Sami Kerola
5277341278 tests: clean up kill temporary file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-03 20:20:27 +01:00
Sami Kerola
adab19653a build-sys: site.exp does not need to be in dist package
The file is automatically generated by make.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-03 20:20:27 +01:00
Sami Kerola
9d6dc4d8c3 build-sys: simplify tests EXTRA_DIST configuration
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-03 20:20:27 +01:00
Sami Kerola
03a1a42e28 build-sys: make DEJATOOL definition uncondictional
Fix to ./autogen.sh error bellow.

/usr/share/automake-1.11/am/dejagnu.am: DEJATOOL was already defined in condition LINUX, which is included in condition TRUE ...
testsuite/Makefile.am:6: ... `DEJATOOL' previously defined here

Reference: http://www.freelists.org/post/procps/procpsng-331-nearly-there,5
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-03 20:20:14 +01:00
Craig Small
e7a0fe5bee Fixing tests due to some results
Makefile will now only test for Linux systems, a work around in the
makefile due to some silly redefine restrictions.

uptime and w now won't error due to being one user logged in, thanks to
Sami for the patch

kill processes by pid test commented out due to false negatives

pwdx process 1 check also commented out due to false negatives
2011-12-04 00:50:36 +11:00
Craig Small
3d807ae853 Minor test fixes for non-linux
procps works well on Linux, on other arches there are some strange
differences due to their emulation of procfs which is not 100%
Disabling checks for non-linux until that can be sorted out.
2011-12-03 00:32:14 +11:00
Craig Small
4725fc735e Merge remote-tracking branch 'csmall/testsuite' 2011-12-02 22:42:46 +11:00
Craig Small
226c1f2a6f Added slabtop tests 2011-12-02 22:41:03 +11:00
Craig Small
0bee2f1060 slabtop prints plain ASCII in once mode
Using ncurses initscr/endwin clears the screen for xterm/etc it
now prints raw text using printf
Bug-Debian: http://bugs.debian.org/503089
Author: Craig Small <csmall@debian.org>
2011-12-02 22:36:38 +11:00
Craig Small
bf1cd8b6e7 Merge branch 'master' of gitorious.org:procps/procps
Conflicts:
	NEWS
2011-12-01 23:13:15 +11:00
Craig Small
43734fad69 Merge remote-tracking branch 'csmall/testsuite' 2011-12-01 23:01:27 +11:00
Craig Small
7790520f07 8 bit patch added to watch 2011-12-01 23:01:12 +11:00
Craig Small
23afed732a fixed small tests for pmap and ps checks 2011-12-01 22:42:23 +11:00
Craig Small
f05e15e830 More testing added for procps 2011-11-30 23:11:35 +11:00
Sami Kerola
3f42de1432 build-sys: add symbol map file to autotools distribution
The file became necessary in
commit 901e381256

Signed-off-by: Sami Kerola <sami.kerola@tomtom.com>
2011-11-29 22:57:17 +11:00
Craig Small
261a3fae83 fixed pgrep and added ps tests 2011-11-29 22:55:03 +11:00
Craig Small
93a9550315 Added news about 8bit char and tests 2011-11-28 22:41:19 +11:00
Craig Small
b0ed746267 Watch uses unsigned chars to be 8bit clean
Taken from the Debian patch watch_8bitchar
2011-11-28 22:39:09 +11:00
Craig Small
be55207672 Merge remote-tracking branch 'csmall/testsuite' 2011-11-28 22:04:17 +11:00
Craig Small
b36fe6efc5 Add sysctl check and tests to extra_dist 2011-11-28 22:02:27 +11:00
Craig Small
6551d75ea2 Use real name in NAME section for top manpage
Things like lexgrog and whatis and apropos need to look a the line in
the NAME section in the manpage. There used to be a macro there which
they don't understand.
lexgrog top.1
top.1: parse failed
2011-11-27 22:56:13 +11:00
Craig Small
61dec8f664 Merge remote-tracking branch 'main/master' into testsuite 2011-11-27 22:49:14 +11:00
Craig Small
20463f1a13 vmstat -p <part> works and updated version to 3.3.1
configure.ac now set to 3.3.1
vmstat -p has not worked for a long time, this applies Debian patch
vmstat_part_format, the details:

Author: Daniel Novotny
Description: The contents of /proc/diskstats have changed since 2.6.25
 Changed PATH_MAX to 32 because its missing on hurd
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=485243
Bug-Debian: http://bugs.debian.org/588677
Last-Update: 2010-11-17
2011-11-27 22:47:17 +11:00
Craig Small
919e37787e added uptime and vmstat tests 2011-11-27 19:12:56 +11:00
Craig Small
5c48d8b79a rearranged testsuite 2011-11-27 18:32:10 +11:00
Craig Small
2cad7c5667 more free tests and pgrep tests
Almost fully testing all features of pgrep now.
free had additional tests added to it
2011-11-27 15:30:04 +11:00
Craig Small
49c99b1189 Additional tests for free command 2011-11-24 23:06:06 +11:00
Craig Small
82eafe3fe8 new free commands 2011-11-23 22:48:49 +11:00
Craig Small
451f6e6111 testsuite fixes 2011-11-23 21:44:51 +11:00
Craig Small
618c52167b reversed the frees added to pgrep 2011-11-23 21:31:43 +11:00
Sami Kerola
2e96bc3771 pgrep: core dropped nearly always
The do_regcomp() tries to free command line argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-20 22:16:35 +01:00
Sami Kerola
64b420936e libproc-ng: add pkg-config support
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-05 14:13:40 +01:00
Sami Kerola
901e381256 libproc-ng: fix ld version script file support
Notice that contents of file library.map file are almost certainly
wrong as it is making everything exported.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-05 13:29:54 +01:00
Jim Warner
fadce3f1b2 build-sys: a minimialst approach to ncurses
. 3 pgms require non-wide <curses.h> or <ncurses.h>

This patch represents the tests for a minimal environment
consistent with current ncurses needs.

It should allow a successful configure and build
2011-10-31 22:05:17 +11:00