]> granicus.if.org Git - procps-ng/log
procps-ng
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

12 years agotop: postpone the switch from Kb to Mb in summary display
James Cloos [Mon, 6 Feb 2012 05:00:00 +0000 (00:00 -0500)]
top: postpone the switch from Kb to Mb in summary display

The mem and swap lines have enough room to show eight significant
digits, so switch to showing MB when >=100MB, not >=10MB.

The extra detail is valuable; it should not be elided.

Signed-off-by: James Cloos <cloos@jhcloos.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agolibprocps: remove linux 2.7.0 check
Sami Kerola [Sat, 11 Feb 2012 20:22:06 +0000 (21:22 +0100)]
libprocps: remove linux 2.7.0 check

Checking for linux kernel version 2.7.0 is meaningless now when 3.0.0
is out.

Reported-By: Christian Hofstaedtler
Bug-Debian: http://bugs.debian.org/635553
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: inform about optional argument for -d switch
Sami Kerola [Sat, 11 Feb 2012 20:00:05 +0000 (21:00 +0100)]
watch: inform about optional argument for -d switch

The -d, --differences switch(s) can use optional argument that was
not documented earlier.

Reported-By: Marian Sigler <m@qjym.de>
Bug-Debian: http://bugs.debian.org/597021
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopkill: remove -v match inversion option
Sami Kerola [Sat, 11 Feb 2012 19:33:17 +0000 (20:33 +0100)]
pkill: remove -v match inversion option

The option -v does not make much sense in pkill context.

Reported-By: "Jason A. Spiro" <jasonspiro4@gmail.com>
Bug-Debian: http://bugs.debian.org/558044
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopgrep: allow signal definition to be anywhere in command line
Sami Kerola [Sat, 11 Feb 2012 19:02:54 +0000 (20:02 +0100)]
pgrep: allow signal definition to be anywhere in command line

I as user often try to pkill something, notice that program did not
die and pkill again with signal -9.  Before this commit previous one
could not add signal at the end of command line, as the signal
definition had to be first argument, which was annoying.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopgrep: use c style comments
Sami Kerola [Sat, 11 Feb 2012 19:02:16 +0000 (20:02 +0100)]
pgrep: use c style comments

The c++ comments e.g.  // should not be used in c code.  Additionally
white spaces are converted to tabs as a small clean up.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agostrutils: reindent the file
Sami Kerola [Thu, 9 Feb 2012 21:57:13 +0000 (22:57 +0100)]
strutils: reindent the file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoskill: fix argument parsing regression
Sami Kerola [Thu, 9 Feb 2012 21:53:29 +0000 (22:53 +0100)]
skill: fix argument parsing regression

Command skill accepted earlier command name as argument.  This did
not work since commit 991b8a94f0354a128085c7411713e17282c4e04a.

Reported-By: "Anne C. Hanna" <orion@ugcs.caltech.edu>
Bug-Debian: http://bugs.debian.org/659038
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotests: fix dejagnu pwdx and vmstat checks
Sami Kerola [Thu, 9 Feb 2012 20:18:14 +0000 (21:18 +0100)]
tests: fix dejagnu pwdx and vmstat checks

The pwdx check expected error message, which where in use for only
short period of time.  The old message was put in place in commit
9d47cb0c38137581a46951fb7c6fa2a1dc8c24cf

The vmstat issue was triggered by 'sr0' cdrom device, which gives
following unexpected output.  Fix simply ignores partitions which has
zero activity.  Besides such partitions probably would not apply as
good candidate of -p option anyway.

$ vmstat -p sr0
Partition was not found

Reported-By: Moritz Muehlenhoff <jmm@debian.org>
Bug-Debian: http://bugs.debian.org/656508
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotop: fixup logic for Nehalem cpu 'idle' threshold
Jim Warner [Thu, 9 Feb 2012 05:59:59 +0000 (23:59 -0600)]
top: fixup logic for Nehalem cpu 'idle' threshold

Due to a poorly constructed temporary fprintf
used during development, an earlier commit went
a little too far in its computations.  The net
result was the code looked nice but actually
accomplished nothing.

It is the /proc/stat line 1 (summary line)
whose tics must be used in establishing the
threshold boundary.  And that calculation
need be performed just once per frame.

This commit ensures one threshold calculation
per delay interval no matter how many cpus
are ultimately displayed.

It also corrects scalability by factoring in
the total number of online processors.

Reference:
commit 9e7dd43ab7b2e68177cefd49b3c07311ea79bc1a

