Commit Graph

1252 Commits

Author SHA1 Message Date
Jim Warner
bc46f67f9a top: provide the means to adjust scaled summary memory
Earlier this year, the switch from KiB to Mib as shown
in top's summary area was postponed to those occasions
when KiB exceeded 8 digits. In hindsight that may have
moved top in the wrong direction, given the difficulty
of digesting such large numbers of digits at a glance.

This commit adds a new 'E' interactive command used to
cycle the displayed memory amounts ranging from KiB to
TiB. Thus, users can choose the radix they wish shown.

p.s. and it will be rcfile preserved for any restarts!

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

Reference(s):
http://www.freelists.org/post/procps/top-regression-reports

commit 95f2201730
Author: James Cloos <cloos@jhcloos.com>
Date:   Mon Feb 6 00:00:00 2012 -0500

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:40 +11:00
Jim Warner
407d1fc8f2 top: provide command line sort field override switches
This commit adds two new command line switches dealing
with the potential need to automate/script the setting
of top's current sort field independent of the rcfile.

The -o (lower case) switch requires a lone valid field
name as an argument, from among the 42 currently used.
Then, it overrides the config file's Curwin->sortindx.

And since field names are now translatable, they could
diverge from those reflected in the documentation. So,
a 2nd switch of -O (upper case) is also provided which
outputs all names as translated and understood by top.

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

Reference(s):
Bug-Redhat: https://bugzilla.redhat.com/871844
http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857,9
http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857,15
http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857,16

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:40 +11:00
Jim Warner
d747659ad8 top: follow ps lead, allow core dumps where applicable
Reference(s):
Bug-Redhat: https://bugzilla.redhat.com/871825
commit c1f10d11bc
http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:39 +11:00
Jim Warner
7a7e402563 top: follow ps lead, treat SIGUSR1/SIGUSR2 as harmless
Reference(s):
commit f62fd63d9e
http://www.freelists.org/post/procps/PATCH-procps-states-a-bug-is-hit-when-receiving-a-signal-871824

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:39 +11:00
Jim Warner
015e95dec3 top: remove undocumented alias ('V') for version ('v')
This is doubtless not quite the solution envisioned by
the submitter, but 'V' should probably never have been
used as an alias for 'v' now that we have forest-view.

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

Reference(s):
Bug-Redhat: https://bugzilla.redhat.com/848290

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:38 +11:00
Jim Warner
73d83ec1c2 top: add pseudo type to the inspect demo '=' provision
When 'type' was added to the alternate status line for
the '=' key, the need for the demonstration 'type' was
overlooked. This commit avoids the '(null)' potential.

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

