]> granicus.if.org Git - procps-ng/log
procps-ng
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>
12 years agopgrep: fix compiler warning
Sami Kerola [Sat, 21 Jan 2012 01:14:21 +0000 (02:14 +0100)]
pgrep: fix compiler warning

pgrep.c:786:4: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopkill: fix error printing
Sami Kerola [Sat, 21 Jan 2012 01:09:48 +0000 (02:09 +0100)]
pkill: fix error printing

Print correct pid number of process that was where not killed
because of kill was not successful. Incorrect behaviour before
this fix is bello.

-- snip
$ ps -elf | grep dh[c]
1 S root      1409     1  0  80   0 -  1782 poll_s 02:01 ?        00:00:00 dhclient wlan0
$ pkill dhc
pkill: killing pid 1 failed: Operation not permitted
-- snip

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agops: unify cases and remove trailing dots in messages
Sami Kerola [Fri, 13 Jan 2012 21:38:47 +0000 (22:38 +0100)]
ps: unify cases and remove trailing dots in messages

Strings with lower caps & no trailing dots have greater change to
have multiple occurences, meaning less effort for translators, than
strings with them.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoother: make AUTHORS file obsolete
Sami Kerola [Tue, 10 Jan 2012 21:03:12 +0000 (22:03 +0100)]
other: make AUTHORS file obsolete

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: remove old information from HACKING
Sami Kerola [Tue, 10 Jan 2012 20:51:06 +0000 (21:51 +0100)]
docs: remove old information from HACKING

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agops: add catastrophic_failure()
Sami Kerola [Tue, 10 Jan 2012 20:47:11 +0000 (21:47 +0100)]
ps: add catastrophic_failure()

The catastrophic_failure function tries to make bug reporting useful
by telling in which line error occured, and drops core.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoother: tell in ChangeLog where to see changes
Sami Kerola [Mon, 9 Jan 2012 18:50:20 +0000 (19:50 +0100)]
other: tell in ChangeLog where to see changes

We do not want to maintain ChangeLog, people should look git log
instead.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotop: avoid %cpu distortions when toggling task/thread modes
Jim Warner [Mon, 9 Jan 2012 17:26:45 +0000 (11:26 -0600)]
top: avoid %cpu distortions when toggling task/thread modes

