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>
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>
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>
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>
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>
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>
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>
./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>
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>
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>
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>
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>
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>
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>
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>
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 384afa494a
commit 47e1d063ac
Extensions to 'X' Command:
commit bbf8e44fb4
commit 7557f3f754
Signed-off-by: Jim Warner <james.warner@comcast.net>
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>
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>
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>
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(-)
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>
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>
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>
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>
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>
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>
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>
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>
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>