12 years agotop: reduce use of 'clear_screen' to absolute minimum
Jim Warner [Tue, 7 Feb 2012 21:15:15 +0000 (15:15 -0600)]
top: reduce use of 'clear_screen' to absolute minimum

Along the way to width override support (-w switch),
this top began clearing the screen far more often
than his predecessor.  In fact, it happend with each
user keystroke.

This commit dramatically reduces those occurances.
The screen will now be cleared only when an actual
SIGWINCH is received.

Thanks for identifying this flaw belongs to:
James Cloos, cloos@jhcloos.com

References:
http://www.freelists.org/post/procps/Merge-request

Blame:   c2dcbef4826806f85b7ad6de2d9fe99bc390d603
Author:  Jim Warner <james.warner@comcast.net>
Date:    Thu May 26 11:33:32 2011 +0200
subject: added output width/height override support to top, + misc

12 years agotop: tweak the new 'reduce % CPU distortions' algorithm
Jim Warner [Tue, 7 Feb 2012 16:10:10 +0000 (10:10 -0600)]
top: tweak the new 'reduce % CPU distortions' algorithm

The original approach to potential % CPU distortion due
to Nehalem type cores being turned off completely when
idle worked ok until the user typed something.

At that point, elapsed tics would no longer equal the
calculated value producing an undesirable 100% idle
condition until the next update or <Enter/Space> key.

This commit employs actual elapsed tics in determining
whether a cpu should be considered idle and thus makes
top's individual cpu display immune to user keystrokes.

12 years agotop: reduce % CPU distortions when a core was turned off
Jim Warner [Fri, 3 Feb 2012 06:00:00 +0000 (00:00 -0600)]
top: reduce % CPU distortions when a core was turned off

This patch provides for cpu cores which can be turned
off completely when idle (Nehalem, etc.) thus registering
very few or no tics since the last update cycle.

When CPU_ZEROTICS is not defined (the default), any
displayed cpu with less than a certain amount of total
tics will show as 100% idle.  That amount is tempered
by the delay interval and total number of cpus.

This commit also satisfies the Debian 'top_nohz' patch
(11/24/09) in a slightly more efficient manner.  That
patch concerned kernels built with CONFIG_NO_HZ.

Reference:
http://www.freelists.org/post/procps/CStates-handling-new-switch,4

12 years agotop: tolerate loss of smp cpus, improve CPU_t management
Jim Warner [Wed, 1 Feb 2012 06:00:00 +0000 (00:00 -0600)]
top: tolerate loss of smp cpus, improve CPU_t management

Prior to this patch, top was able to handle any hotplugged
cpus *added* to the system in two distinct ways.

 1) Newly added cpus would be detected by sysinfo_refresh
    calling the library's cpuinfo function, which occurs
    at most every 5 minutes.

 2) The user could force a refresh using either the
    <Enter> or <Space> keys.

Unfortunately, the *loss* of a cpu would produce an early
exit due to a /proc/stat read failure.  Such a failure
can be produced in the following way:
  sudo echo 0 > /sys/devices/system/cpu/cpu??/online

This commit allows top to tolerate the loss of cpus.
It also provides for more efficient CPU_t management,
especially for massively parallel cpu environments.

Note: Changes to the cpu compliment can produce a single
cycle distortion of cpu percentages.  Such distortion is
most visible when each cpu is being displayed.  It can
be eliminated with a forced refresh via <Enter>/<Space>.

12 years agotop: treat additional keys like the find_string() keys
Jim Warner [Mon, 23 Jan 2012 20:44:13 +0000 (14:44 -0600)]
top: treat additional keys like the find_string() keys

With the introduction of the 'locate string' provisions,
the precedent for calling tertiary helper functions from
secondary do_key helper functions was established.

This commit simply migrates some additional keys out of
the do_key function itself and into the more generalized
key table.

12 years agotop: improve USE_X_COLHDR effect when colors toggled off
Jim Warner [Thu, 19 Jan 2012 20:33:34 +0000 (14:33 -0600)]
top: improve USE_X_COLHDR effect when colors toggled off

Normally, when the chosen sort column is displayed via the
'x' command toggle the entire column is highlighted.  And
while this version of top substantially reduced the cost
of such highlighting, a small pathlength increase remained.

The USE_X_COLHDR define was an experimental alternative which
eliminated all recurring runtime costs for such emphasis by
highlighting the column header, not the entire column.

The previous implementation required colors to be turned on
(the 'z' toggle) for such highlighting to be visible.  This
commit extends column header emphasis to include monochrome
displays as well.

Reference:
http://www.freelists.org/post/procps/post-nls-merge,6