This commit addresses a long standing buglet (debian #441166) which
surfaces when the display mode is switched between task and threads.

An extra procps refresh is now forced upon such a transition which
parallels the approach used at startup for the exact same reason.

Reference: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=441166

12 years agotop: force newline for unexpected signal abnormal exit
Jim Warner [Sun, 8 Jan 2012 15:54:05 +0000 (09:54 -0600)]
top: force newline for unexpected signal abnormal exit

This commit just restores the pre-nls behavior, which was lost
in the migration to nls string tables support.

12 years agovmstat: slabinfo (-m option) test disabled if not readable
Jim Warner [Fri, 6 Jan 2012 14:49:21 +0000 (08:49 -0600)]
vmstat: slabinfo (-m option) test disabled if not readable

The dejagnu tests for slabtop are skipped when "/proc/slabinfo" is
unreadable due to permissions.  This commit provides the same check
for vmstat under its -m (slabinfo) option.

12 years agosysctl -p has no space
Craig Small [Fri, 13 Jan 2012 12:59:26 +0000 (23:59 +1100)]
sysctl -p has no space

The man page has examples like sysctl -p filename. Optional arguments
using getopt cannot have a space between the option and argument.
So the correct format is sysctl -pfilename

12 years agops: display the nice value for processes with the SCHED_BATCH scheduler policy
Mike Fleetwood [Sun, 25 Sep 2011 09:17:06 +0000 (05:17 -0400)]
ps: display the nice value for processes with the SCHED_BATCH scheduler policy

Ps command does not display the nice value for processes with the SCHED_BATCH
scheduler policy, only for SCHED_OTHER.

Boinc (http://boinc.berkeley.edu/) client runs project processing jobs on
Linux using SCHED_BATCH scheduler policy and nice value 19.  The nice value
is not displayable by ps.

Steps to Reproduce:
1. Run process using SCHED_BATCH scheduler policy with nice value.
    ./test-schedbatch 18 &
2. Display process details:
    ps -o pid,ppid,user,comm,cls,nice

Results before:
[mike@rockover c]$ ps -o pid,ppid,user,comm,cls,nice
  PID  PPID USER     COMMAND         CLS  NI
18205  2540 mike     bash             TS   0
20552 18205 mike     test-schedbatch   B   -
20553 18205 mike     ps               TS   0
[mike@rockover c]$ awk '{printf "%5d %-17s %1d %2d\n", $1, $2, $41, $19}'
/proc/20552/stat
20552 (test-schedbatch) 3 18

Results after this patch:
[mike@rockover c]$ ps -o pid,ppid,user,comm,cls,nice
  PID  PPID USER     COMMAND         CLS  NI
18205  2540 mike     bash             TS   0
20552 18205 mike     test-schedbatch   B  18
20553 18205 mike     ps               TS   0

Additional info: Here is the fragment from the sched_setscheduler(2) manual
page on the subject:

   SCHED_BATCH: Scheduling batch processes
       (Since  Linux 2.6.16.)  SCHED_BATCH can only be used at static
       priority 0.  This policy is similar to SCHED_OTHER in that it
       schedules the process according to its dynamic priority (based on the
       nice value).  The difference is that this policy will cause the
       scheduler to always assume that the process is CPU-intensive.
       Consequently, the scheduler will apply a small scheduling penalty with
       respect to wakeup behaviour, so that this process is mildly disfavored
       in scheduling decisions.

       This policy is useful for workloads that are noninteractive, but do
       not want to lower their nice value, and for workloads that want a
       determin- istic scheduling policy without interactivity causing extra
       preemptions (between the workload's tasks).

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=741090
Acked-by: Jaromir Capik <jcapik@redhat.com>
Acked-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
12 years agotests: add SCHED_BATCH test
Mike Fleetwood [Sun, 25 Sep 2011 09:15:43 +0000 (05:15 -0400)]
tests: add SCHED_BATCH test

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=741090
Acked-by:: Jaromir Capik <jcapik@redhat.com>
Acked-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
12 years agoLinux version for non-linux systems
Craig Small [Mon, 9 Jan 2012 10:57:44 +0000 (21:57 +1100)]
Linux version for non-linux systems

On non-linux systems, uts.version provides the version of that
specific kernel (FreeBSD or Hurd version, for example) and not the
emulated procfs pseudo version.

On those systems we need to directly read /proc/version and parse the
string.  This change replaces Debian patches gnu-kbsd-version and
complain_unmounted_proc patches.

12 years agoChange restrict to __restrict in public includes
Craig Small [Mon, 9 Jan 2012 10:44:51 +0000 (21:44 +1100)]
Change restrict to __restrict in public includes

procps automake defines restrict which means the binaries for procps
binaries compile. However external programs may not of defined
restrict which means they will not complie if they include files found
in /usr/include/proc.

Includes from libc6 use __restrict and if is good enough for
them, its good enough for us.

12 years agowatch needs a conditonal LDADD
Craig Small [Mon, 9 Jan 2012 10:40:53 +0000 (21:40 +1100)]
watch needs a conditonal LDADD

Makes Debian patch makefile_watch_ncurses redundant.
watch was being linked to NCURSES_LIBS when it should of been
WATCH_NCURSES_LIBS which can be ncursesw with 8bit enabled.

12 years agobuild-sys: use dist-xz
Sami Kerola [Sun, 8 Jan 2012 21:09:50 +0000 (22:09 +0100)]
build-sys: use dist-xz

Even as conservative project as coreutils has switched to xz distributions so
neither should we have any reason to use gz and waste space & bandwidth.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoother: indent FAQ file
Sami Kerola [Sat, 7 Jan 2012 23:05:05 +0000 (00:05 +0100)]
other: indent FAQ file

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoother: update CodingStyle
Sami Kerola [Sat, 7 Jan 2012 22:57:07 +0000 (23:57 +0100)]
other: update CodingStyle

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoother: update BUGS file
Sami Kerola [Sat, 7 Jan 2012 17:14:35 +0000 (18:14 +0100)]
other: update BUGS file

Change information submission address to be procps@freelists.org and
instruct people to send patches in 'git am' friendly format.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoother: update TODO
Sami Kerola [Sat, 7 Jan 2012 17:02:41 +0000 (18:02 +0100)]
other: update TODO

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoother: move files to Documentation/ directory
Sami Kerola [Sat, 7 Jan 2012 16:57:07 +0000 (17:57 +0100)]
other: move files to Documentation/ directory

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