Reference(s);
commit 3b2b9a95e6

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:38 +11:00
Jaromir Capik
c1f10d11bc Allow core file generation by ps command (rhbz#871825, rhbz#512857)
Since the ps command handles signals with it's own handler, it doesn't create
core files when something wrong happens. The attached patch restores the ps
command ability to create core files by calling the default handler once we
print our custom message. The original RH's workaround masked SIGABRT and
SIGSEGV signals and that would conflict with the original intention of the
custom signal handler and also with the filtering patch I sent in my previous
email. Moreover, this solution generates core for all relevant signals (SIGFPE,
etc.).

Bug-Redhat: http://bugzilla.redhat.com/871825
Bug-Redhat: http://bugzilla.redhat.com/512857
Reference: http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857

Signed-off-by: Craig Small <csmall@enc.com.au>
2012-12-13 22:17:03 +11:00
Wouter van Kesteren
cfd0dbd336 ps.test: see truncated user/group names as valid
With ps now truncating the names instead of chaning to UIDs for long
usernames, the check needs to be updated too
2012-12-13 21:45:28 +11:00
Jaromir Capik
f62fd63d9e Fix for : procps states a bug is hit when receiving a signal (rhbz#871824, rhbz#441656)
Bug-Redhat: http://bugzilla.redhat.com/871824
Bug-Redhat: http://bugzilla.redhat.com/441656
2012-12-13 21:37:58 +11:00
Jaromir Capik
dfc671b4c3 Fixing negative ETIME field in ps (rhbz#871819, rhbz#433266) 2012-12-13 21:34:05 +11:00
Jim Warner
eeafd6cfe0 top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in
place, the lack of highlighting in task based searches
has grown from being only irritating to a real defect.

Thus, this commit introduces parallel functionality to
those searches initiated within a visible task window.
And just as separate inspect searches are possible for
each selection, per window task searches are provided.

However, it should be noted that there are differences
between task based searches and inspect type searches:

* There is no concept of out-of-view data when dealing
. with task rows -- if the data can't bee seen, it has
. not, in fact, been constructed from a proc_t struct.

* While inspect data is output at the character level,
. up to now all task display data was only potentially
. output and it was always based on a complete string.

* With task search highlighting, rows now containing a
. match must be output in pieces and, therefore, can't
. be optimized away like other rows which haven't been
. been altered. This is because top cannot predict the
. the contents of a search string or, how many matches
. might occur in a given row. Short search strings and
. many matches would raise buffer needs geometrically.

(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>
2012-12-11 22:54:25 +11:00
Jim Warner
2219c80514 top: refine inspect logic for already in-place matches
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-11 22:54:25 +11:00
Jim Warner
3b2b9a95e6 top: add inspect entry 'type' to alternate status line
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-11 22:54:25 +11:00
Jim Warner
8408a44e79 top: correct an inspect spelling error with nls impact
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-11 22:54:25 +11:00
Jim Warner
1623f1552d top: fix pid value displayed when kill default applies
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-11 22:54:24 +11:00
Jim Warner
5a0614e452 top: provide inspect selections with separate searches
This commit extends Inspect provisions for 'find/next'
to each individual selection. Thus a user can maintain
multiple active searches without having to reissue the
locate command whenever the current selection changes.

To emphasize this feature the View screen now displays
the current active locate string or 'N/A' if inactive.
Such a reminder is important when no found matches are
present on the 1st display page, given that they would
otherwise be apparent via the additional highlighting.

(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>
2012-12-10 09:29:28 +11:00
Jim Warner
5ff464bdb1 top: highlight all inspect search string(s) when found
We have modeled the Inspect search provisions on those
provided by the 'less' pager. With this commit we take
the next step and provide for highlighting any strings
matched (and in view). Of course, top will continue to
adjust the beginning column so as to bring out-of-view
matches into view, while highlighting visible matches.

However, top won't emulate every 'less' behavior since
the following are seen as flaws in the user interface.

* when viewing true binary data, less makes no attempt
. to smooth the right margin by truncating unprintable
. symbols, thus creatng ragged unappealing right edges

* when viewing true binary data, less will always fail
. search requests regardless of surrounding characters

* less refuses to bring out-of-view found matches into
. view by adjusting the left-most column, if necessary

(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>
2012-12-10 09:29:27 +11:00
Jim Warner
8292f7b8ec top: generalize handling of questionable rcfile issues
Previously top would warn users if an older version of
an rcfile was about to be overwritten. That's assuming
that RCFILE_NOERR was not defined. This left, however,
other potential rcfile issues or questions unattended.

For example, if a faulty 'inspect' redirected echo had
overwritten all window entries or if the inspect entry
was not 'pipe' or 'file' (actually, just a 'p' or 'f')
then top would silently accept it but look no further.

With this commit top will try to process every inspect
entry, while preserving unrecognized entries. Plus all
other non-fatal rcfile errors will now alert a user to
the potential overwrite when the 'W' command is given.

(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>
2012-12-10 09:29:27 +11:00
Jim Warner
a99f410d41 top: correct input anomaly if 'key repeat' is too fast
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-10 09:29:27 +11:00
Jim Warner
14170d0220 top: fix isolated inspect spelling error, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-10 09:29:27 +11:00
Jim Warner
3e7a70396c top: give inspect search algorithm a significant boost
The Inspect find algorithm has always been challenging
given the possibility that 'rows' might contain binary
data. Be that as it may, two small changes have proven
to dramatically improve the performance of such scans.

The first involves the case wherein if no match on the
'substring' portion of a row was found, then a pointer
representing the substring was increased by the length
of the search string, not the better/longer substring.
Thus, portions of the substring were always rescanned!

The second performance boost was achieved in this way:
pre-scanning each raw row for just the first character
in the search string now determines if a full match is
even possible. Therefore, repeated unproductive strstr
calls on individual substrings within that row will be
avoided. In a nutshell, 1 'if' with '}' did the trick!

(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>
2012-12-02 13:39:53 +11:00
Jim Warner
2db582e31e 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>
2012-12-02 13:39:52 +11:00
Jim Warner
d2c84c6e13 top: use the type size_t more consistently for inspect
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-02 13:39:52 +11:00
Jim Warner
705d1b28cd NEWS: updated with changes for the new release (3.3.6)
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:02 +11:00
Jim Warner
12c8d52057 top: add a flexible 'Inspect' capability, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:02 +11:00
Jim Warner
081fe506f3 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>
2012-11-27 22:08:02 +11:00
Jim Warner
9e99c84c48 top: kill/nice provide for a default pid, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:01 +11:00
Jim Warner
39f4067c66 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>
2012-11-27 22:08:01 +11:00
Jim Warner
4dfb01aa37 top: quiet lintian with escaped dashes in man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:00 +11:00
Jim Warner
44ceff845b top: include under nls support an overlooked error msg
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:00 +11:00
Lyonel Vincent
c29ce7be61 do not complain when negating selection if we can't find a user/group 2012-11-25 17:23:39 +01:00
Craig Small
ce95dd53eb 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>
2012-11-21 22:11:17 +11:00
Craig Small
c5ee091e4c Updated news for 3.3.5 2012-11-06 23:01:08 +11:00
Sami Kerola
4a6df5b133 ps: cut out code unused code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 22:30:02 +11:00
Sami Kerola
58713dbcc8 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>
2012-11-06 22:30:02 +11:00
Sami Kerola
ac97321851 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>
2012-11-06 22:30:02 +11:00
Sami Kerola
22ceeca4a6 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>
2012-11-06 22:30:01 +11:00
Sami Kerola
2c99a09e52 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>
2012-11-06 22:30:01 +11:00
Sami Kerola
c8554e6c0f 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>
2012-11-06 22:28:30 +11:00
Sami Kerola
9e3c259fae 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>
2012-11-06 22:28:30 +11:00
Sami Kerola
9ba7f3abdb 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>
2012-11-06 22:27:48 +11:00
Sami Kerola
e677476aea pmap: remove memory leaks
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 22:26:55 +11:00
Sami Kerola
c043c47ddd 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>
2012-11-06 22:22:11 +11:00
Craig Small
ee03bb92cb 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>
2012-10-31 22:47:48 +11:00
Mike Frysinger
a72fb6accf 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>
2012-10-31 22:42:03 +11:00
Craig Small
64fa889816 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
2012-10-30 21:48:34 +11:00
Craig Small
ff6c8aad3e Added debian patch for kfreebsd bug 674785 2012-10-30 21:36:04 +11:00
Craig Small
0c74162049 Bump the soname 2012-10-30 21:34:40 +11:00
Craig Small
f7eb5a49a0 w: do not truncate command when width is not known
Merge remote-tracking branch 'sami/2012wk28'
2012-10-26 19:06:16 +11:00
Jim Warner
99010db097 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 fbfaa868ba

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-26 18:58:42 +11:00