12 years agotop: properly handle an improper $HOME environment variable
Jim Warner [Fri, 13 Jan 2012 22:07:40 +0000 (16:07 -0600)]
top: properly handle an improper $HOME environment variable

Since its inception, this top has improperly handled an
empty HOME environment variable.  Under those conditions
a path to the root directory would have been constructed.

That caused no real harm upon startup since the display
defaults would have been employed.  However, except for
root, it would have been impossible to save the rc file.

This commit keeps the promise made in the documentation.

12 years agolibprocps: open file should be closed, not freed
Sami Kerola [Sun, 5 Feb 2012 22:14:32 +0000 (23:14 +0100)]
libprocps: open file should be closed, not freed

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agovmstat: open file should be closed, not freed
Sami Kerola [Sun, 5 Feb 2012 21:58:24 +0000 (22:58 +0100)]
vmstat: open file should be closed, not freed

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopmap: ensure arg1 is not null, and set qualifers to match with usage [smatch scan]
Sami Kerola [Sun, 5 Feb 2012 20:43:36 +0000 (21:43 +0100)]
pmap: ensure arg1 is not null, and set qualifers to match with usage [smatch scan]

pmap.c:436 main(59) error: we previously assumed 'arg1' could be null (see line 427)
pmap.c:136:3: warning: return discards 'const' qualifier from pointer target type [enabled by default]
pmap.c:142:4: warning: return discards 'const' qualifier from pointer target type [enabled by default]
pmap.c:150:2: warning: return discards 'const' qualifier from pointer target type [enabled by default]
pmap.c:300:8: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopgrep: fix potential null derefences [smatch scan]
Sami Kerola [Sun, 5 Feb 2012 20:10:53 +0000 (21:10 +0100)]
pgrep: fix potential null derefences [smatch scan]

pgrep.c:137 split_list(19) error: potential null derefence 'list'.
pgrep.c:540 select_procs(106) error: potential null derefence 'list'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosysctl: fix potential null derefence [smatch scan]
Sami Kerola [Sun, 5 Feb 2012 20:02:34 +0000 (21:02 +0100)]
sysctl: fix potential null derefence [smatch scan]

sysctl.c:560 PreloadSystem(29) error: potential null derefence 'cfgs'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoskill: ensure optarg is not null [smatch scan]
Sami Kerola [Sun, 5 Feb 2012 19:54:58 +0000 (20:54 +0100)]
skill: ensure optarg is not null [smatch scan]

skill.c:549 skillsnice_parse(87) error: we previously assumed 'optarg' could be null (see line 539)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: remove unreachable code
Sami Kerola [Sun, 5 Feb 2012 19:48:33 +0000 (20:48 +0100)]
watch: remove unreachable code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopwdx: free memory before exit
Sami Kerola [Sun, 5 Feb 2012 19:44:39 +0000 (20:44 +0100)]
pwdx: free memory before exit

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agouse pkg-config for ncurses by default
Mike Frysinger [Tue, 24 Jan 2012 18:01:15 +0000 (13:01 -0500)]
use pkg-config for ncurses by default

Newer ncurses install pkg-config files, so search those first.  If they
aren't found, fall back to existing detection logic.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agofix AC_ARG_WITH(ncurses) handling
Mike Frysinger [Tue, 24 Jan 2012 18:01:14 +0000 (13:01 -0500)]
fix AC_ARG_WITH(ncurses) handling

The third arg is for "the user has specified some flag", not "the user
has disabled things", so use $withval.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agofix basic ncurses check
Samuli Suominen [Tue, 24 Jan 2012 18:01:13 +0000 (13:01 -0500)]
fix basic ncurses check

The first check for ncurses is for the non-wide variant, so drop the "w".
The wide version gets checked later on based on watch8bit.

Signed-off-by: Samuli Suominen <ssuominen@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agofix printf format warnings
Mike Frysinger [Tue, 24 Jan 2012 17:56:29 +0000 (12:56 -0500)]
fix printf format warnings

pgrep.c: In function 'main':
pgrep.c:793:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat]

vmstat.c: In function 'diskpartition_format':
vmstat.c:382:9: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]
vmstat.c:408:10: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]

w.c: In function 'main':
w.c:394:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agopmap: fix const warning
Mike Frysinger [Tue, 24 Jan 2012 17:56:33 +0000 (12:56 -0500)]
pmap: fix const warning

pmap.c:300:8: warning: assignment discards 'const' qualifier
from pointer target type [enabled by default]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agowatch: exit when command output changes.
Kent R. Spillner [Thu, 26 Jan 2012 14:42:37 +0000 (08:42 -0600)]
watch: exit when command output changes.

