]> granicus.if.org Git - procps-ng/log
procps-ng
12 years agotop: give inspect display page algorithm a small boost
Jim Warner [Wed, 28 Nov 2012 06:00:00 +0000 (00:00 -0600)]
top: give inspect display page algorithm a small boost

This commit improves display performance when the user
has scrolled horizontally past the end of a top 'row'.

We can avoid the need to memset our buffer with spaces
and putp those spaces individually by exploiting logic
that already exists. If one '\n' character is inserted
into the buffer instead, the next terminfo string sent
will be Cap_clr_eol achieving exactly the same effect!

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: use the type size_t more consistently for inspect
Jim Warner [Wed, 28 Nov 2012 06:00:00 +0000 (00:00 -0600)]
top: use the type size_t more consistently for inspect

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoNEWS: updated with changes for the new release (3.3.6)
Jim Warner [Sun, 25 Nov 2012 06:00:07 +0000 (00:00 -0600)]
NEWS: updated with changes for the new release (3.3.6)

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add a flexible 'Inspect' capability, man document
Jim Warner [Sun, 25 Nov 2012 06:00:06 +0000 (00:00 -0600)]
top: add a flexible 'Inspect' capability, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: add a flexible 'Inspect' capability
Jim Warner [Sun, 25 Nov 2012 05:00:05 +0000 (00:00 -0500)]
top: add a flexible 'Inspect' capability

This commit introduces an extremely powerful, flexible
brand new capability.  Now, users can pause the normal
iterative display and inspect the contents of any file
or output from any script, command, or even pipelines.

It's invoked via the 'Y' interactive command which, in
turn, is supported with simple user supplied additions
as new entries in the top personal configuration file.

A separate new 'Inspect' window supports scrolling and
searching, similar to the main top display.  Except it
extends existing 'L'/'&' (locate/locate-next) commands
so that an out-of-view match automatically adjusts the
horizontal position bringing such data into view.  And
it provides for multiple successive same line matches.

Also, the basic 'more/less' navigation keys are active
in this new 'Inspect' window, to ease user transition.

There are no program changes required when entries are
added to or deleted from the rcfile.  And there are no
known limits to the complexity of a script, command or
pipeline, other than the unidirectional nature imposed
by the 'popen' function call which top cannot violate.

Since it's impossible to predict exactly what contents
will be generated, top treats all output as raw binary
data.  Any control characters display in '^C' notation
while all other unprintable characters show as '<AB>'.

The biggest problem encountered was with the find/next
capability since that strstr guy was really diminished
given the possibility that numerous 'strings' could be
encountered *within* many of top's raw, binary 'rows'.

Oh, and another problem was in maintaining the perfect
left & right text justification of this commit message
along with all of the commit summaries.  Some of those
summaries (like this very one) are of course, slightly
shorter, to make room for the 'man document' addition.

Enjoy!

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: kill/nice provide for a default pid, man document
Jim Warner [Sun, 25 Nov 2012 05:00:04 +0000 (00:00 -0500)]
top: kill/nice provide for a default pid, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: kill/nice provide for a default pid
Jim Warner [Sun, 25 Nov 2012 05:00:03 +0000 (00:00 -0500)]
top: kill/nice provide for a default pid

As an aid to the above 2 commands, and as a prelude to
an upcoming 'inspect other output' capability, the act
of selecting a process for either has been simplified.

Positioning a task as the first one displayed, via the
up/down arrow keys, will now establish it as a default
selection for the appropriate command.  Thus, that pid
will then be incorporated in a subsequent input prompt.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: quiet lintian with escaped dashes in man document
Jim Warner [Sun, 25 Nov 2012 05:00:00 +0000 (00:00 -0500)]
top: quiet lintian with escaped dashes in man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: include under nls support an overlooked error msg
Jim Warner [Sun, 25 Nov 2012 05:00:01 +0000 (00:00 -0500)]
top: include under nls support an overlooked error msg

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agoAdd -c count option to pkill
Craig Small [Wed, 21 Nov 2012 11:11:17 +0000 (22:11 +1100)]
Add -c count option to pkill

