Patch supplied by Kent R. Spillner <kspillner@acm.org>.
Previous watch -g would do the following:
unchanged screen (wait)
changed screen (wait)
(exit)
Now it exits right after the screen changes.
When top introduced true line input editing, the
ability to paste keystrokes was lost. This remains
a necessary evil so that top has an opportunity to
translate cursor motion keystrokes into terminfo
escapes during line input. Motion keys themselves,
of course, can never be pasted.
If pasting ever became more important than input
editing, then native termios support should have been
available via a define called TERMIOS_ONLY. But a
recent commit, eliminating what was thought to be
obsolete logic, rendered the alternate linein()
function virtually useless.
Similar to top-3.2.8, when native termios input is
functional, these abberations can be experienced:
. cursor motion keys will appear as escapes
. excessive input can cause line wraps
. ^Z during i/p is not be honored until <Enter>
. SIGWINCH during i/p corrupts screen temporarily
In hindsight, it now seems that the ability to paste
keystrokes may indeed outweigh any shortcomings of
native termios support. This is especially true if
one is preparing to search ('L') for some lengthy
process command line contined in the clipboard.
Thus, this patch fixes the alternate linein() function
and changes TERMIOS_ONLY to TERMIO_PROXY so that top
now defaults to using native termios input. In turn,
that will restore the paste keystrokes capability.
Reference(s):
commit: 045538e01b
Reported by: sergio <mailbox@sergio.spb.ru>
Bug-Debian: http://bugs.debian.org/663334
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit brings the few remaining occurances
of kB, etc. into line with the IEC binary naming
standard.
Comments containing any such references have been
left unchanged.
Reference(s):
commit 2fc3f15770
Signed-off-by: Jim Warner <james.warner@comcast.net>
When invoked with the --chgexit/-g options wait until we have at
least one screen of output before checking if the output changed.
Otherwise, we're comparing the initial screen of output to all
spaces, which usually isn't what we want.
Revert commit ffe5e0b08e. Restores
clean exit when falling through main loop.
Previously, watch only exited when there was an error or when
interrupted by the user. Commit 81f64657ba
added another exit condition when the watched command's output
changes, causing execution to fall out of the main loop.
With this change, watch correctly restores the terminal and returns
an exit code indicating success when invoked with the --chgexit/-g
options.
Admittedly, top referred to memory quantities in
a variety of non-standard ways. This commit brings
the program and supporting documentation into strict
compliance with IEC standard binary names.
According to wikipedia, as of 2012 this IEC standard
was still not in widespread use. However, I'm making
this change now for the anal-retentive among us.
Reference:
http://en.wikipedia.org/wiki/Megabyte
Reported by: Roman Mamedov <rm@romanrm.ru>
Bug-Debian: http://bugs.debian.org/662786
Signed-off-by: Jim Warner <james.warner@comcast.net>
Any key=value pair following the first one are dropped after
commit 81df8e2630, due to changing
from the while loop to using getopt.
Broken behavior:
sysctl net.ipv6.conf.tun0.optimistic_dad net.ipv6.conf.tun0.mc_forwarding
net.ipv6.conf.tun0.optimistic_dad = 0
Good behavior:
sysctl net.ipv6.conf.tun0.optimistic_dad net.ipv6.conf.tun0.mc_forwarding
net.ipv6.conf.tun0.optimistic_dad = 0
net.ipv6.conf.tun0.mc_forwarding = 0
Reference: http://www.freelists.org/post/procps/BUG-Commit-81df8e2-allows-only-one-keyvalue-arg
Reported-By: Sven Ulland <sveniu@opera.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
These per instance warnings have been eliminated:
warning: range expressions in switch statements are non-standard
warning: padding struct to align 'winflags'
warning: dereferencing type-punned pointer will break strict-aliasing rules
These per instance warnings have not been addressed
since they simply trade one warning for another:
From:
warning: ISO C does not permit named variadic macros
warning: ISO C does not support the '%Lu' gnu_scanf format
To:
warning: anonymous variadic macros were introduced in C99
warning: ISO C90 does not support the 'll' gnu_scanf length modifier
Lastly, since all C compilers have supported use of
C++ style comments for the past 20 years, the top
program will never trade them for the often more
cumbersome C style comments simply to avoid this
once per source file warning:
warning: C++ style comments are not allowed in ISO C90
Signed-off-by: Jim Warner <james.warner@comcast.net>
Fix to an edge case. When user defined begining of address range to
be at between two allocations the previous allocation which ended to
that address was included to printout. After this commit one will
see only allocations that are within range definition.
$ pmap -A00007f4e0df08000,00007f4e0df08000 895
895: bash
00007f4e0dd08000 2048K ----- /lib/libreadline.so.6.2
00007f4e0df08000 8K r---- /lib/libreadline.so.6.2
total 2056K
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Before this commit header and output was not in sync if
PROCPS_FROMLEN environment variable where defined. Example of wrong
behavior is below where the last four fields which are skewed.
$ PROCPS_FROMLEN=18 w -f | cat
12:31:34 up 1:25, 1 user, load average: 0.03, 0.06, 0.06
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
sake tty1 - 11:06 1:25m 3.76s 0.00s xinit /ho[...]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
There have been some internal changes to the library, so the revision
will be incremented for this release. There is no ABI or API changes
so its no real impact.
slabtop.c:273:29: warning: named variadic macros are a GNU extension [-pedantic,-Wvariadic-macros]
slabtop.c:299:9: warning: unused variable 'end' [-Wunused-variable]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The strtol_or_err() already check argument is not larger than
LONG_MAX. This commit also removes clang warning.
free.c:262:55: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
if (args.repeat_counter < 1 || args.repeat_counter > ULONG_MAX/2)
~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
common.h:23:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
global.c:499:3: warning: ISO C does not support the '%Ld' gnu_printf format [-Wformat]
output.c:134:1: warning: 'sr_cstime' defined but not used [-Wunused-function]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
output.c:816:3: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
pmap.c: In function 'discover_shm_minor':
pmap.c:87:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:87:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c: In function 'mapping_name':
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c:128:3: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
pmap.c: In function 'one_proc':
pmap.c:265:10: warning: ISO C does not support the '%Lx' gnu_scanf format [-Wformat]
pmap.c:265:10: warning: ISO C does not support the '%Lu' gnu_scanf format [-Wformat]
pmap.c:315:11: warning: ISO C does not support the '%Lx' gnu_printf format [-Wformat]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
w.c:409:2: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
w.c:325:42: warning: unused variable 'args' [-Wunused-variable]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
../include/c.h:106:18: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:107:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:108:25: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:109:26: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
pgrep.c:539:10: warning: unused variable 'buff' [-Wunused-variable]
pgrep.c:648:1: warning: "/*" within comment [-Wcomment]
pgrep.c:803:4: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long int' [-Wformat]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Conflicts:
pgrep.c
vmstat.c:408:10: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat]
vmstat.c:644:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:645:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:646:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:647:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:648:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:649:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:650:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
vmstat.c:651:2: warning: ISO C does not support the '%Lu' gnu_printf format [-Wformat]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Gitorious merge requests are too easy to miss for long time, and it
is difficult to think contributors would discuss by using web
interface. Therefore ask contributors to announce request to pull
(merge) in mail list.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Under openSUSE, old top uses additional fields for
out-of-memory reporting. As a result, under the
original approach to rcfile conversion, new top would
issue a fatal corrupt window entry message asking that
the rcfile be deleted.
This patch extends the conversion range to include
the extra openSUSE field characters. It's effective
when ./configure specifies the --enable-oomem option
which in turn defines OOMEM_ENABLE.
This commit also makes the conversion logic slightly
more forgiving. While enforcing an upper limit on the
expected number of old style field characters, amounts
less than that will be handled seemlessly.
Reference:
commit 4b98733132
Signed-off-by: Jim Warner <james.warner@comcast.net>
Both these are from [-Werror=format-security]
sig.c:262:5: error: format not a string literal and no format arguments
global.c:517:3: error: format not a string literal and no format arguments
Under certain circumstances, using abort() when either make check
or make distcheck puts ps into an infinite loop around the
function catastrophic_failure() in ps and the C library raise
and abort functions.
Using exit removes this problem and does almost the same thing.