]> granicus.if.org Git - procps-ng/log
procps-ng
12 years agosysctl: restore old -p handling
Mike Frysinger [Thu, 3 May 2012 05:24:20 +0000 (01:24 -0400)]
sysctl: restore old -p handling

The previous version of sysctl had the form:
sysctl -p [file]
In other words, it required a space between the -p and the [file].
Omitting the space would lead to an error.

The new version though is the opposite:
sysctl -p[file]
In other words, it requires there to not be a space.

Considering the old behavior has been around for a decade, and runtime
checking for this mismatch in behavior is silly, and supporting the old
syntax is trivial, add support for it.

When '-p regexp' is glob is used to make reqular expression to be
expanded to argument list, which also means that -p option will
allow multiple files being specified as input.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agosysctl: fix broken .conf suffix matching
Mike Frysinger [Thu, 3 May 2012 05:07:58 +0000 (01:07 -0400)]
sysctl: fix broken .conf suffix matching

There's an off-by-one error in the count (".conf" is 5 bytes, not 6),
and the logic is inverted for the strcmp return value -- we want to
skip the files when they *don't* end in .conf, not when they *do*.

Also fix the off-by-one len check.

Bug-Debian: http://bugs.debian.org/669128
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agosysctl: use stdbool.h
Mike Frysinger [Thu, 3 May 2012 05:02:52 +0000 (01:02 -0400)]
sysctl: use stdbool.h

The stdbool.h header is part of C99 and has been usable on systems for
more than a decade.  Let's drop these manual hacks.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agodocs: correct libprocps name in FAQ
Sami Kerola [Sun, 29 Apr 2012 15:34:54 +0000 (17:34 +0200)]
docs: correct libprocps name in FAQ

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: allow packagers to choose what is installed
Sami Kerola [Sun, 29 Apr 2012 15:22:29 +0000 (17:22 +0200)]
build-sys: allow packagers to choose what is installed

Distribution maintainers may not want to use upstream example files
in their procps-ng package.

Reference: http://permalink.gmane.org/gmane.linux.arch.devel/17440
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotop: ensure /proc is mounted before term is diddled
Jim Warner [Wed, 25 Apr 2012 04:08:02 +0000 (23:08 -0500)]
top: ensure /proc is mounted before term is diddled

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: address a defect with the library PROC_PID flag
Jim Warner [Sun, 15 Apr 2012 20:15:15 +0000 (15:15 -0500)]
top: address a defect with the library PROC_PID flag

The library does not weed out potential duplicate PID
values when sampling with the PROC_PID flag.  This was
treated as merely an inefficiency by top and safely
ignored prior to the advent of forest view mode.

Now, however, if the -p switch duplicates certain PIDs,
*and* those processes have no PPID, *and* top's forest
view mode is active or activated, then a SEGV will be
generated (and caught).

This rather obscure buglet is thus limited to pid #1
(/sbin/init) and pid #2 (kthreadd).  With any other
duplicate PIDs the worse case scenario was a '?' in
place of the usual forest view artwork.

This commit silently ignores any duplicate process ids
and thereby avoids the potential segmemtation fault.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoall: fix misspellings in docs and program comments
Jim Warner [Mon, 23 Apr 2012 16:50:49 +0000 (11:50 -0500)]
all: fix misspellings in docs and program comments

We might as well join the coreutils and util-linux
projects in correcting our own typos.

The following was left unchanged:
   top/top.c[1797]: thru -> "through"

references:
http://lists.gnu.org/archive/html/coreutils/2012-04/msg00057.html
http://marc.info/?l=util-linux-ng&m=133518057419736&w=2

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoRemove trailing - from w from column
Craig Small [Wed, 25 Apr 2012 00:21:07 +0000 (10:21 +1000)]
Remove trailing - from w from column

Jaromir Capik discovered that the from column for w would print
a trailing - for some types of hosts.

12 years agolibprocps: protect locale environment getting overwrite
Michael Schwendt [Fri, 18 Dec 2009 04:27:21 +0000 (05:27 +0100)]
libprocps: protect locale environment getting overwrite

The problem is that in ./proc/sysinfo.c uptime(), it is not
considered that the "savelocale" string is overwritten by the
subsequent call to setlocale().  Hence restoring the locale later on
won't work this way.  "savelocale" ought to be a copy of the string
pointed to by setlocale()'s return-value.

Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=548711
Backported-by: Sami Kerola <kerolasa@iki.fi>
12 years agops: fix cpu utilization sorting
Jan Görig [Mon, 23 Apr 2012 18:45:10 +0000 (20:45 +0200)]
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>
12 years agobuild-sys: add fileutils.h to dist package
Sami Kerola [Wed, 18 Apr 2012 08:26:20 +0000 (10:26 +0200)]
build-sys: add fileutils.h to dist package

The 'make distcheck' failed with.