Possibly by a side-effect but pkill -c option used to work which would
print the number of killed processes.  This small change restores this
functionality.

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

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agoUpdated news for 3.3.5
Craig Small [Tue, 6 Nov 2012 12:01:08 +0000 (23:01 +1100)]
Updated news for 3.3.5

12 years agops: cut out code unused code
Sami Kerola [Fri, 2 Nov 2012 17:50:59 +0000 (17:50 +0000)]
ps: cut out code unused code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agowatch: fix compiler warnings
Sami Kerola [Fri, 2 Nov 2012 17:50:58 +0000 (17:50 +0000)]
watch: fix compiler warnings

watch.c:255:14: warning: no previous declaration for 'get_time_usec' [-Wmissing-declarations]
watch.c:303:6: warning: no previous declaration for 'output_header' [-Wmissing-declarations]
watch.c:364:5: warning: no previous declaration for 'run_command' [-Wmissing-declarations]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agovmstat: fix compiler warnings
Sami Kerola [Fri, 2 Nov 2012 17:50:57 +0000 (17:50 +0000)]
vmstat: fix compiler warnings

vmstat.c:817:7: warning: declaration of 'tmp' shadows a previous local [-Wshadow]
vmstat.c:708:7: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopmap: fix compiler warnings
Sami Kerola [Fri, 2 Nov 2012 17:50:56 +0000 (17:50 +0000)]
pmap: fix compiler warnings

pmap.c:80:7: warning: declaration of 'mapbuf' shadows a global declaration [-Wshadow]
pmap.c:63:13: warning: shadowed declaration is here [-Wshadow]
pmap.c:137:37: warning: declaration of 'mapbuf' shadows a global declaration [-Wshadow]
pmap.c:63:13: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agosysctl: fix compiler warnings
Sami Kerola [Fri, 2 Nov 2012 17:50:55 +0000 (17:50 +0000)]
sysctl: fix compiler warnings

sysctl.c:293:5: warning: no previous declaration for 'is_deprecated' [-Wmissing-declarations]
sysctl.c:472:58: warning: declaration of 'pattern' shadows a global declaration [-Wshadow]
sysctl.c:67:14: warning: shadowed declaration is here [-Wshadow]
sysctl.c:650:7: warning: variable 'SwitchesAllowed' set but not used [-Wunused-but-set-variable]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoskill: fix compiler warnings
Sami Kerola [Fri, 2 Nov 2012 17:50:54 +0000 (17:50 +0000)]
skill: fix compiler warnings

skill.c:340:5: warning: no previous declaration for 'skill_sig_option' [-Wmissing-declarations]
skill.c:460:5: warning: no previous declaration for 'snice_prio_option' [-Wmissing-declarations]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agolib/fileutils: fix compiler warnings
Sami Kerola [Fri, 2 Nov 2012 17:50:53 +0000 (17:50 +0000)]
lib/fileutils: fix compiler warnings

./lib/fileutils.c:9:5: warning: no previous declaration for 'close_stream' [-Wmissing-declarations]
./lib/fileutils.c:23:6: warning: no previous declaration for 'close_stdout' [-Wmissing-declarations]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopgrep: fix compiler warnings
Sami Kerola [Fri, 2 Nov 2012 17:50:52 +0000 (17:50 +0000)]
pgrep: fix compiler warnings

pgrep.c:195:12: warning: 'fcntl_lock' defined but not used [-Wunused-function]
pgrep.c:575:5: warning: no previous declaration for 'signal_option' [-Wmissing-declarations]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopmap: remove memory leaks
Sami Kerola [Fri, 2 Nov 2012 17:50:51 +0000 (17:50 +0000)]
pmap: remove memory leaks

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agopmap: use correct types for memory allocation
Sami Kerola [Fri, 2 Nov 2012 17:50:50 +0000 (17:50 +0000)]
pmap: use correct types for memory allocation

Fixes error which did not happen always.  Changes of being affected by
the bug where greater the more there where pids defined as pmap argument.
The debian bug referral can almost certainly reproduce the problem,
especially when tried multiple times in row.

