]> granicus.if.org Git - procps-ng/log
procps-ng
12 years agops: favor truncation of long names over POSIX/UNIX standard
Jim Warner [Mon, 17 Sep 2012 20:30:45 +0000 (15:30 -0500)]
ps: favor truncation of long names over POSIX/UNIX standard

The UNIX and POSIX standards require that user and
group names be printed as decimal integers when there
is insufficient room.  This has led to a constant
stream of bug reports.

With this commit, long names will be truncated and
displayed with a trailing visual clue.

To avoid truncation. the UNIX and POSIX way to change
column width is to rename the column:
   ps -o pid,user=CumbersomeUserNames -o comm

The easy way is to directly specify the desired width:
   ps -o pid,user:19,comm

Reference:
http://www.freelists.org/post/procps/rhbz737215-ps-does-not-resolve-some-user-names

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoTwo new options for pmap, -X and -XX
Dimitrios Apostolou [Thu, 27 Sep 2012 12:08:04 +0000 (22:08 +1000)]
Two new options for pmap, -X and -XX

Both options provide more information about a process using -X and -XX
flags. The data comes from /proc/PID/smaps so it may vary.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agoSELinux spelling (rhbz#859900)
Jaromir Capik [Thu, 27 Sep 2012 11:46:46 +0000 (21:46 +1000)]
SELinux spelling (rhbz#859900)

We got a bug report, that our project doesn't spell "SELinux"
consistently/correctly. I've fixed that and the patch is attached.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agotop: implement a new approach to forest view mode
Jim Warner [Sun, 26 Aug 2012 04:59:59 +0000 (23:59 -0500)]
top: implement a new approach to forest view mode

The TREE_RESCANS #define (formerly TREE_ONEPASS) has
been eliminated and the approach to forest view mode
redesigned.  The chance of dangling children has been
eliminated and overhead reduced.

We now order processes on start_time (non-display)
and are therefore immune to any pid, ppid or tgid
anomalies when pid values wrap.

The new algorithm also accommodates any distortions
caused by the 3.3 kernel 'hidepid' provisions --
something guaranteed to produce dangling children
under the former approach.

Related References:
commit a2086dfdf698f93de431349cf9a990fc5b95a768
commit cd608f462e587ee648f4bd0b798e77a52dd66c13
commit 41ed28aa5d2344e4838504a878a4db0afff8a6d8

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add major/minor page fault deltas, man document
Jim Warner [Sun, 8 Jul 2012 09:06:11 +0000 (04:06 -0500)]
top: add major/minor page fault deltas, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add major/minor page fault deltas
Jim Warner [Sun, 8 Jul 2012 09:02:58 +0000 (04:02 -0500)]
top: add major/minor page fault deltas

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agolibrary: adapt proc_t for top 'page fault delta' counts
Jim Warner [Thu, 5 Jul 2012 17:47:22 +0000 (12:47 -0500)]
library: adapt proc_t for top 'page fault delta' counts

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add new scrollable column ENVIRON, man document
Jim Warner [Sun, 1 Jul 2012 05:00:33 +0000 (00:00 -0500)]
top: add new scrollable column ENVIRON, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add new scrollable column ENVIRON
Jim Warner [Sun, 1 Jul 2012 05:00:22 +0000 (00:00 -0500)]
top: add new scrollable column ENVIRON

The recent introduction of scrollable variable width
columns makes a process 'environment' a potentially
useful addition to top's displayable fields.

This commit exploits the following new library flag:
   PROC_EDITENVRCVT

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agolibrary: add a single vector string choice for 'environ'
Jim Warner [Sun, 1 Jul 2012 05:00:11 +0000 (00:00 -0500)]
library: add a single vector string choice for 'environ'

In preparation for top scrollable environment display,
the new flag PROC_EDITENVRCVT was added to mirror the
existing single vector string handling for cgroup and
cmdline.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: revise default for forest view child scans
Jim Warner [Wed, 4 Jul 2012 09:04:04 +0000 (04:04 -0500)]
top: revise default for forest view child scans

In an effort to avoid dangling children when in forest
view mode, top defaulted to a complete rescan of every
proc_t for each child encountered.

That expense was never really cost justified and now
with the 3.3 kernel 'hidepid' provisions it no longer
can offer such protection.

With this commit, the TREE_ONEPASS define is changed
to TREE_RESCANS so as to reverse the default scan
behavior.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: miscellaneous minor tweaks (mostly spelling)
Jim Warner [Sat, 30 Jun 2012 05:00:55 +0000 (00:00 -0500)]
top: miscellaneous minor tweaks (mostly spelling)

This commit represents mostly spelling corrections
in comments.  It also includes a few very minor logic
changes/relocations.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: correct field order within Section 3a, man document
Jim Warner [Sat, 30 Jun 2012 05:00:44 +0000 (00:00 -0500)]
top: correct field order within Section 3a, man document

This section purported to list fields in alphabetical
order, but this was not always true.

With this commit, strict ascii collating sequence is
now observed.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: improve unsolicited user input validation
Jim Warner [Sat, 30 Jun 2012 05:00:33 +0000 (00:00 -0500)]
top: improve unsolicited user input validation

The logic associated with invalid keystrokes was
simplified through some minor reordering.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: improve scroll coordinates message handling
Jim Warner [Sat, 30 Jun 2012 05:00:22 +0000 (00:00 -0500)]
top: improve scroll coordinates message handling

With the introduction of intra-column scrolling, the
scroll coordinates message was enhanced to give some
hint of positioning within a scrolled column.

Rather than rebuild this somewhat costly string from
scratch with each frame, we'll now do the bulk of the
work only when column headers are constructed.

The only remaining per frame costs will then be the
addition of a few terminfo escapes and the current
Frame_maxtask count.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add intra-column horizontal scrolling, man document
Jim Warner [Sat, 30 Jun 2012 05:00:11 +0000 (00:00 -0500)]
top: add intra-column horizontal scrolling, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add intra-column horizontal scrolling
Jim Warner [Sat, 30 Jun 2012 05:00:00 +0000 (00:00 -0500)]
top: add intra-column horizontal scrolling

This commit introduces horizontal scrolling within any
variable width column.  Thus, an entire command line,
complete list of control groups, etc. can now be
viewed -- not just a screen width's portion.

It is activated when any variable width column:
 . is (via field selection) or
 . has become (via the right arrow key)
the only displayed field.

Then, the right and left arrow keys can be used in the
normal way to continue scrolling within that column.

The amount scrolled with each key press is currently
set as the normal tab stop increment of 8 characters.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agolibrary: lift 1024 byte restriction on control groups
Jim Warner [Sat, 30 Jun 2012 04:59:59 +0000 (23:59 -0500)]
library: lift 1024 byte restriction on control groups

The control group hierarchies for any particular task
could conceivably grow quite large.  However, the
library might impose an arbitrary limit of 1024 bytes
via fill_cgroup_cvt.

Two utility buffers of 128 KiB each were already
available for command line use.  This commit simply
trades the smaller 1024 byte stack based buffers for
those much larger existing ones.  Thus, truncation
can be avoided with no additional run-time costs.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: exploit library changes to cgroup & supgid
Jim Warner [Thu, 28 Jun 2012 05:00:03 +0000 (00:00 -0500)]
top: exploit library changes to cgroup & supgid

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agops: exploit library changes to cgroup & supgid
Jim Warner [Thu, 28 Jun 2012 05:00:02 +0000 (00:00 -0500)]
ps: exploit library changes to cgroup & supgid

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agolibrary: standardize handling of cgroup, supgid
Jim Warner [Thu, 28 Jun 2012 05:00:01 +0000 (00:00 -0500)]
library: standardize handling of cgroup, supgid

Some inconsistencies have emerged during development
of support for these relatively new proc_t fields.

For example, a PROC_FILLCGROUP flag (via file2strvec)
could return NULL in cgroup whereas PROC_EDITCGRPCVT
(via fill_cgroup_cvt) *almost* guaranteed a return
address (as is true for PROC_EDITCMDLCVT and cmdline).
But even PROC_EDITCGRPCVT could return NULL if the
kernel version was less than 2.6.24.  Then with NULL
ps would display a "-" while top would show "n/a".

And while unlikely, with the PROC_FILLSTATUS flag (via
status2proc) a NULL supgid address was theoretically
possible and both ps and top would then show "n/a".

This commit standardizes the following usage:
  . PROC_FILLSTATUS         (via status2proc)
      guarantees a valid supgid address
      representing either a true comma
      delimited list or "-"
  . PROC_FILLCGROUP  plus
    PROC_EDITCGRPCVT        (via fill_cgroup_cvt)
      guarantees a cgroup single vector
      representing either a true control
      group hierarchy or "-"

And as was true before, the following remains true:
    PROC_FILLCOM     or
    PROC_FILLARG            (via file2strvec)
      may return a NULL cmdline pointer
  . PROC_FILLCGROUP         (via file2strvec)
      may return a NULL cgroup pointer
  . PROC_FILLCOM     or
    PROC_FILLARG     plus
    PROC_EDITCMDLCVT        (via fill_cmdline_cvt)
      guarantees a cmdline single vector
      representing either a true command
      line or a bracketed program name
  . PROC_FILLSTATUS  plus
    PROC_FILLSUPGRP         (via supgrps_from_supgids)
      guarantees a valid supgrp address
      representing either a true comma
      delimited list or "-"

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agops: restore missing space when environment is displayed
Jim Warner [Tue, 26 Jun 2012 04:59:59 +0000 (23:59 -0500)]
ps: restore missing space when environment is displayed

This commit restores the missing space between command
lines and the environment when the later is being
displayed.  Below is a brief history of that elusive
character.

commit bb4f08ba297a67a043f7547670aa8623b54c2e67
Date:   Thu Aug 11 07:42:14 2011 +1000
   The ps program was altered for improved args/comm
   compliance.  At this time, the needed space was
   present due to a buglet in the new library
   read_unvectored function used by fill_cmdline_cvt.

commit a5881b5a4e5056d13906ce6128f6aa180d67d60e
Date:   Thu Dec 8 10:19:38 2011 -0600
   The trailing space was eliminated so that the
   file2strvec and fill_cmdline_cvt returned
   command lines contained no trailing space.

   However, this created a buglet when control group
   hierarchies were displayed and the final cgroup
   was empty.

   This is also where the undetected ps buglet was
   created.

commit c3a1239efee4d720080f216547be4cd22253f861
Date:   Sun Dec 11 12:00:50 2011 -0600
   The control group anomaly was fixed but the impact
   on ps args/environ was still not detected.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoDebian Bug report #526355
Alfredo Esteban [Sat, 18 Aug 2012 00:20:27 +0000 (02:20 +0200)]
Debian Bug report #526355

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

Flag -f doesn't modify output anymore.

There is a new flag -a to show full command line processes.

Signed-off-by: Alfredo Esteban <aedelatorre@gmail.com>
12 years agovmstat si and so fields zero with -S mM 1
Jaromir Capik [Sat, 28 Jul 2012 07:50:00 +0000 (17:50 +1000)]
vmstat si and so fields zero with -S mM 1

'si' and 'so' values depend on the result of the unitConvert
function where the output is a fixed-point size of kb_per_page
after the conversion. It gives 4 for kB units and 0 for MB units.
This also causes problems when switching between 'K' and 'k'
since the output value is 4 in both cases and the result for
'k' and 'K' then doesn't differ ... I swapped the conversion with
multiplication in order to make the number higher so it doesn't
lose precision. Since the unitConvert now accepts long instead
of int, I had to change the input type from int to long.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agopgrep/pkill -F expects \n (Debian Bug report #676709)
Alfredo Esteban [Sat, 7 Jul 2012 01:15:15 +0000 (03:15 +0200)]
pgrep/pkill -F expects \n (Debian Bug report #676709)

Hi,

I'm sending the patch to fix Debian bug report #676709:

pgrep/pkill -F expects "\n". If not present, no process is found/killed:

> wc -l /run/atd.pid
1 /run/atd.pid

> pgrep -F /run/atd.pid
1213

> wc -l /run/NetworkManager.pid
0 /run/NetworkManager.pid

> pgrep -F /run/NetworkManager.pid

Alfredo

12 years agoSet the locale to C.
Craig Small [Sat, 30 Jun 2012 06:43:17 +0000 (16:43 +1000)]
Set the locale to C.

Some checks will fail due to different locales. For example 1.2 will
become 1,2 so the match fails.  Problem reported by Alfredo Esteban
with fix suggested by Mike Frysinger

12 years agoRun pgrep and pkill tests whithout host ps
Gilles Espinasse [Wed, 27 Jun 2012 21:21:50 +0000 (23:21 +0200)]
Run pgrep and pkill tests whithout host ps

When ps is not available (like it may happen in a chroot), pgrep.exp and pkill.exp tests fail.
Use just build ps instead.

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agoShow sizes > 4G correctly in bytes on 32-bit machines.
Adam Sampson [Tue, 26 Jun 2012 13:06:45 +0000 (14:06 +0100)]
Show sizes > 4G correctly in bytes on 32-bit machines.

size is a long; this needs to be a 64-bit multiplication.

12 years agoIncrease slab name from 64 to 128 characters
Craig Small [Tue, 26 Jun 2012 12:01:42 +0000 (22:01 +1000)]
Increase slab name from 64 to 128 characters

There soon will be slab types per cgroup meaning the name of the slab
will have the cgroup name in parathensis after the slab name.  This
minor change increases the slab name size to cater for this.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agotests: add pkill test to catch signal option order regressions
Sami Kerola [Sun, 24 Jun 2012 12:40:02 +0000 (14:40 +0200)]
tests: add pkill test to catch signal option order regressions

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agotests: enable basic pkill test
Sami Kerola [Sun, 24 Jun 2012 12:37:11 +0000 (14:37 +0200)]
tests: enable basic pkill test

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopkill: fix signal spec regression
Sami Kerola [Sun, 24 Jun 2012 11:30:22 +0000 (13:30 +0200)]
pkill: fix signal spec regression

Commig a5d9c40262c2f5f917d5f27c5f052bdbe7066ac1 caused signal spec,
again, to be required as first option; for example

pkill -3 <program> # worked
pkill <program> -3 # did not

This commit fixes the regression, without breaking option -u <numeric>
argument, assuming no-one is using negative numeric UID specifications
with space after -u && the argument.  IMHO such use case is rare enough
to be broken.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: earlier patch broke the build
Sami Kerola [Sun, 24 Jun 2012 10:51:18 +0000 (12:51 +0200)]
build-sys: earlier patch broke the build

The commit 47cc1b6ccfd1e6e10aafbf21e932991a10c97f7e might have fixed an
issue when distribution is built, but it broke make after running
./configure which this commit fixes.

Reference: http://www.delorie.com/gnu/docs/automake/automake_66.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agobuild-sys: do not assume $(top_srcdir)/.version file always exists
Sami Kerola [Mon, 4 Jun 2012 07:42:50 +0000 (09:42 +0200)]
build-sys: do not assume $(top_srcdir)/.version file always exists

The issue was visible when trying to perform 'make distcheck'
without the .version file.

Reported-by: Craig Small <csmall@enc.com.au>
Reference: http://www.freelists.org/post/procps/watch-8bit-and-make-distcheck
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoRework of the -i feature
Jaromir Capik [Wed, 20 Jun 2012 12:19:14 +0000 (22:19 +1000)]
Rework of the -i feature

This version detects IPv6 address in the host field
and also IPv6 link interface separated by % sign.
It also handles unprintable characters and spaces better
than the previous one.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agominor fix for -u fix
Craig Small [Sun, 17 Jun 2012 08:19:48 +0000 (18:19 +1000)]
minor fix for -u fix

Commit a5d9c40262c2f5f917d5f27c5f052bdbe7066ac1 had one small problem.
In that function its *argc not argc. This stops pgrep with no commands
from segfaulting, thankyou dejagnu!!

Signed-Off-By: Craig Small <csmall@enc.com.au>
12 years agoFix pwdx argument parsing
Andrej Kruták [Thu, 14 Jun 2012 12:33:49 +0000 (22:33 +1000)]
Fix pwdx argument parsing

On some architectures/gcc's, the pwdx tool doesn't compile right
because of bad type of a variable. Afterwards pwdx can't be
persuaded to work. Use int as the type, like the other tools
(like pgrep) do.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agopkill -u uid fix
Alfredo Esteban [Mon, 11 Jun 2012 12:30:01 +0000 (22:30 +1000)]
pkill -u uid fix

pkill would not parse -u <uid> options correctly and needed no space
between the flag and uid.

Bug-Debian: http://bugs.debian.org/676239
Signed-Of-By: Craig Small <csmall@enc.com.au>
12 years agoDescription: fix to build on non-Linux arches
Steven Chamberlain [Mon, 11 Jun 2012 12:11:23 +0000 (22:11 +1000)]
Description: fix to build on non-Linux arches

Fix the build where it seems a code fix for Linux was likely untested
on other systems.
Define SCHED_BATCH in test-schedbatch, for systems that don't have it;
the corresponding RH BZ#741090 patch used the magic value 3 in output.c
anyway.

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

12 years agodocs: mention linux 3.xx kernels are expected to work
Sami Kerola [Fri, 1 Jun 2012 06:32:44 +0000 (08:32 +0200)]
docs: mention linux 3.xx kernels are expected to work

Remove also kernel version specific linux upstream git repository
address.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: fix to backporting error, and other wide character issues
Sami Kerola [Tue, 29 May 2012 19:39:57 +0000 (21:39 +0200)]
watch: fix to backporting error, and other wide character issues

The commit 8967f0fca3ab53479071a01f1522a19517ecb9cd has an typo like
error, which I must have done.  The Bug-Debian 240989 did not have 12
but 128.  Rest of the fixes are from Bug-Debian 675069 e.g. missing
include added, and usage of iswprint().

Bug-Debian: http://bugs.debian.org/240989
Bug-Debian: http://bugs.debian.org/675069
Reported-by: "Dr. David Alan Gilbert" <dave@treblig.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoMinor fix with vmstat manpage for r column
Jaromir Capik [Wed, 30 May 2012 11:41:17 +0000 (21:41 +1000)]
Minor fix with vmstat manpage for r column

The r column can mean a waiting to run OR running process. This is
cleared up in the man page now.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agoApplied corrected patch for w -i
Jaromir Capik [Wed, 30 May 2012 11:37:13 +0000 (21:37 +1000)]
Applied corrected patch for w -i

I checked the second patch, saved it, it looked ok.
And then applied the first (wrong) patch. Jaromik gave this correction.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agoAdd -i option to w
Jaromir Capik [Tue, 29 May 2012 12:20:36 +0000 (22:20 +1000)]
Add -i option to w

w can now show IP address for the from field with the -i option

12 years agoRemoved bogus bogus -aux message
Craig Small [Tue, 22 May 2012 10:50:34 +0000 (20:50 +1000)]
Removed bogus bogus -aux message

This message has been here for ages and either people ignore it because
they are so used to using -aux or never see it.  It was here before 2005
and really 7 years is enought time to people to change their ways.

The notice is now removed, people who make usenames like "x" deserve all
the punishment they can get.

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

12 years agoskill: check return value of getline
Mike Frysinger [Sun, 20 May 2012 10:22:01 +0000 (06:22 -0400)]
skill: check return value of getline

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agow: fix printf compile warning
Mike Frysinger [Sun, 20 May 2012 10:20:32 +0000 (06:20 -0400)]
w: fix printf compile warning

Building w on an x86_64 system triggers:
w.c:404:4: warning: format '%zu' expects argument of type 'size_t',
                    but argument 4 has type 'int' [-Wformat]

Since we're comparing UT_NAMESIZE to an int, cast it to that type
(since it can't exceed it) and update the printf.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoMakefile.am fixes
Craig Small [Sun, 20 May 2012 07:27:14 +0000 (17:27 +1000)]
Makefile.am fixes

Two problems.
1) skill/snice : distribution doesnt mean install
If you don't set your configure flags right, you dont install the
skill/snice man pages which means you will break any subsequent compiles
with the flags enabled. Man pages not to be installed should still be
distributed.

2) The git version into Makefile.am breaks under certain conditions.
The easy break for this is:
  touch aclocal.m4
  make

We need this script added plus some dist hook magic that got left out.

12 years agowatch compiles with 8bit enabled
Craig Small [Sun, 20 May 2012 07:08:29 +0000 (17:08 +1000)]
watch compiles with 8bit enabled

watch wouldn't compile with --enable-watch8bit as some variables were
missing.  This changes fixes it.

12 years agoLast minute updates to NEWS for v3.3.3 v3.3.3
Craig Small [Sun, 20 May 2012 04:39:52 +0000 (14:39 +1000)]
Last minute updates to NEWS for v3.3.3

12 years agoFix pmap -x test in when sizeof(KLONG) != 8
Gilles Espinasse [Tue, 8 May 2012 13:01:53 +0000 (15:01 +0200)]
Fix pmap -x test in when sizeof(KLONG) != 8

-x test should have work only in sizeof(KLONG) == 8 case where 3 numbers are printed
In sizeof(KLONG) != 8, only one number and three '-' are printed, so allow '-' character

I am compiling x86 32bits userspace, so I should be in (sizeof(KLONG) != 8) case

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agoFix w tests when no user is logged in
Gilles Espinasse [Mon, 7 May 2012 07:12:06 +0000 (09:12 +0200)]
Fix w tests when no user is logged in

When the build system is a chroot with no user logged in , all w tests fail because of {1,} match rule for the userline
Allow 0 match replacing {1,} with *

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
12 years agobuild-sys: configure option --enable-skill did not work
Sami Kerola [Sun, 6 May 2012 19:30:25 +0000 (21:30 +0200)]
build-sys: configure option --enable-skill did not work

The commit 1462c4e581caf22b2e7fe155691dfcddcb51b3f7 had error in
variable name.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agodocs: pgrep.1 groff syntax fix
David Prévot [Sun, 6 May 2012 11:04:41 +0000 (13:04 +0200)]
docs: pgrep.1 groff syntax fix

Long option '--list-name' is fixed to be bold, and '-n, --newest'
are marked to new paragraph.

Bug-Debian: http://bugs.debian.org/665425
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosysctl: avoid crash when -p file has unexpected input
Sami Kerola [Thu, 3 May 2012 18:08:27 +0000 (20:08 +0200)]
sysctl: avoid crash when -p file has unexpected input

Commit e01765d30b7c4767868d5379fbfb36d1dc15eba4 added is_deprecated(), which
crashed when user had input without without /proc/sys/ subdirectory.  The below
should illustrate how exactly the bug got to be trickered.

$ cat ~/foo
cause = crash
$ ./sysctl -p ~/foo
Segmentation fault

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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>