Add new flags to watch (-g/--chgexit) so that it exits when the
output changes.  This is useful in builds and shell scripts, for
example when deploying webapps to block the remainder of the
deployment steps until after the webapp starts.

e.g. watch --chgexit curl http://foo/bar

12 years agosysctl: fix coding style
Sami Kerola [Wed, 25 Jan 2012 08:18:38 +0000 (09:18 +0100)]
sysctl: fix coding style

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: add to pgrep.1 count return value information
Sami Kerola [Wed, 25 Jan 2012 08:17:49 +0000 (09:17 +0100)]
docs: add to pgrep.1 count return value information

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: remove tcp_default_win_scale from sysctl.conf sample
Sami Kerola [Tue, 24 Jan 2012 21:34:12 +0000 (22:34 +0100)]
docs: remove tcp_default_win_scale from sysctl.conf sample

The variable net.ipv4.tcp_default_win_scale has not been part of
kernel since 2.6.9 (Oct 2004).

Reference: http://oss.sgi.com/archives/netdev/2004-08/msg01589.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolibprocps: hide private symbols
Sami Kerola [Tue, 24 Jan 2012 20:54:01 +0000 (21:54 +0100)]
libprocps: hide private symbols

Clean the global list of symbols contain only functions and variables which
are being called from library.  The removed symbols are internal for the
library, which means they can be changed without changes to programs using
the library.  This clean up should help incoming libprocps clean up work.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoMerge remote-tracking branch 'sami/vapier'
Craig Small [Tue, 24 Jan 2012 11:36:28 +0000 (22:36 +1100)]
Merge remote-tracking branch 'sami/vapier'

12 years agops: include error.h
Mike Frysinger [Tue, 24 Jan 2012 05:44:05 +0000 (00:44 -0500)]
ps: include error.h

This code currently uses error_at_line() from error.h, so pull it in.
Long term, this might get moved to c.h as a local helper on err.h,
but I have no idea.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoproc: pull in ctype.h where needed
Mike Frysinger [Tue, 24 Jan 2012 05:41:39 +0000 (00:41 -0500)]
proc: pull in ctype.h where needed

Fix the build warnings:

sig.c:227:5: warning: implicit declaration of function 'toupper' [-Wimplicit-function-declaration]
sig.c:231:3: warning: implicit declaration of function 'isdigit' [-Wimplicit-function-declaration]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agouse helpers from c.h
Mike Frysinger [Tue, 24 Jan 2012 05:40:28 +0000 (00:40 -0500)]
use helpers from c.h

A few files still use the C library helpers from err.h, so migrate
them to the local c.h helpers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agowatch: include sys/wait.h for waitpid
Mike Frysinger [Tue, 24 Jan 2012 05:36:15 +0000 (00:36 -0500)]
watch: include sys/wait.h for waitpid

Fixes build warning:
watch.c:682:3: warning: implicit declaration of
function 'waitpid' [-Wimplicit-function-declaration]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoinclude error.h for error() and friends
Mike Frysinger [Tue, 24 Jan 2012 05:34:51 +0000 (00:34 -0500)]
include error.h for error() and friends

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoskill: exclude debugging strings from nls
Sami Kerola [Sun, 22 Jan 2012 00:23:10 +0000 (01:23 +0100)]
skill: exclude debugging strings from nls

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotload: remove unnecessary goto
Sami Kerola [Sat, 21 Jan 2012 22:29:02 +0000 (23:29 +0100)]
tload: remove unnecessary goto

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: aligh top.1 header with other procps-ng utils
Sami Kerola [Sat, 21 Jan 2012 15:49:47 +0000 (16:49 +0100)]
docs: aligh top.1 header with other procps-ng utils

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: add exit values to watch.1
Sami Kerola [Sat, 21 Jan 2012 15:41:31 +0000 (16:41 +0100)]
docs: add exit values to watch.1

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotload: check write() return value
Sami Kerola [Sat, 21 Jan 2012 15:24:33 +0000 (16:24 +0100)]
tload: check write() return value

Exit at rare events when writing to tty is unsuccessful.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopkill: enable displaying what is killed
Sami Kerola [Sat, 21 Jan 2012 12:24:02 +0000 (13:24 +0100)]
pkill: enable displaying what is killed

Add new command line options -e, --echo to display what is
killed. Cost of this change is greater run time memory footprint,
because an union had to be changed to struct to allow name and
pid printing which what I as an user would expect to see in
verbose kill output.

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