Commit Graph

1046 Commits

Author SHA1 Message Date
Sami Kerola
d45456fb8a pkill: fix signal spec regression
Commig a5d9c40262 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>
2012-06-24 13:30:22 +02:00
Sami Kerola
cba9bdbc16 build-sys: earlier patch broke the build
The commit 47cc1b6ccf 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>
2012-06-24 13:04:03 +02:00
Sami Kerola
47cc1b6ccf 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>
2012-06-21 08:27:57 +10:00
Jaromir Capik
dcd8cf0b4b 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>
2012-06-20 22:19:14 +10:00
Craig Small
1d899453da minor fix for -u fix
Commit a5d9c40262 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>
2012-06-17 18:19:48 +10:00
Andrej Kruták
138701c499 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>
2012-06-14 22:33:49 +10:00
Alfredo Esteban
a5d9c40262 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>
2012-06-11 22:30:01 +10:00
Steven Chamberlain
a5ba6b98c1 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
2012-06-11 22:11:23 +10:00
Sami Kerola
2fb099df50 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>
2012-06-02 15:13:18 +10:00
Sami Kerola
6b0bb82b99 watch: fix to backporting error, and other wide character issues
The commit 8967f0fca3 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>
2012-05-30 22:03:31 +10:00
Jaromir Capik
48e4be926d 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>
2012-05-30 21:41:17 +10:00
Jaromir Capik
ca03e0280f 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>
2012-05-30 21:37:13 +10:00
Jaromir Capik
2b58862421 Add -i option to w
w can now show IP address for the from field with the -i option
2012-05-29 22:20:36 +10:00
Craig Small
dc1531b211 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
2012-05-22 20:50:34 +10:00
Mike Frysinger
c6e3ec4602 skill: check return value of getline
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-22 20:19:03 +10:00
Mike Frysinger
2320dc9cdb 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>
2012-05-22 20:18:51 +10:00
Craig Small
6940014c42 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.
2012-05-20 17:27:14 +10:00
Craig Small
ff3ab9d52d watch compiles with 8bit enabled
watch wouldn't compile with --enable-watch8bit as some variables were
missing.  This changes fixes it.
2012-05-20 17:08:29 +10:00
Craig Small
d9239ee3e6 Last minute updates to NEWS for v3.3.3 2012-05-20 14:39:52 +10:00
Gilles Espinasse
be1bb68c55 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>
2012-05-08 22:55:23 +10:00
Gilles Espinasse
e6bc629756 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>
2012-05-08 22:51:19 +10:00
Sami Kerola
847bf4c0c1 build-sys: configure option --enable-skill did not work
The commit 1462c4e581 had error in
variable name.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-05-07 09:01:10 +02:00
David Prvot
889f1bebc0 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>
2012-05-07 09:01:10 +02:00
Sami Kerola
b2c08d1d41 sysctl: avoid crash when -p file has unexpected input
Commit e01765d30b 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>
2012-05-07 09:01:10 +02:00
Mike Frysinger
e2987888e2 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>
2012-05-07 09:01:10 +02:00
Mike Frysinger
156dd0b5a3 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>
2012-05-07 09:00:38 +02:00
Mike Frysinger
dbefb4476a 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>
2012-05-03 09:16:34 +02:00
Sami Kerola
71aa1e78a2 docs: correct libprocps name in FAQ
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-05-01 22:47:12 +10:00
Sami Kerola
2dbb7a6743 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>
2012-05-01 22:47:06 +10:00
Jim Warner
04ca0b1cbf top: ensure /proc is mounted before term is diddled
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-04-25 15:23:22 +10:00
Jim Warner
39243fe306 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>
2012-04-25 13:46:17 +10:00
Jim Warner
421b08a4df 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>
2012-04-25 13:46:02 +10:00
Craig Small
9af478c13d Remove trailing - from w from column
Jaromir Capik discovered that the from column for w would print
a trailing - for some types of hosts.
2012-04-25 10:21:07 +10:00
Michael Schwendt
dd87e4f48c 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>
2012-04-25 09:34:41 +10:00
Jan Grig
cdeb9a071a 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>
2012-04-25 09:34:06 +10:00
Sami Kerola
43d4aac43f 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>
2012-04-18 10:26:20 +02:00
Sami Kerola
ac7f7899f2 docs: howto build uClibc version of the procps-ng
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-18 10:04:02 +02:00
Sami Kerola
34344de979 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>
2012-04-18 10:03:55 +02:00
Sami Kerola
bb4ae3d933 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>
2012-04-17 21:21:20 +02:00
Sami Kerola
be26243f9c 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>
2012-04-16 20:43:16 +02:00
Sami Kerola
beab98a036 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>
2012-04-16 20:25:23 +02:00
Sami Kerola
47100a8125 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>
2012-04-16 12:55:53 +02:00
Jim Warner
e9a9bad264 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>
2012-04-16 08:30:06 +10:00
Craig Small
09d67d5ab2 Merge remote-tracking branch 'sami/2012wk12'
Conflicts:
	watch.c
2012-04-15 10:44:37 +10:00
Jim Warner
4b833b1bce 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>
2012-04-15 10:25:10 +10:00
Jim Warner
cd253e0dc6 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>
2012-04-15 10:25:05 +10:00
Jim Warner
b079d130d7 top: miscellaneous cosmetic non-logic changes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-04-15 10:24:59 +10:00
Jim Warner
0c874637ee top: extend case-insensitive option to include 'Locate'
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-04-15 10:24:54 +10:00
Sami Kerola
f97fd76667 tests: add lib/ contents to make check
This will take tests in following commits in use.

commit 56ed9826a5
commit c7cf98b0e0

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-06 15:32:57 +02:00
Sami Kerola
bf47d16095 sysctl: simplify file close error checking
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-06 15:32:45 +02:00