]> granicus.if.org Git - procps-ng/log
procps-ng
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>
12 years agotop: fix selected miscellaneous compiler warnings
Jim Warner [Mon, 5 Mar 2012 17:22:33 +0000 (11:22 -0600)]
top: fix selected miscellaneous compiler warnings

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

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

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

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

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

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

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

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

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

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

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

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

Completes change in commit ddd15211e0895478f9b6008ff9c26c99d45a1753

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

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

w.c

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

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

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

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

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

12 years agodocs: clarification to license headers in files
Sami Kerola [Fri, 2 Mar 2012 12:29:36 +0000 (13:29 +0100)]
docs: clarification to license headers in files

Add license header to all files.  The summary of licensing is below,
taken from Craig Small's email which is referred in commit message
tail.

sysctl and pgrep are GPL 2+
The rest is LGPL 2.1+

Reference: http://www.freelists.org/post/procps/Incorrect-FSF-address-in-the-license-files,8
Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=797962
CC: Craig Small <csmall@enc.com.au>
CC: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosysctl: print new line explicitely
Sami Kerola [Fri, 2 Mar 2012 11:41:23 +0000 (12:41 +0100)]
sysctl: print new line explicitely

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

watch.c

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

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

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

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

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

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

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

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

watch.c

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

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

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

pgrep.c

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

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

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

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

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

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