Commit Graph

1286 Commits

Author SHA1 Message Date
Jim Warner
384afa494a top: optional wider non-scalable cols
This commit accommodates those fields which may have
suffered truncation due to these default limits:
  . 5 digits for uid/gid type fields
  . 8 characters for user/group type fields

With a new interactive command, users can increase the
width of all such fields, or return to the defaults.

Note:
   There are no restrictions on the amount added to
   the defaults.  The user is free to vastly exceed
   screen limits which simply means such fields can
   never be displayed.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:40 +10:00
Jim Warner
46bd0085b0 top: column alignment under user control, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:40 +10:00
Jim Warner
c07be1d492 top: column alignment under user control
This commit affords user control over justification
for both column headings and the subordinate data.

Separate toggles are provided for control of numeric
data and string data.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:40 +10:00
Jim Warner
0f61354bf7 top: refactoring now allows column header nls support
Now that column headings are independent of column
data format and require no carefully managed padding
bytes they are candidates for nls translation.

This commit migrates all column headings to the .pot
file with additional translator guidance in the form
of maximum sizes to avoid truncation.

It also places these new additions adjacent to their
associated descriptions, which were already present.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:40 +10:00
Jim Warner
64cfdda756 top: refactor and enhance column width management
This commit accomplishes the following objectives:
 * remove extra task_show parm added with 'Locate'
 * avoid column overflow with subsequent misalignment
 * eliminate spaces for column heading padding
 * decouple column headings from column data formats
 * eliminate all hardcoded column format specifiers
 * generalize the inter-column spacing management
 * remove Fieldstab.desc in favor of direct nls access
 * set the stage for nls support of column headings
 * set the stage for dynamic changes to justification

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:39 +10:00
Jim Warner
767a13b96c top: tidy up some miscellaneous user input logic
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:39 +10:00
Jim Warner
718cececc7 top: correct an old man document flaw
This flaw was revealed under 'man2htm' and dates back
to the first Gitorious revised top submission.

Reference:
commit fd62123562
Date:   Thu Mar 31 22:15:12 2011 +1100

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:39 +10:00
Jim Warner
6c8e9d9581 library: fix proc_t page fault delta counts alignment
When the maj_delta and min_delta fields were added to
the proc_t, they necessitated some compiler generated
padding bytes.

With this slight reordering, those padding bytes are
no longer generated.  And since the original commit
already broke the library ABI, now is an opportune
time to correct that misalignment.

Reference:
commit 7753bd1004

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:39 +10:00
Jim Warner
a65de0fd73 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>
2012-09-27 22:16:53 +10:00
Dimitrios Apostolou
faec340719 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>
2012-09-27 22:08:04 +10:00
Jaromir Capik
8e867659e6 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>
2012-09-27 21:46:46 +10:00
Jim Warner
beb0982b28 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 a2086dfdf6
commit cd608f462e
commit 41ed28aa5d

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-31 07:22:31 +10:00
Jim Warner
d9890fb5ac top: add major/minor page fault deltas, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:37:37 +10:00
Jim Warner
d9cf59a9b2 top: add major/minor page fault deltas
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:37:29 +10:00
Jim Warner
7753bd1004 library: adapt proc_t for top 'page fault delta' counts
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:37:11 +10:00
Jim Warner
6cc7416441 top: add new scrollable column ENVIRON, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:35:33 +10:00
Jim Warner
17e0eaf0f3 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>
2012-08-29 17:35:24 +10:00
Jim Warner
348e6091cb 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>
2012-08-29 17:34:54 +10:00
Jim Warner
a2086dfdf6 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>
2012-08-29 17:30:26 +10:00
Jim Warner
06e92e93b8 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>
2012-08-29 17:29:46 +10:00
Jim Warner
6940430c55 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>
2012-08-29 17:29:34 +10:00
Jim Warner
22515ce62e 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>
2012-08-29 17:29:17 +10:00
Jim Warner
fbfaa868ba 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>
2012-08-29 17:28:53 +10:00
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