../../ps/display.c:39:34: fatal error: ../include/fileutils.h: No such file or directory

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: howto build uClibc version of the procps-ng
Sami Kerola [Tue, 17 Apr 2012 20:10:01 +0000 (22:10 +0200)]
docs: howto build uClibc version of the procps-ng

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: uClibc does not have rpmatch()
Sami Kerola [Tue, 17 Apr 2012 19:41:26 +0000 (21:41 +0200)]
build-sys: uClibc does not have rpmatch()

Add simple replacement with hardcoded y/n responses to allow
compilation on systems without rpmatch().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: make buildroot compilation work
Sami Kerola [Tue, 17 Apr 2012 19:21:20 +0000 (21:21 +0200)]
build-sys: make buildroot compilation work

Fixes the following error in configure stage.

configure: error: cannot run test program while cross compiling

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: program_invocation_short_name is defined in errno.h
Sami Kerola [Mon, 16 Apr 2012 18:43:16 +0000 (20:43 +0200)]
build-sys: program_invocation_short_name is defined in errno.h

The autotools check is using argp.h which can be missing in some
environments.

Reference: http://old.nabble.com/-PATCH--argp%3A-fix-program_invocation_name-detection-td30252754.html
Reference: http://lists.linuxtogo.org/pipermail/openembedded-core/2011-June/003772.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotests: do not assume sleep command path
Sami Kerola [Mon, 16 Apr 2012 18:25:23 +0000 (20:25 +0200)]
tests: do not assume sleep command path

The testsuite failed on archlinux which has sleep in /usr/bin/
instead of /bin/ directory.  This commit will make expect to use
$PATH to determine where sleep is.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: fix manual page warnings
Sami Kerola [Mon, 16 Apr 2012 10:55:53 +0000 (12:55 +0200)]
docs: fix manual page warnings

All warnings where about unnecessary quoting.  The scriptlet
below will tell what was wrong.