pmap: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)
(((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct
malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >=
(unsigned long)((((__builtin_offsetof (struct malloc_chunk,
fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) -
1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) ==
0)' failed.

Reported-by: lee <lee@yun.yagibdah.de>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688180
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
12 years agoAdd missing fileutils test files
Craig Small [Wed, 31 Oct 2012 11:47:48 +0000 (22:47 +1100)]
Add missing fileutils test files

Reference: http://www.freelists.org/post/procps/procpsng-version-334-released,7

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agofix sysctl.conf inclusion in dist tarballs
Mike Frysinger [Mon, 29 Oct 2012 22:47:05 +0000 (18:47 -0400)]
fix sysctl.conf inclusion in dist tarballs

If you configure w/out --enable-examples, then `make dist` doesn't
include sysctl.conf.  Configure flags should not affect the tarball
produced by `make dist`, so explicitly list the conf in EXTRA_DIST.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoStop SIGFPE on vmstat at times v3.3.5
Craig Small [Tue, 30 Oct 2012 10:48:34 +0000 (21:48 +1100)]
Stop SIGFPE on vmstat at times

Certain setups can crash vmstat with a SIGFPE, this small patch
catches those events

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

12 years agoAdded debian patch for kfreebsd bug 674785
Craig Small [Tue, 30 Oct 2012 10:36:04 +0000 (21:36 +1100)]
Added debian patch for kfreebsd bug 674785

12 years agoBump the soname
Craig Small [Tue, 30 Oct 2012 10:34:40 +0000 (21:34 +1100)]
Bump the soname

12 years agow: do not truncate command when width is not known v3.3.4
Craig Small [Fri, 26 Oct 2012 08:06:16 +0000 (19:06 +1100)]
w: do not truncate command when width is not known

Merge remote-tracking branch 'sami/2012wk28'

12 years agotop: tweak scroll coordinates msg handling (again)
Jim Warner [Tue, 23 Oct 2012 03:22:22 +0000 (22:22 -0500)]
top: tweak scroll coordinates msg handling (again)

An earlier commit improved the scroll coordinates
message performance by offloading most of the work
to those occasions when column headers were rebuilt.

The only remaining per-frame costs were the addition
of some terminfo escapes and the Frame_maxtask count.

This commit further reduces those per-frame costs to
the absolute minimum.

Reference:
commit fbfaa868babb0974c799d45e208619412afbdfef

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: allow exit from 2nd level help via <Esc> key
Jim Warner [Mon, 22 Oct 2012 02:21:21 +0000 (21:21 -0500)]
top: allow exit from 2nd level help via <Esc> key

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agops: allow large list of groups
Eric Dumazet [Thu, 11 Oct 2012 17:02:10 +0000 (19:02 +0200)]
ps: allow large list of groups

Current linux kernels output no more than 32 groups
in /proc/{pid}/status.

Plan is to increase this limit.

This patch allows ps to not core dump if the buffer used to read status
file was too small.

# ps aux
Signal 11 (SEGV) caught by ps (procps-ng version 3.3.3).
ps:display.c:59: please report this bug

Also increases the size of the buffer from 1024 to 4096, since even with
32 groups we are close to the limit.

cat /proc/12731/status | wc
     39     128     961

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
12 years agopgrep delimeter to delimiter
Craig Small [Thu, 11 Oct 2012 10:34:50 +0000 (21:34 +1100)]
pgrep delimeter to delimiter

pgrep used delimiter and delimeter, the correct spelling is delimiter.
Thanks to Alexander Kobel for the heads-up.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agotop: for performance, employ additional inlining
Jim Warner [Fri, 5 Oct 2012 20:15:15 +0000 (15:15 -0500)]
top: for performance, employ additional inlining

The 'refactor and enhance column width management'
recent redesign produced many subsequent benefits,
the latest of which is automatically sized fixed-width
non-scalable columns.

As expected, there was a cost associated with these
many enhancements.  That cost has now been identified
as a 1-4% performance degradation, depending on which
fields are being displayed.

This increased cost arises principally from current
drawing related function calls, whereas top-3.3.3 did
most of its drawing via macros effectively inlining
those duties.

This commit inlines the equivalent drawing functions,
thus eliminating the function call penalty, and places
this top on a par with top-3.3.3.  The trade off is a
modest additional 4k in executable size.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: 'X' command offers auto option, man document
Jim Warner [Wed, 3 Oct 2012 19:14:14 +0000 (14:14 -0500)]
top: 'X' command offers auto option, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: 'X' command offers auto option
Jim Warner [Wed, 3 Oct 2012 18:13:13 +0000 (13:13 -0500)]
top: 'X' command offers auto option

The recent introduction of a column widths override
(the 'X' command) provided for a user input amount
to be added to default field size which ranged from
5 to 10 bytes.

While that approach could prevent truncated data, the
different default sizes would almost certainly mean
some precious screen real estate was waisted.

This commit introduces the concept of dynamic widths
where top will add only enough to a field default to
prevent truncation for that specific field.

Now users have a choice between their explicit width
override or a width chosen by top to exactly match
display needs.  The former is immediate but likely
wastes some horizontal space while the latter is
iterative but will be sized precisely.

Original 'X' Command:
commit 384afa494a56d0460bc81576c18ae44978530de3
commit 47e1d063ac4256fd9c1b4efed5168d2c1670e065

Extensions to 'X' Command:
commit bbf8e44fb48e4aa4756cfa3b4405b27a791b8386
commit 7557f3f75463a720b1bd176e19afe3f9c590d5f6

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: map additional navigation keys, man document
Jim Warner [Mon, 1 Oct 2012 16:11:02 +0000 (11:11 -0500)]
top: map additional navigation keys, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: map additional navigation keys
Jim Warner [Mon, 1 Oct 2012 16:11:01 +0000 (11:11 -0500)]
top: map additional navigation keys

There were some gaps in the alternate navigation keys
top provided.  Additionally, some inconsistencies
existed in the supporting key table.

This commit adds the following new key equivalents,
mirroring the standard vim navigation keys:
. ctrl+alt+ k = pgup, ctrl+alt+ j = pgdown
. ctrl+alt+ h = home, ctrl+alt+ l = end

Also, the supporting table entries now consistently
follow these "directions":
. up/pgup, down/pgdown, left/home, right/end

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: avoid potential xterm state corruption
Jim Warner [Mon, 1 Oct 2012 15:00:00 +0000 (10:00 -0500)]
top: avoid potential xterm state corruption

To support the cursor navigation keys, after saving
the termios structure top issues 'smkx/keypad_xmit'
during startup.  However, some terminals appear to
treat that directive as persistent which leaves a
corrupted tty state after top exit.

This commit reverses the above terminal directive
via 'rmkx/keypad_local' just prior to restoring the
saved termios structure at program end.

For discovering this bug, and providing the 'rmkx'
clue to its solution, thanks to:
  Kirill A. Shutemov <kirill@shutemov.name>

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: for user justify feature, remember old-top needs
Jim Warner [Mon, 1 Oct 2012 04:59:59 +0000 (23:59 -0500)]
top: for user justify feature, remember old-top needs

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agokill -PID fixed
Craig Small [Tue, 2 Oct 2012 11:56:38 +0000 (21:56 +1000)]
kill -PID fixed

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

kill would not permit negative PIDs and thought they were options. kill
now explicitly checks for unknown options and if they are numeric
assumes they are negative PIDs.  The first negative PID stops any
further option processing.

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agotop: swat a bug introduced with recent width refactor
Jim Warner [Fri, 28 Sep 2012 21:39:35 +0000 (16:39 -0500)]
top: swat a bug introduced with recent width refactor

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: update NEWS with additional capabilities
Jim Warner [Tue, 25 Sep 2012 08:03:03 +0000 (03:03 -0500)]
top: update NEWS with additional capabilities

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: with new 'X' command, WCHAN becomes fixed-width
Jim Warner [Tue, 25 Sep 2012 07:02:02 +0000 (02:02 -0500)]
top: with new 'X' command, WCHAN becomes fixed-width

This 'Sleeping in function' field was made variable
width because the length of current kernel symbols
usually exceeded the former top's 9 character limit.

As a variable width field it would steal valuable
horizontal display positions from other, more likely,
displayed fields such as COMMAND or CGROUPS.

With the advent of the new 'X' toggle, no fixed-width
non-scalable field need suffer permanent truncation.
Thus, WCHAN is being made fixed width with a default
size of 10 characters.

Signed-off-by: Jim Warner <james.warner@comcast.net>
 top/top.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

12 years agotop: extend new 'X' command to include the TTY field
Jim Warner [Tue, 25 Sep 2012 06:01:01 +0000 (01:01 -0500)]
top: extend new 'X' command to include the TTY field

I have no idea what the maximum length of a terminal
name might be.  However, the library provides for up
to 128 characters (ouch).

So just to be safe, this commit extends the ability
to widen columns to embrace this field.

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: optional wider non-scalable cols, man document
Jim Warner [Fri, 21 Sep 2012 07:02:02 +0000 (02:02 -0500)]
top: optional wider non-scalable cols, man document

12 years agotop: optional wider non-scalable cols
Jim Warner [Fri, 21 Sep 2012 06:01:01 +0000 (01:01 -0500)]
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>
12 years agotop: column alignment under user control, man document
Jim Warner [Thu, 20 Sep 2012 07:02:02 +0000 (02:02 -0500)]
top: column alignment under user control, man document

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: column alignment under user control
Jim Warner [Thu, 20 Sep 2012 06:01:01 +0000 (01:01 -0500)]
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>
12 years agotop: refactoring now allows column header nls support
Jim Warner [Wed, 19 Sep 2012 07:02:02 +0000 (02:02 -0500)]
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>
12 years agotop: refactor and enhance column width management
Jim Warner [Wed, 19 Sep 2012 06:01:01 +0000 (01:01 -0500)]
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>
12 years agotop: tidy up some miscellaneous user input logic
Jim Warner [Tue, 18 Sep 2012 06:01:01 +0000 (01:01 -0500)]
top: tidy up some miscellaneous user input logic

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agotop: correct an old man document flaw
Jim Warner [Mon, 17 Sep 2012 06:01:01 +0000 (01:01 -0500)]
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 fd62123562c2b71f292d3d3ee1a085709048b11a
Date:   Thu Mar 31 22:15:12 2011 +1100

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agolibrary: fix proc_t page fault delta counts alignment
Jim Warner [Sat, 15 Sep 2012 20:15:15 +0000 (15:15 -0500)]
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 7753bd1004e65bde7fce4622c943401abc71f24a

Signed-off-by: Jim Warner <james.warner@comcast.net>
12 years agops: favor truncation of long names over POSIX/UNIX standard
Jim Warner [Mon, 17 Sep 2012 20:30:45 +0000 (15:30 -0500)]
ps: favor truncation of long names over POSIX/UNIX standard

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

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

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

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

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

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

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

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

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

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

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

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

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

Related References:
commit a2086dfdf698f93de431349cf9a990fc5b95a768
commit cd608f462e587ee648f4bd0b798e77a52dd66c13
commit 41ed28aa5d2344e4838504a878a4db0afff8a6d8

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

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

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

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

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

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

This commit exploits the following new library flag:
   PROC_EDITENVRCVT

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   This is also where the undetected ps buglet was
   created.

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

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

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

Flag -f doesn't modify output anymore.

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

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

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

Signed-off-by: Craig Small <csmall@enc.com.au>
12 years agow: do not truncate command when width is not known
Sami Kerola [Sun, 15 Jul 2012 10:42:56 +0000 (12:42 +0200)]
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>
12 years agopgrep/pkill -F expects \n (Debian Bug report #676709)
Alfredo Esteban [Sat, 7 Jul 2012 01:15:15 +0000 (03:15 +0200)]
pgrep/pkill -F expects \n (Debian Bug report #676709)

Hi,

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

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

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

> pgrep -F /run/atd.pid
1213

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

> pgrep -F /run/NetworkManager.pid

Alfredo

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Remove also kernel version specific linux upstream git repository
address.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Mike Frysinger <vapier@gentoo.org>