Commit Graph

1263 Commits

Author SHA1 Message Date
Jim Warner
896f3deeb9 top: add intra-column horizontal scrolling, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:28:34 +10:00
Jim Warner
a652ba8c9d 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>
2012-08-29 17:28:18 +10:00
Jim Warner
f4666e1743 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>
2012-08-29 17:27:50 +10:00
Jim Warner
f114476a94 top: exploit library changes to cgroup & supgid
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:26:54 +10:00
Jim Warner
ede5d99f6c ps: exploit library changes to cgroup & supgid
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:26:43 +10:00
Jim Warner
8b64b36bbf 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>
2012-08-29 17:26:13 +10:00
Jim Warner
f4b6de1136 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 bb4f08ba29
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 a5881b5a4e
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 c3a1239efe
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>
2012-08-29 17:24:54 +10:00
Alfredo Esteban
f12277c74d 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>
2012-08-29 16:47:51 +10:00
Jaromir Capik
00d7d4e37a 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>
2012-07-28 17:50:00 +10:00
Sami Kerola
d958f1c0fc w: do not truncate command when width is not known
This change also adds a definition, which is in control of all command
buffer size related operations.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-15 12:49:22 +02:00
Alfredo Esteban
7696bd200e 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
2012-07-14 15:55:45 +10:00
Craig Small
30d5db1a8d 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
2012-06-30 16:43:17 +10:00
Gilles Espinasse
664eaaebc6 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>
2012-06-28 21:53:22 +10:00
Adam Sampson
ecc265492f Show sizes > 4G correctly in bytes on 32-bit machines.
size is a long; this needs to be a 64-bit multiplication.
2012-06-27 06:47:38 +10:00
Craig Small
06dc80d3b3 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>
2012-06-26 22:01:42 +10:00
Sami Kerola
af271cf8c8 tests: add pkill test to catch signal option order regressions
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-24 14:40:02 +02:00
Sami Kerola
e730a6b4dc tests: enable basic pkill test
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-24 14:39:20 +02:00
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 Prévot
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