for I in ./top/top.1 ./ps/ps.1 ./*.[0-9]; do
    echo "== $I warnings =="
    man --warnings=all $I > /dev/null
done

This should probably be turned to 'make check' script.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotop: document an existing provision of pid monitoring
Jim Warner [Fri, 13 Apr 2012 18:13:13 +0000 (13:13 -0500)]
top: document an existing provision of pid monitoring

Since its inception top has provided for monitoring
only specific process ids via the -p command line
switch.  This provision has also embraced the top
process itself, even though its pid wasn't yet known.

This commit simply documents the special zero value,
which would otherwise be an invalid process id.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoMerge remote-tracking branch 'sami/2012wk12'
Craig Small [Sun, 15 Apr 2012 00:44:37 +0000 (10:44 +1000)]
Merge remote-tracking branch 'sami/2012wk12'

Conflicts:
watch.c

12 years agoNEWS: just playing catch-up with resolved issues
Jim Warner [Wed, 11 Apr 2012 09:11:12 +0000 (04:11 -0500)]
NEWS: just playing catch-up with resolved issues

This commit simply:
. adds some missing top acknowledgements
. reorganizes 3.3.3 text by program and bug number
. eliminates one instance of trailing whitespace

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: fix a segfault when -p switch specified invalid pid
Jim Warner [Wed, 11 Apr 2012 09:11:12 +0000 (04:11 -0500)]
top: fix a segfault when -p switch specified invalid pid

In attempting to keep at least one task visible when
scrolling vertically, a negative task index would be
produced when pid monitoring was in effect and no
matching pid was found.

Since there were already other conditions where no
task might displayed, the faulty source line has been
removed.

Bug-Debian: http://bugs.debian.org/668335

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: miscellaneous cosmetic non-logic changes
Jim Warner [Wed, 11 Apr 2012 09:11:12 +0000 (04:11 -0500)]
top: miscellaneous cosmetic non-logic changes

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: extend case-insensitive option to include 'Locate'
Jim Warner [Wed, 11 Apr 2012 09:11:12 +0000 (04:11 -0500)]
top: extend case-insensitive option to include 'Locate'

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotests: add lib/ contents to make check
Sami Kerola [Fri, 23 Mar 2012 15:03:44 +0000 (16:03 +0100)]
tests: add lib/ contents to make check

This will take tests in following commits in use.

commit 56ed9826a522448da60a6645a8eca47f5f0c6826
commit c7cf98b0e03780f78abe5275c6fb282f71a2369f

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosysctl: simplify file close error checking
Sami Kerola [Fri, 23 Mar 2012 14:53:01 +0000 (15:53 +0100)]
sysctl: simplify file close error checking

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoall: check stdout and stderr status at exit
Sami Kerola [Fri, 23 Mar 2012 12:32:24 +0000 (13:32 +0100)]
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>
12 years agolib: add fileutils file with stream error checking facility
Sami Kerola [Fri, 23 Mar 2012 10:10:04 +0000 (11:10 +0100)]
lib: add fileutils file with stream error checking facility

The close_stream() is copied from GNU lib. Inspiration to do this
is talk by Jim Meyering - Goodbye World! The perils of relying on
output streams in C.

Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch -g exits early
Craig Small [Sat, 17 Mar 2012 21:22:07 +0000 (08:22 +1100)]
watch -g exits early

Patch supplied by Kent R. Spillner <kspillner@acm.org>.
Previous watch -g would do the following:
   unchanged screen (wait)
   changed screen (wait)
   (exit)

Now it exits right after the screen changes.

12 years agotop: correct miscellaneous omission, typo and buglet
Jim Warner [Fri, 16 Mar 2012 05:00:00 +0000 (00:00 -0500)]
top: correct miscellaneous omission, typo and buglet

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoskill, snice: do not encourage building these utilities
Sami Kerola [Thu, 15 Mar 2012 20:29:13 +0000 (21:29 +0100)]
skill, snice: do not encourage building these utilities

Both skill and snice are are mentioned in manual page to be 'obsolete
and unportable'.  This commit discourages distributors to keep these
commands part of default system.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoskill: remove dead code
Sami Kerola [Thu, 15 Mar 2012 20:05:08 +0000 (21:05 +0100)]
skill: remove dead code

Commit 991b8a94f0354a128085c7411713e17282c4e04a took use
getopt_long(), which means the code that is related to earlier
selfmade argument parsing is unnecessary.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: refactor code, add output_header() and run_command()
Sami Kerola [Sat, 10 Mar 2012 12:29:34 +0000 (13:29 +0100)]
watch: refactor code, add output_header() and run_command()

The main() was starting to be quite long with deep indents.  Both
signs of clean up being welcome change.

FIXME: The comment also changes -g option to exit immediately,
when screen contents change.  This should be separated commit,
e.g. the stuff is not ready to be merged.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: remove arbitrary terminal size restriction
Sami Kerola [Thu, 8 Mar 2012 21:41:23 +0000 (22:41 +0100)]
watch: remove arbitrary terminal size restriction

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoslabtop, vmstat, watch: remove file descriptor constants
Sami Kerola [Thu, 8 Mar 2012 20:49:49 +0000 (21:49 +0100)]
slabtop, vmstat, watch: remove file descriptor constants

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoMerge commit 'refs/merge-requests/3' of git://gitorious.org/procps/procps into merge...
Craig Small [Thu, 15 Mar 2012 20:26:12 +0000 (07:26 +1100)]
Merge commit 'refs/merge-requests/3' of git://gitorious.org/procps/procps into merge-requests/3

12 years agoMerge remote-tracking branch 'sami/2012wk9'
Craig Small [Thu, 15 Mar 2012 20:21:37 +0000 (07:21 +1100)]
Merge remote-tracking branch 'sami/2012wk9'

12 years agotop: correct loss of keystrokes paste capability
Jim Warner [Mon, 12 Mar 2012 17:12:12 +0000 (12:12 -0500)]
top: correct loss of keystrokes paste capability

When top introduced true line input editing, the
ability to paste keystrokes was lost.  This remains
a necessary evil so that top has an opportunity to
translate cursor motion keystrokes into terminfo
escapes during line input.  Motion keys themselves,
of course, can never be pasted.

If pasting ever became more important than input
editing, then native termios support should have been
available via a define called TERMIOS_ONLY.  But a
recent commit, eliminating what was thought to be
obsolete logic, rendered the alternate linein()
function virtually useless.

Similar to top-3.2.8, when native termios input is
functional, these abberations can be experienced:
. cursor motion keys will appear as escapes
. excessive input can cause line wraps
. ^Z during i/p is not be honored until <Enter>
. SIGWINCH during i/p corrupts screen temporarily

In hindsight, it now seems that the ability to paste
keystrokes may indeed outweigh any shortcomings of
native termios support.  This is especially true if
one is preparing to search ('L') for some lengthy
process command line contined in the clipboard.

Thus, this patch fixes the alternate linein() function
and changes TERMIOS_ONLY to TERMIO_PROXY so that top
now defaults to using native termios input.  In turn,
that will restore the paste keystrokes capability.

Reference(s):
commit: 045538e01b4588e33bacc1ac57abc799b6d24d7b

Reported by: sergio <mailbox@sergio.spb.ru>
Bug-Debian:  http://bugs.debian.org/663334

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agomisc: update remaining memory references to IEC standard
Jim Warner [Thu, 8 Mar 2012 20:27:12 +0000 (14:27 -0600)]
misc: update remaining memory references to IEC standard

This commit brings the few remaining occurances
of kB, etc. into line with the IEC binary naming
standard.

Comments containing any such references have been
left unchanged.

Reference(s):
commit 2fc3f15770fcbc464e80d560b8bae167fc05e957

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: some isolated typos and minor code changes
Jim Warner [Thu, 8 Mar 2012 06:00:00 +0000 (00:00 -0600)]
top: some isolated typos and minor code changes

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoDon't check if output changed on first screen.
Kent R. Spillner [Sun, 11 Mar 2012 15:14:27 +0000 (10:14 -0500)]
Don't check if output changed on first screen.

When invoked with the --chgexit/-g options wait until we have at
least one screen of output before checking if the output changed.
Otherwise, we're comparing the initial screen of output to all
spaces, which usually isn't what we want.

12 years agowatch: exit cleanly when falling through main loop.
Kent R. Spillner [Sun, 11 Mar 2012 00:35:08 +0000 (18:35 -0600)]
watch: exit cleanly when falling through main loop.

Revert commit ffe5e0b08eb981b862bab8220f0b9fcf48b7fc4f.  Restores
clean exit when falling through main loop.

Previously, watch only exited when there was an error or when
interrupted by the user.  Commit 81f64657ba183ee983ea98c7f97904296b2ce5aa
added another exit condition when the watched command's output
changes, causing execution to fall out of the main loop.

With this change, watch correctly restores the terminal and returns
an exit code indicating success when invoked with the --chgexit/-g
options.

12 years agomentioned kB kiB change in news
Craig Small [Thu, 8 Mar 2012 19:57:10 +0000 (06:57 +1100)]
mentioned kB kiB change in news

12 years agotop: refer to memory using strict IEC standard names
Jim Warner [Wed, 7 Mar 2012 13:07:07 +0000 (07:07 -0600)]
top: refer to memory using strict IEC standard names

Admittedly, top referred to memory quantities in
a variety of non-standard ways.  This commit brings
the program and supporting documentation into strict
compliance with IEC standard binary names.

According to wikipedia, as of 2012 this IEC standard
was still not in widespread use.  However, I'm making
this change now for the anal-retentive among us.

Reference:
http://en.wikipedia.org/wiki/Megabyte

Reported by: Roman Mamedov <rm@romanrm.ru>
Bug-Debian:  http://bugs.debian.org/662786

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agosysctl: fix argument parsing regression
Jim Warner [Wed, 7 Mar 2012 11:49:09 +0000 (12:49 +0100)]
sysctl: fix argument parsing regression

Any key=value pair following the first one are dropped after
commit 81df8e26300b35968e3702decc02e9413d5389fc, due to changing
from the while loop to using getopt.

Broken behavior:
  sysctl net.ipv6.conf.tun0.optimistic_dad net.ipv6.conf.tun0.mc_forwarding
  net.ipv6.conf.tun0.optimistic_dad = 0

Good behavior:
  sysctl net.ipv6.conf.tun0.optimistic_dad net.ipv6.conf.tun0.mc_forwarding
  net.ipv6.conf.tun0.optimistic_dad = 0
  net.ipv6.conf.tun0.mc_forwarding = 0

Reference: http://www.freelists.org/post/procps/BUG-Commit-81df8e2-allows-only-one-keyvalue-arg
Reported-By: Sven Ulland <sveniu@opera.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotop: fix selected miscellaneous compiler warnings
Jim Warner [Mon, 5 Mar 2012 17:22:33 +0000 (11:22 -0600)]
top: fix selected miscellaneous compiler warnings

   These per instance warnings have been eliminated:
warning: range expressions in switch statements are non-standard
warning: padding struct to align 'winflags'
warning: dereferencing type-punned pointer will break strict-aliasing rules

   These per instance warnings have not been addressed
   since they simply trade one warning for another:
      From:
warning: ISO C does not permit named variadic macros
warning: ISO C does not support the '%Lu' gnu_scanf format
      To:
warning: anonymous variadic macros were introduced in C99
warning: ISO C90 does not support the 'll' gnu_scanf length modifier

   Lastly, since all C compilers have supported use of
   C++ style comments for the past 20 years, the top
   program will never trade them for the often more
   cumbersome C style comments simply to avoid this
   once per source file warning:
warning: C++ style comments are not allowed in ISO C90

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agopmap: use only address start to range determination
Sami Kerola [Sat, 3 Mar 2012 16:51:51 +0000 (17:51 +0100)]
pmap: use only address start to range determination

Fix to an edge case.  When user defined begining of address range to
be at between two allocations the previous allocation which ended to
that address was included to printout.  After this commit one will
see only allocations that are within range definition.

$ pmap -A00007f4e0df08000,00007f4e0df08000 895
895:   bash
00007f4e0dd08000   2048K -----  /lib/libreadline.so.6.2
00007f4e0df08000      8K r----  /lib/libreadline.so.6.2
 total             2056K

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopmap: add range arguments parsing function
Sami Kerola [Sat, 3 Mar 2012 16:11:45 +0000 (17:11 +0100)]
pmap: add range arguments parsing function

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agow: align header when from lenght is defined
Sami Kerola [Sat, 3 Mar 2012 11:31:49 +0000 (12:31 +0100)]
w: align header when from lenght is defined

Before this commit header and output was not in sync if
PROCPS_FROMLEN environment variable where defined.  Example of wrong
behavior is below where the last four fields which are skewed.

$ PROCPS_FROMLEN=18 w -f | cat
 12:31:34 up  1:25,  1 user,  load average: 0.03, 0.06, 0.06
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
sake     tty1     -                  11:06    1:25m  3.76s  0.00s xinit /ho[...]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agow: make date string abbreviations nls aware
Sami Kerola [Sat, 3 Mar 2012 11:03:40 +0000 (12:03 +0100)]
w: make date string abbreviations nls aware

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agow: use utmp headers to determine host size as well
Sami Kerola [Sat, 3 Mar 2012 10:38:52 +0000 (11:38 +0100)]
w: use utmp headers to determine host size as well

Completes change in commit ddd15211e0895478f9b6008ff9c26c99d45a1753

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agow: use utmp definitions to determine array sizes
Sami Kerola [Sat, 25 Feb 2012 22:50:47 +0000 (23:50 +0100)]
w: use utmp definitions to determine array sizes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Conflicts:

w.c

12 years agolicense: update FSF addresses
Jaromir Capik [Thu, 23 Feb 2012 20:34:19 +0000 (21:34 +0100)]
license: update FSF addresses

The license files are synchronized with the versions from GNU web
site.

http://www.gnu.org/licenses/gpl-2.0.html
http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html

Signed-off-by: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoIncrease library revision number
Craig Small [Sat, 3 Mar 2012 07:47:40 +0000 (18:47 +1100)]
Increase library revision number

There have been some internal changes to the library, so the revision
will be incremented for this release. There is no ABI or API changes
so its no real impact.

12 years agodocs: clarification to license headers in files
Sami Kerola [Fri, 2 Mar 2012 12:29:36 +0000 (13:29 +0100)]
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>
12 years agosysctl: print new line explicitely
Sami Kerola [Fri, 2 Mar 2012 11:41:23 +0000 (12:41 +0100)]
sysctl: print new line explicitely

In some cases sysctl does not print new line after the last line.
This commit fixes that behavior.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoslabtop: return failure if /proc/slabinfo cannot be accessed
Sami Kerola [Sun, 26 Feb 2012 22:20:14 +0000 (23:20 +0100)]
slabtop: return failure if /proc/slabinfo cannot be accessed

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: add testsuite readme file
Sami Kerola [Sun, 26 Feb 2012 12:51:20 +0000 (13:51 +0100)]
docs: add testsuite readme file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotest: add lib/strutils check
Sami Kerola [Sun, 26 Feb 2012 12:31:18 +0000 (13:31 +0100)]
test: add lib/strutils check

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoslabtop: fix clang complier warnings
Sami Kerola [Sun, 26 Feb 2012 11:35:43 +0000 (12:35 +0100)]
slabtop: fix clang complier warnings

slabtop.c:273:29: warning: named variadic macros are a GNU extension [-pedantic,-Wvariadic-macros]

slabtop.c:299:9: warning: unused variable 'end' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agofree: remove redundant boundary check
Sami Kerola [Sun, 26 Feb 2012 11:26:59 +0000 (12:26 +0100)]
free: remove redundant boundary check

The strtol_or_err() already check argument is not larger than
LONG_MAX. This commit also removes clang warning.

free.c:262:55: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
                        if (args.repeat_counter < 1 || args.repeat_counter > ULONG_MAX/2)
                                                       ~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: fix typo
Gilles Espinasse [Sat, 25 Feb 2012 09:01:36 +0000 (10:01 +0100)]
build-sys: fix typo

Fix a typo s/unnessary/unnecessary/ in configure --help

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agops: fix compiler warnings
Sami Kerola [Sat, 25 Feb 2012 23:16:44 +0000 (00:16 +0100)]
ps: fix compiler warnings

common.h:23:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
global.c:499:3: warning: ISO C does not support the '%Ld' gnu_printf format [-Wformat]
output.c:134:1: warning: 'sr_cstime' defined but not used [-Wunused-function]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopmap: fix compiler format warnings
Sami Kerola [Sat, 25 Feb 2012 23:00:11 +0000 (00:00 +0100)]
pmap: fix compiler format warnings

pmap.c: In function 'discover_shm_minor':
pmap.c:87:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:87:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c: In function 'mapping_name':
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c: In function 'one_proc':
pmap.c:265:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:265:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c:315:11: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agow: fix compiler warnings
Sami Kerola [Sat, 25 Feb 2012 22:54:51 +0000 (23:54 +0100)]
w: fix compiler warnings

w.c:409:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
w.c:325:42: warning: unused variable 'args' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: remove unused variables
Sami Kerola [Sat, 25 Feb 2012 21:48:15 +0000 (22:48 +0100)]
watch: remove unused variables

watch.c:281:43: warning: unused variable 'option_version' [-Wunused-variable]
watch.c:281:26: warning: unused variable 'option_help' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Conflicts:

watch.c

12 years agopwdx: fix compiler warning
Sami Kerola [Sat, 25 Feb 2012 21:24:58 +0000 (22:24 +0100)]
pwdx: fix compiler warning

pwdx.c:96:3: warning: ISO C90 forbids variable length array 'buf' [-Wvla]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoc.h: fix macro definition warning
Sami Kerola [Sat, 25 Feb 2012 21:55:58 +0000 (22:55 +0100)]
c.h: fix macro definition warning

../include/c.h:106:18: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:107:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:108:25: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:109:26: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: require compiler running in C99 mode
Sami Kerola [Sat, 25 Feb 2012 21:52:02 +0000 (22:52 +0100)]
build-sys: require compiler running in C99 mode

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: remove unused variables
Sami Kerola [Sat, 25 Feb 2012 21:48:15 +0000 (22:48 +0100)]
watch: remove unused variables

watch.c:281:43: warning: unused variable 'option_version' [-Wunused-variable]
watch.c:281:26: warning: unused variable 'option_help' [-Wunused-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Conflicts:

watch.c

12 years agopgrep: fix compiler warnings
Sami Kerola [Sat, 25 Feb 2012 21:09:50 +0000 (22:09 +0100)]
pgrep: fix compiler warnings

pgrep.c:539:10: warning: unused variable 'buff' [-Wunused-variable]
pgrep.c:648:1: warning: "/*" within comment [-Wcomment]
pgrep.c:803:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Conflicts:

pgrep.c

12 years agovmstat: fix compiler warnings
Sami Kerola [Sat, 25 Feb 2012 20:40:55 +0000 (21:40 +0100)]
vmstat: fix compiler warnings

vmstat.c:408:10: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]
vmstat.c:644:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:645:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:646:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:647:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:648:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:649:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:650:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:651:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: add how to contribute to README
Sami Kerola [Fri, 24 Feb 2012 21:26:11 +0000 (22:26 +0100)]
docs: add how to contribute to README

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: ask gitorious merge request announces
Sami Kerola [Fri, 24 Feb 2012 21:20:17 +0000 (22:20 +0100)]
docs: ask gitorious merge request announces

Gitorious merge requests are too easy to miss for long time, and it
is difficult to think contributors would discuss by using web
interface.  Therefore ask contributors to announce request to pull
(merge) in mail list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: change README to describe procps-ng project
Sami Kerola [Fri, 24 Feb 2012 21:08:12 +0000 (22:08 +0100)]
docs: change README to describe procps-ng project

Reference: http://www.freelists.org/post/procps/PATCH-Clean-README
CC: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: typo in ps.1 manual [rpmlint]
Jaromir Capik [Thu, 23 Feb 2012 19:59:45 +0000 (20:59 +0100)]
docs: typo in ps.1 manual [rpmlint]

Signed-off-by: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoUpdated NEWS for next version
Craig Small [Sat, 3 Mar 2012 04:10:48 +0000 (15:10 +1100)]
Updated NEWS for next version

12 years agoMerge commit 'refs/merge-requests/1' of git://gitorious.org/procps/procps
Craig Small [Sat, 3 Mar 2012 03:39:43 +0000 (14:39 +1100)]
Merge commit 'refs/merge-requests/1' of git://gitorious.org/procps/procps

12 years agotop: extend rcfile conversions for '--enable-oomem'
Jim Warner [Fri, 2 Mar 2012 18:34:56 +0000 (12:34 -0600)]
top: extend rcfile conversions for '--enable-oomem'

Under openSUSE, old top uses additional fields for
out-of-memory reporting.  As a result, under the
original approach to rcfile conversion, new top would
issue a fatal corrupt window entry message asking that
the rcfile be deleted.

This patch extends the conversion range to include
the extra openSUSE field characters.  It's effective
when ./configure specifies the --enable-oomem option
which in turn defines OOMEM_ENABLE.

This commit also makes the conversion logic slightly
more forgiving.  While enforcing an upper limit on the
expected number of old style field characters, amounts
less than that will be handled seemlessly.

Reference:
commit 4b987331323fe7b0d8a8566c33b786682acf12c9

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoMerge remote-tracking branch 'sami/to-craig' into sami-merge
Craig Small [Sat, 3 Mar 2012 02:56:32 +0000 (13:56 +1100)]
Merge remote-tracking branch 'sami/to-craig' into sami-merge

Conflicts:
pgrep.c
w.c

12 years agoMerge remote-tracking branch 'sami/2012wk7' into sami-merge
Craig Small [Sat, 3 Mar 2012 02:46:49 +0000 (13:46 +1100)]
Merge remote-tracking branch 'sami/2012wk7' into sami-merge

12 years agoFix string literals in fprintf and friends
Craig Small [Sat, 3 Mar 2012 01:05:07 +0000 (12:05 +1100)]
Fix string literals in fprintf and friends

Both these are from [-Werror=format-security]
sig.c:262:5: error: format not a string literal and no format arguments
global.c:517:3: error: format not a string literal and no format arguments

12 years agops abort causes problems in testsuite
Craig Small [Sat, 3 Mar 2012 00:49:48 +0000 (11:49 +1100)]
ps abort causes problems in testsuite

Under certain circumstances, using abort() when either make check
or make distcheck puts ps into an infinite loop around the
function catastrophic_failure() in ps and the C library raise
and abort functions.

Using exit removes this problem and does almost the same thing.

12 years agofixed uptime check regexp
Craig Small [Fri, 2 Mar 2012 12:05:28 +0000 (23:05 +1100)]
fixed uptime check regexp

12 years agotop: honor the restrictive, crufty old top rcfile
Jim Warner [Thu, 1 Mar 2012 05:59:59 +0000 (23:59 -0600)]
top: honor the restrictive, crufty old top rcfile

At one time, new top silently defaulted when an rcfile
was found to be incompatible.  This is exactly what
the old top did.  However, after some discussion it
was decided top should alert the user and thereby
save the system administrator some headaches.

Now, some are upset over the fatal error, proving you
can't please everybody.  But in all fairness, given
the difficulty of customizing old top, any reluctance
to delete an old saved rcfile is understandable.

To ease transition to this new top, old style rcfiles
will now be honored and converted to the new format.
And if not disabled at ./configure time via CFLAGS,
a user will be warned when an old style rcfile is
about to be overwritten using the 'W' command.

Lastly, the config validation logic was enhanced to
help ensure both types of rcfile haven't been edited
manually and possibly made unuseable.

Reported-By: sergio <mailbox@sergio.spb.ru>
Bug-Debian:  http://bugs.debian.org/651213

Reported-By: martin f krafft <madduck@debian.org>
Bug-Debian:  http://bugs.debian.org/651863

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: fix a regression associated with USE_X_COLHDR
Jim Warner [Wed, 29 Feb 2012 06:00:00 +0000 (00:00 -0600)]
top: fix a regression associated with USE_X_COLHDR

When sort column header emphasis was extended to a
monochrome screen, the ability to emphasize selections
on the Fields Management screen was lost when colors
were not being displayed.

This patch corrects that bug by using the capclr_hdr
terminfo string instead of capclr_msg.

Reference:
commit 0c6aa6af4190be60853acced8023470c3d1910c1

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agobuild-sys: rename the 'tools' subdirectory to 'misc'
Jim Warner [Sat, 11 Feb 2012 17:11:11 +0000 (11:11 -0600)]
build-sys: rename the 'tools' subdirectory to 'misc'

The newer tools/ subdirectory shares a common prefix
with the previously existing top/ subdirectory and
thereby hinders shell command completion.

There was already a minor conflict between testsuite/
and top/.  This patch renames the tools/ subdirecory
to avoid an even greater conflict.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: relocate a prototype to prevent compiler warning
Jim Warner [Sat, 11 Feb 2012 08:02:02 +0000 (02:02 -0600)]
top: relocate a prototype to prevent compiler warning

Until the 'locate/search' provisions were added,
top avoided the need for any function prototypes
through careful source file organization.  But
the addition of the find_string function required
a prototpe for task_show, lest a massive file
reorganization be undertaken.

This commit moves the actual protype out of top.h
and places it adjacent to the caller in order to
avoid a warning when top_nls.c is compiled.

References:
commit 270e8e7eeb66b47569940f537cdad4ab46cd36be
commit d6e6a9aa38092e55f976a398899635105dd89893

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: isolate #defines actually present in confiure.ac
Jim Warner [Sat, 11 Feb 2012 07:01:01 +0000 (01:01 -0600)]
top: isolate #defines actually present in confiure.ac

All top.h defines were lumped together as:
   'Development/Debugging defines'

This commit establishes this new category:
   'Defines represented in configure.ac'

And that new category now contains OOMEM_ENABLE,
which enables the SuSE out-of-memory additions

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: remove residual logic for obsolete functionality
Jim Warner [Sat, 11 Feb 2012 00:18:18 +0000 (18:18 -0600)]
top: remove residual logic for obsolete functionality

At one time the 'open_psdb_message' library call was
supported with the concept of a postponed message
which would display after top startup completed.
In turn, that required logic to strip the '\n' which
was embedded (inappropriately) in any such message.

Nowdays top treats such a returned error as fatal so
there is no need for the 'strim' function which is
being removed with this commit.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: update latest CPU % distortions understanding
Jim Warner [Fri, 10 Feb 2012 21:15:15 +0000 (15:15 -0600)]
top: update latest CPU % distortions understanding

We originally approached the potential problem of
% CPU distortions as unique to Nehalem type cpus.
The latest information suggests that it may have
been due to a kernel anomaly that has since been
corrected.

Yet even without such a cpu, wide disparities in
tics allocation among all available cpus have
sometimes been observed -- spikes as it were in
the normal pattern.  This has happened under both
version 2.26.38-13 and 3.0.0-15 kernels.

The small amount of additional code addressing the
original problem carries very little overhead.  It
is being retained to afford protection against any
future tic accounting aberrations.

In this commit, supporting programmer comments have
been divorced from any particular cpu type.  Also,
another variable and manifest constant will now be
eliminated when CPU_ZEROTICS is defined.

References:
commit 02508b3d76af5bc33c7e559b84d3e5e123cdf2ac
http://www.freelists.org/post/procps/CStates-handling-new-switch,50

12 years agotop: fix regression created when fields mgmt reorg'd
Jim Warner [Fri, 10 Feb 2012 16:10:10 +0000 (10:10 -0600)]
top: fix regression created when fields mgmt reorg'd

When the calibrate_fields function was broken up for
mainainability, an obscure regression was introduced.

For the resulting bug to affect the display, all of
the following conditions would have to be met:
 . USE_X_COLHDR was not defined
 . column highlighting had been turned on
 . many, perhaps all, fields were displayable
 . the user then typed the <End> key
 . and the current sort column just happened to
   be immediately to the left of the left-most
   visible field

This patch corrects for that remote possibility.

Reference:
commit d0e16acf156b066d56415b1b7ccbfad4ae1526d8

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoFix a remaining util-linux word in autogen
Gilles Espinasse [Sat, 25 Feb 2012 09:01:02 +0000 (10:01 +0100)]
Fix a remaining util-linux word in autogen

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agosysctl: deprecate parameters
Sami Kerola [Mon, 13 Feb 2012 20:21:43 +0000 (21:21 +0100)]
sysctl: deprecate parameters

According to arp(7) manual page base_reachable_time and retrans_time
are obsolete since kernel 2.6.12. Based on that the print all listing
will not show these two parameters, and attempt to set them will fail.

Reported-by: Alexandre Cavalcante Alencar <alexandre.alencar@gmail.com>
Bug-Debian: http://bugs.debian.org/599556
Reference: http://www.mail-archive.com/bk-commits-head@vger.kernel.org/msg03396.html
Reference: http://www.opensubscriber.com/message/linux-kernel@vger.kernel.org/7344177.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: inform about pkill and --inverse option
Sami Kerola [Mon, 13 Feb 2012 20:18:54 +0000 (21:18 +0100)]
docs: inform about pkill and --inverse option

The short option for --inverse is disabled for pkill, but long option
works just in case someone will find that piece of functionality usable.

Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558044#67
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoMerge remote-tracking branch 'sami/2012wk6'
Craig Small [Sun, 12 Feb 2012 10:56:05 +0000 (21:56 +1100)]
Merge remote-tracking branch 'sami/2012wk6'

12 years agotop: extend the Copyright (c) dates to include 2012
Jim Warner [Thu, 9 Feb 2012 06:00:00 +0000 (00:00 -0600)]
top: extend the Copyright (c) dates to include 2012

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: reorganize some fields management logic
Jim Warner [Thu, 9 Feb 2012 04:22:22 +0000 (22:22 -0600)]
top: reorganize some fields management logic

The calibrate_fields function had grown too large and
was adversly impacting maintainence.  So half of the
logic was split out into a new function.

Now, maintainence of column headers and the required
library flags is organized as follows:

 . adj_geometry   (calibrate_fields helper)
     provides low-level support for sigwinch, memory

 . build_headers  (calibrate_fields helper)
     constructs the headers and library flags

 . calibrate_fields
     establishes which fields will be displayed

( note the alpha order mentioned in a prior commit )

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: standardize names of all 'helper' functions
Jim Warner [Tue, 7 Feb 2012 17:11:11 +0000 (11:11 -0600)]
top: standardize names of all 'helper' functions

The top program is carefully organized into sections
and those sections are carefully placed so as to avoid
the need for prototypes. *

Additionally, names of functions are carefully chosen
to maintain alphabetical order within each section.

The names of most 'helper' functions, which are always
placed immediately above the calling functions, often
only met the spirit of the alphabetical law, not the
actual letter of that law.

This commit alters the names of such helper functions
so as to mainatin strict ascii alphabetical order
within each section.

* the single exception to prototypes is find_string,
  which calls the task_show function, and would have
  prompted a massive reorganization.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: use CPU_ZEROTICS to embrace the Nehalem logic
Jim Warner [Tue, 7 Feb 2012 05:59:59 +0000 (23:59 -0600)]
top: use CPU_ZEROTICS to embrace the Nehalem logic

The recently added logic dealing with "missing" tics
is mutually exclusive with logic associated with a
define called CPU_ZEROTICS.

This commit expands the use of that define to exclude
such Nehalem logic as appropriate.

It also extends programmer notes in top.h to include
an attribution for initiating the topic of potential
Nehalem type % CPU distortions, acknowledging:
  Jaromir Capik, <jcapik@redhat.com>

References
commit ce1410a51a624a91816fcc8c232c8a4d60b09638
commit 9e7dd43ab7b2e68177cefd49b3c07311ea79bc1a
commit a9041a5526eddc631b94bac86c09a47e60a3b4e1