Ludwig Nussel [Fri, 7 Oct 2011 07:10:49 +0000 (09:10 +0200)]
sysctl: add --system switch
instead of requiring distributions to construct a loop around sysctl
in boot scripts just scan a set of default directories if the --system
switch is used.
Config files are applied in alphabetic order of their base name.
Each base name is only applied once according to the directory
preference. /etc/sysctl.conf is always applied last.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sun, 5 Jun 2011 11:23:15 +0000 (13:23 +0200)]
include/devname.h: add missing header
The devname.h requires readproc.h header which has dev_t. Unless
header is included the includes in program files must be in
correct order. I also added FIXME item to remind that for uid &
gid value int not correct data type but uid_t or gid_t from
pwd.h.
Sami Kerola [Sun, 5 Jun 2011 17:46:49 +0000 (19:46 +0200)]
sysctl: options handling & usage output
The sysctl now uses getopt_long and has help screen which be user
friendly. Rest of the modernization is left later, since this is
a command is used in scripts, and changing for instance error
printing to use warn & warnx could break stuff.
Craig Small [Tue, 20 Dec 2011 11:56:17 +0000 (22:56 +1100)]
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.
unknown [Mon, 5 Dec 2011 15:35:35 +0000 (16:35 +0100)]
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:
Craig Small [Sat, 17 Dec 2011 11:35:05 +0000 (22:35 +1100)]
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.
Jim Warner [Sun, 11 Dec 2011 18:00:50 +0000 (12:00 -0600)]
library: once again properly ignore a final empty cgroup
Commit a5881b5a4e5056d13906ce6128f6aa180d67d60e, 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.
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
Jim Warner [Tue, 6 Dec 2011 18:03:15 +0000 (12:03 -0600)]
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.
Jim Warner [Tue, 6 Dec 2011 00:57:46 +0000 (18:57 -0600)]
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.
Jim Warner [Thu, 17 Nov 2011 16:31:07 +0000 (10:31 -0600)]
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
Jim Warner [Fri, 2 Dec 2011 09:47:19 +0000 (03:47 -0600)]
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.
Craig Small [Sun, 4 Dec 2011 11:08:23 +0000 (22:08 +1100)]
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.
Sami Kerola [Sat, 3 Dec 2011 13:03:48 +0000 (14:03 +0100)]
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>
Craig Small [Fri, 2 Dec 2011 13:32:14 +0000 (00:32 +1100)]
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.
Craig Small [Fri, 2 Dec 2011 11:36:38 +0000 (22:36 +1100)]
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>