Commit Graph

208 Commits

Author SHA1 Message Date
Jim Warner
33104a2bcc top: cursor repositioning includes line oriented input
A recent patch introduced the ability to recognize the
need to reposition the cursor at suspension or program
end. There remained unmet 1 additional potential need.

This commit extends that ability to embrace line input
so that if a user issues ^Z or ^C while being prompted
the resulting shell output will no longer be embedded.

Reference(s):
http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,7
commit 5c974ff44d

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-07-02 14:49:46 +02:00
Jim Warner
25ed080eaa top: refine some miscellaneous signals interrupt stuff
This commit mostly justs renames a few identifiers but
it also will now suppress any end-of-job report if top
wasn't ended via the 'q' key convention (i.e. signal).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-07-02 14:49:46 +02:00
Jim Warner
5c974ff44d top: enable screen contents preservation at end-of-job
The title of this commit is actually quite misleading.

Were it more accurate, it would at least mention a tty
emulator's scrollback buffer, which was the cumulation
of a long pursuit to reduce the SIGWINCH overhead when
a window manager carelessly floods an application with
that signal *while* a user is still resizing a window!

Disabling and enabling that scrollback buffer resulted
in the final top display replaced with original screen
contents, a phenomenon acknowledged at the time but it
also represented a user interface change which has now
produced the first request for return to old behavior.

After the SIGWINCH dust settled, another problem arose
regarding behaviors under the 'screen' window manager.
In response, top was refactored a bit to avoid display
corruption. That was before discovering 'screen' could
duplicate the scrollback buffer behavior top expected.

As it turns out, the 'screen' refactoring had probably
made scrollback buffer manipulation unnecessary. Still
one could argue that a window should not be allowed to
scroll while a constantly updating program was active.

The solution represented in this commit returns former
behavior at program end (retaining top's last screen).
And if we ever wish to disable scrollback buffers, the
associated logic was retained but made conditional. It
is not reflected in configure.ac but might be someday.

Lastly, this commit corrects cursor positioning when a
^C is issued under 'Fields Management' at any terminal
that didn't have a scrollback buffer (i.e. a console).

Reference(s):
https://bugzilla.redhat.com/show_bug.cgi?id=977561
http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,1
. screen program refactor
commit 0fe393ff27
. scrollback buffer disabled
commit dedaf6e1a8
. sigwinch management defines
commit adca737758
commit 4f33b6b8c5

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-07-01 19:10:57 +02:00
Jim Warner
b79b927f97 top: trade two groff_mdoc macros for groff equivalents
The .Bd and .Ed macros, from the mdoc collection, have
caused a few raised eyebrows (lintian, doclifter, etc)
in the past. With this commit, we will trade their use
for the standard existing groff .nf & .fi equivalents.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-06-26 17:58:56 +02:00
Jim Warner
b55f9b97db top: add the major version to dlopen of libnuma soname
When the plug-in approach to NUMA support was added, I
carelessly employed the compile-time linker convention
for naming the library. Technically this then required
the 'devel' package for NUMA support to be present for
the unqualified soname symlink to be available. Either
that or one must have manually created such a symlink.

This commit adds the missing major version to dlopen()
of libnuma.so.1 so simply having a more likely package
such as 'numactl' will enable both '2' & '3' commands.

References(s):
http://www.freelists.org/post/procps/top-NUMA-node-CPU-utilization-support,25
. initial dlopen support
commit edba932a7e

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-06-10 15:43:12 +10:00
Craig Small
4d35bbb36d Merge branch 'master' of gitorious.org:procps/procps 2013-05-23 21:54:33 +10:00
Jim Warner
2876e074c0 top: change man document license used from GFDL to GPL
This patch brings the man document into agreement with
Debian's current licensing standards. The 3 urls below
discuss their concerns over the GFDL and also document
quite a few additional packages with similar licenses.

( jeeze, 12+ friggin' years & finally someone grep'd )
( for what was just a couple of 'invariant' sections )

Reference(s):
. why gfdl is unsuitable
http://www.debian.org/vote/2006/vote_001
. draft position statement
http://people.debian.org/~srivasta/Position_Statement.xhtml
. busted by lintian
http://lintian.debian.org/tags/license-problem-gfdl-invariants.html

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-23 21:53:36 +10:00
Jim Warner
0fe393ff27 top: inoculated against a window manager like 'screen'
If top were invoked under the 'screen' window manager,
writing the terminfo string 'exit_ca_mode' at top exit
would not restore the display to the state existing at
the time top was started. That's what occurs normally.
The net result of that failure was a corrupted screen.

However, there is a 'screen' configuration option that
will produce proper 'rmcup' behavior, but it is off by
default. That screencr option is known as 'altscreen'.
I stumbled across this provision by cloning the screen
git repository then searching for references to 'cup'.

If 'altscreen on' had been in either the /etc/screenrc
or the $HOME/.screenrc configuration file, my poor old
top would never have been accused of such corruptions.
Of course, the Programming Gods decree that any simple
solution for our problem must always be revealed last.

So before discovering that rc option, another approach
was taken involving top only. With just a little extra
refactoring of top display logic he was made immune to
any such quirk in the implementation of 'smcup/rmcup'.

I always feel good about any enhancement that actually
reduces the total number of lines of code. Even though
this change involved mostly rearranging some logic, it
yielded one less line (can't judge by diffstat because
of braces & notes). Anyway, rather than requiring some
change to a screenrc file, now we are self-sufficient.

Reference(s):
  procps ---------------------------------------------
https://bugzilla.redhat.com/show_bug.cgi?id=962022
http://www.freelists.org/post/procps/top-procpsng337-no-screen-cleaning-at-exit,3
. top : disable tty scrollback buffer to improve SIGWINCH
commit dedaf6e1a8
  screen ---------------------------------------------
git://git.sv.gnu.org/screen.git
. Improve cursor store/restore on smcup/rmcup.
commit f95352946080be803b794c9f2733d8c809c1a39a
. Fix using alternate screen buffers in some cases.
commit ad56f746c6243d45124485d198d577bdbb78071c
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=558724

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-22 14:55:40 +02:00
Jim Warner
2ede50902f top: provide a build option to change memory precision
When summary & task area memory scaling was introduced
in release 3.3.6, the memory field widths were widened
slightly so unscaled KiB values could be provided more
consistently and scaled values (beyond MiB) could show
3 decimal places of precision. However, some users may
prefer the former widths/precisions for memory fields.

This commit will provide a build time configure option
to return top to those former defaults as a compliment
to a new %CPU & %MEM field precision configure option.

Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707648
commit 21e550bc08

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-19 09:40:42 +10:00
Jim Warner
77abe18d01 top: revert %CPU and %MEM precision to former defaults
When summary & task area memory scaling was introduced
in release 3.3.6, the percentage columns were expanded
to provide 3 decimal places of precision. In hindsight
that may have been overkill, making those columns more
of a distraction than useful, with just too much info.

This patch will revert those columns to the former one
decimal place. And as was true, that decimal point may
be sacrificed depending on the number of cpus present.

And, in case anyone might prefer additional precision,
a build option can provide it (--enable-wide-percent).

Reference(s):
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=707648
http://www.freelists.org/post/procps/What-happened-to-my-top,1
commit 21e550bc08

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-19 09:40:42 +10:00
Jim Warner
3993fb0c8e top: eliminate troublesome apostrophes in man document
Some versions of man have had trouble with the leading
apostrophe employed with interactive commands/toggles.
Instead, a '?' would be displayed in their place. With
this patch all such conventions have now been removed.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-19 09:40:41 +10:00
Jim Warner
ae102f359f top: reduce function call overhead in the NUMA support
Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-19 09:40:41 +10:00
Jim Warner
25201bc9fe build-sys: allow a build when libdl.so is truly absent
The earlier commit purporting to allow top to be built
in the absence of that dynamic linking library stopped
just a little short of the truth. So this will fix it.

Reference(s):
commit 5686877cd4

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-11 08:23:52 +10:00
Jim Warner
edba932a7e top: introduce a plug-in approach for the NUMA support
The NUMA/Nodes support in top has gone through several
evolutions (primarily dealing with build-sys options).
With this commit the library dependency issues are now
moot and the responsibilities for run-time loading and
dynamic linking are assumed by the top program itself.

Henceforth, if top is executed in an environment where
libnuma.so is present, top will offer such extensions.
Even more importantly, when a missing libnuma is later
installed, top will offer numa support auto-magically.
All NUMA/Node build-sys dependencies are thus removed.

The former NUMA_ENABLED define has become NUMA_DISABLE
should anyone wish to test user interface implications
in an environment that *does* have libnuma. It is also
represented as the ./configure option: --disable-numa.

Lastly, the 't' (View_STATES) toggle will be forced on
for sanity whenever the '1', '2' or '3' keys are used.

Reference(s):
. original idea from: Dr. Fink <werner@suse.de>
http://www.freelists.org/post/procps/top-NUMA-node-CPU-utilization-support,18
. original numa suppoort
commit 8d989c68c0

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-05 09:12:08 +10:00
Jim Warner
5686877cd4 build-sys: eliminate dependencies for the NUMA support
Oh that poor ol' build system. With this patch it will
have gone through three separate incarnations in terms
of NUMA/Node support. Those 3 iterations consisted of:

1. A 'porridge too hot' where the top numa support was
enabled if it was built in the presence of libnuma and
the numa.h header. But if the numa library wasn't part
of core packages, that would have broken poor old top.

2. A 'porridge too cold' where numa support was off by
default and must have been explicitly enabled when the
./configure script was run. This could have meant that
distros might not distribute a numa-aware procps, even
though their numa library would have been distributed.

3. And this 'porridge' where the top numa support will
become a 'plug-in' feature activated when the presence
of libnuma.so can be verified at runtime. We'll do our
own loading and symbol resolution (with some help from
dlopen in libdl). Thus maintainers' responsibility for
enabling numa support and then satisfying that library
dependency is now an entirely optional --disable-numa.

As Goldilocks might say about our current configure.ac
"Ummm, I think this porridge tastes just about right".

Reference(s):
. 1) too-hot
commit 87ac6383bb
. 2) too-cold
commit 53fd7dd1ed
. original idea from: Dr. Fink <werner@suse.de>
http://www.freelists.org/post/procps/top-NUMA-node-CPU-utilization-support,18

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-05-05 09:12:07 +10:00
Jim Warner
d16fd8e462 top: snapshot /proc/stat reads to minimize distortions
Almost forever, top has been accessing the /proc/stat/
directory one line at a time until either smp_num_cpus
was reached or (more recently) Screen_rows is reached.

When NUMA/Nodes support is enabled screen rows will no
longer serve as a limit because all cpus must be read.

With this commit, the entire /proc/stat/ directory can
be read at once so all statistics will be frozen. Thus
individual cpus will no longer keep "ticing" until top
gets around to accessing them via some separate fgets.

The distortion this commit eliminates was quite easily
seen when comparing old/new tops using: individual cpu
stats vs. cpu summary; a healthy delay interval of 3-5
seconds; manually synchronized update cycles (the hard
part); some system loading (maybe another top at -d0).

Additionally, this patch eliminates some long standing
unnecessary initialization made possible because of an
allocation via calloc. If some parts are never touched
by sscanf due to a kernel version, it's unnecessary to
repeatedly re-initialize those portions to zero again.

Reference(s):
. numa extensions added
commit 8d989c68c0
. useless initialization evolution (old to new)
commit e54c8239b1
commit 9278134e49
commit fd62123562
commit f348575edc

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-04-24 08:29:22 +10:00
Jim Warner
3ac09447e5 top: change number of emulated cpus from four to eight
With the addition of NUMA/Node support and the ability
to emulate such support even in the absence of libnuma
and numa.h, the maximum number of cpus top can emulate
was increased to make numa emulation more interesting.

( whew, that's an awful lot of "emulates", me thinks )

Reference(s):
commit 8d989c68c0

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-04-24 08:29:21 +10:00
Lance Shelton
8d989c68c0 top: program code changes, enable NUMA/Node extensions
This commit extends the top Summary Area cpu states to
include information on Non-Uniform Memory Architecture
nodes. It is based upon changes originally proposed by
Lance Shelton who was instrumental in the final patch.

With this change, the user will have new commands that
will provide alternatives to the individual cpu stats:

. '2' toggles between cpu & numa node summary displays
. '3' provides node summary and related cpu statistics

These extensions required some minimal system support.
Typically, the numactl package (and maybe libnuma-dev)
are all that's needed to show a single node which owns
all the processors. Failing that, or for slightly more
variety, top also offers a #define named PRETEND_NUMA.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Lance Shelton <LShelton@fusionio.com>
2013-04-14 22:21:42 +10:00
Jim Warner
c2afde130e top: documentation update, enable NUMA/Node extensions
This commit provides the NEWS and man document changes
supporting the new NUMA/Node top program enhancements.

For providing the initial impetus for this enhancement
I wish to thank Lance Shelton <LShelton@fusionio.com>.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Lance Shelton <LShelton@fusionio.com>
2013-04-14 22:21:41 +10:00
Jim Warner
87ac6383bb build-sys: in top program, enable NUMA/Node extensions
This patch provides the build system support for those
top extensions dealing with the NUMA summary displays.

For providing the initial impetus for this enhancement
I wish to thank Lance Shelton <LShelton@fusionio.com>.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Lance Shelton <LShelton@fusionio.com>
2013-04-14 22:21:41 +10:00
Jim Warner
4aa917455c top: fix the bug affecting certain Find/Locate results
When 'Other Filtering' was introduced the idea of what
constituted a displayed row changed. No longer was any
call to task_show assured of consuming one screen row.
Now the determining factor was whether or not the rows
were empty. This worked Ok until a certain Find string
was active then the entire display could be corrupted.

With Find active, the task_show() function alters each
returned row while highlighting each visible match. If
the search was on a single byte value & matched at the
beginning of a row the match got overwritten with '\0'
which then appears empty upon return to window_show().
So that row would not be counted as having been shown.

This was best illustrated with a Find on a single ' '.

This patch will restore proper 'Find/Locate' behavior.

Reference(s):
commit 5edc6fb317

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-26 20:35:53 +11:00
Jim Warner
a6c5e31022 top: tweak 'Inspect' code for isolated edge situations
If the 'Inspect' feature was used to view a file which
contained binary (unprintable) data, and when the last
line for such a file was purely unprintable, then that
line length would be overstated by the terminal width.

This was also the occasion where valgrind might object
over potential reference to some unitialized value(s).
It was a harmless situation and somewhat rare to begin
with. Anyway this commit will eliminate the potential.

Additionally, supporting readfile logic was simplified
and the 'status line' bytes read is now more accurate.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-23 16:00:02 +01:00
Jim Warner
10936365de top: touch up a few miscellaneous nls related comments
Some recent nls work on that pmap program necessitated
a return to nls translation file creation for testing.

As it turns out, my skills used in pseudo-translations
had become rusty and some newer LC_MESSAGE directories
may have been introduced since last needing the topic.

This patch just updates some programmer notes to agree
with this most recent effort and for future reference!

Reference(s):
. pmap nls support
commit 0c0c543466

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-23 13:01:16 +01:00
Jim Warner
7b708ca334 top: rename a single Other Filter variable for clarity
There is a member of the osel_s structure called 'flg'
that is used to reflect whether a particular filter is
one of inclusion or exclusion (negation). So by golly,
from now on we'll refer to it as 'inc', and not 'flg'!

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-14 12:36:47 +01:00
Jim Warner
d7f3a80e18 top: improve man doc Section 5e, FILTERING in a window
This commit involves very little content change and is
more concerned with better formatting for readability.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-14 12:36:47 +01:00
Jim Warner
2872d24362 top: correct a sightly obsolete nls 'Translation Hint'
When the command line sort override provisions (-o/-O)
were added, the usage text was modified to keep within
an 80 column terminal but the nls hint didn't keep up.

Reference(s):
commit 407d1fc8f2

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-14 12:36:47 +01:00
Jim Warner
1a50f39971 top: fine tune (ie. fix) 'other filter' negation logic
Two too many of these '=' (cooks) spoiled top's broth.

There exists an unintentional variation on the classic
error: off-by-one. When a negation symbol is used with
top's new relational 'other filter' provision, one too
many 'matches' are excluded. This happened because top
covered only 2 of the 3 potential strcmp return codes.
When the strings were equal, they were simply dropped.

So this patch will uninvent that particular variation!

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 2c2c5f5cd2

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-07 17:55:20 +01:00
Jim Warner
ef99eebbdb top: introduce relational operators, plus man document
References:
http://www.freelists.org/post/procps/top-beyond-infinity,1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-06 14:37:41 +01:00
Jim Warner
2c2c5f5cd2 top: introduce relational operators with other filters
When I originally entertained thoughts of maybe adding
relational operators to the new 'Other Filter' feature
the programming challenges seemed just too great. Yet,
when Jaromir suggests its desirability it now suddenly
becomes a reality. Another of life's little mysteries!

At any rate what was already an extremely powerful new
feature is even better by several orders of magnitude!

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

References:
http://www.freelists.org/post/procps/top-beyond-infinity,1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-06 14:37:40 +01:00
Jim Warner
f9a208b273 top: enable other filtering, add documentation support
This commit provides the hard copy support for our new
'Other Filter' feature. The man document contains some
potentially useful examples and it will be interesting
to see what use this new tool is put to in the future.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-04 18:46:37 +01:00
Jim Warner
5edc6fb317 top: enable other filtering via inclusion or exclusion
This change represents the extension of user filtering
based on inclusion or exclusion. However where 'U'/'u'
filtering provides an either/or choice, this extension
offers multiple choices applicable to multiple fields.

The 'inclusion' and 'exclusion' criteria can be freely
combined making a powerful tool to fine tune a display
and avoid clutter associated with uninteresting tasks.

I'm convinced it offers unimagined future flexibility!

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
http://www.freelists.org/post/procps/top-over-the-top,22
http://www.freelists.org/post/procps/top-over-the-top,8

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-04 18:46:34 +01:00
Jim Warner
5e4bade595 top: minor refactor in preparation for other filtering
While it's only documented (so far) in commit text and
an occasional email I've tried to maintain some coding
standards primarily for reference/navigation purposes.
They also served, I felt, as useful mental challenges.

Someday I will get around to formerly documenting them
but in the meantime here are the ones for this commit:

. functions are grouped into logical (i hope) sections
. functions & sections are ordered to avoid prototypes
. function names are alphabetical within every section

Thus, given those constraints/objectives, and in order
to prepare for an upcoming Other_Filter feature, a few
things had to be renamed and rearranged. Plus a couple
of other (unrelated) tweaks were made for consistency.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 270e8e7eeb
http://www.freelists.org/post/procps/PATCH-12-top-restore-terminal-state-on-exit,4

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-04 18:46:31 +01:00
Jim Warner
b9976f7056 top: finish the job of correcting the response to a ^Z
if top is suspended while on the 2nd level help screen
the <Enter> key is no longer honored. Thus, users must
use <Esc> to exit help and return to the main display.

Also, line input that was only partially complete when
suspended would still require one additional keystroke
before the read was aborted and the display refreshed.

Lastly, some user interactions might require two input
lines before an operation can be considered completed.
Thus the 2nd line offers another opportunity for users
to suspend top. Resumption would require an extra key.

These issues stem from 2 recent enhancements: preserve
the user context when signaled; complete input editing
with cursor movement keys, insert/overtype modes, etc.

With this patch, the <Enter> key is once again honored
on help screen #2 and partial reads are now completed.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
       bug reported
http://www.freelists.org/post/procps/top-over-the-top,25
       response to ^Z (partial solution)
commit 5c3fffcf28
       line input editing
commit 477b10c0bd
       preserve context with SIGWINCH
commit ba9092ad83

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-01 14:25:35 +01:00
Jim Warner
709785e20b top: add the field 'USED' to top's existing repertoire
After revisiting the issue of a new field, combining 2
existing fields (RES and SWAP), I've decided it indeed
makes sense. After all, with the vastly expanded field
capability and the ease of adding new fields, it would
save some precious horizontal screen real estate while
also eliminating some mental/manual user calculations.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

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

Signed-off-by: Jim Warner <james.warner@comcast.net>

 top/top.1     |   23 ++++++++++++++---------
 top/top.c     |   14 ++++++++++++--
 top/top.h     |    6 ++++++
 top/top_nls.c |    3 +++
 4 files changed, 35 insertions(+), 11 deletions(-)
2013-03-01 14:25:31 +01:00
Jim Warner
9dd7251ca3 top: consolidate logic dealing with resetting a window
This commit just gathers all the logic associated with
resetting/normalizing a single window in one function.

In the future, should the window structure be expanded
to support added functionality, the act of maintaining
it will have been made a little bit easier, hopefully.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-01 14:25:28 +01:00
Jim Warner
a458871cde top: make user's choice for insert/overtype persistent
When true line input editing with paste capability was
was re-introduced in the commit below, the concept for
the distinct insert/overtype mode was also introduced.
But such a distinction did not survive an <Enter> key.

With this commit, the cursor state is made persistent.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 477b10c0bd

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-01 14:25:22 +01:00
Jim Warner
6d0765a03c top: allow no input with the maximum task ('n') prompt
When both 'kill' and 'renice' commands were changed to
provide a default pid, the 'n' command (maximum tasks)
should have also changed to continue to accept just an
<Enter> key under the get_int function's new protocol.

This patch corrects that behavior, accepting no input.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 39f4067c66

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-01 14:25:15 +01:00
Jim Warner
5ee1286625 top: allow re-ordering of saved line input upon recall
The original implementation of input line recall keeps
strings in the order established when initially added.
With this commit, that has been changed so any matched
string moves to the top of the saved input line stack.

[ well technically not the top since that's occupied ]
[ by an 'empty' string which serves multiple masters ]

Thus, the most frequently referenced strings over time
will percolate up and remain the most easily recalled.
But just in case anybody prefers the strict historical
ordering, a #define can restore the original behavior.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 2efe275512

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-27 17:03:54 +01:00
Jim Warner
5c3fffcf28 top: improve the response to ^Z if awaiting line input
Now that line input offers users full editing freedom,
if top were to be suspended after issuing a prompt for
input, upon resumption an extra keystroke is necessary
to satisfy the outstanding read & refresh the display.

With this patch that extra keystroke is not necessary.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 477b10c0bd

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-27 17:03:51 +01:00
Jim Warner
d497b1025a top: some idiot broke 'idle' mode with u/U 'exclusion'
This patch fixes the single stinkin' source line which
was responsible for breaking the top idle-mode toggle.

Without this change, either 'u' or 'U' must be invoked
just once before the 'i' command would show something.

(yes, everything's perfectly justified once again but)
(i'm not very happy over the need for this damn patch)

Reference(s):
commit d04297843f

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-27 17:03:49 +01:00
Jim Warner
2efe275512 top: enable recall of previous input lines for re-edit
With this commit, users can now retrieve previous line
input for re-editing and/or re-input using the Up/Down
arrow keys (or their aliases). This mirrors the 'bash'
or 'less' interface and represents a major enhancement
achieved via a somewhat minor impact to our code base.

[ 33 lines of code, 5 closing braces & some comments ]
[ all in 1 function, when TERMIOS_ONLY isn't defined ]

Currently, the upper limit for such recallable strings
has been set at 50 but that could be easily increased.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:45 +11:00
Jim Warner
477b10c0bd top: enable true line input editing with paste support
This patch changes the TERMIO_PROXY define back to the
former TERMIOS_ONLY thus changing the top default too.

Plus we can now use true line input editing while also
retaining paste capability. That former native termios
support provided only a limited destructive backspace.

Now we exploit the Left/Right arrow keys, Home/End and
Delete. Plus, the Insert key can toggle overtype mode!

[ The stage is now set for a really huge improvement ]
[ to any user input terminated with the <Enter> key. ]
[ So please stay tuned for the next patch to arrive! ]

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit fa21a6ca81

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:45 +11:00
Jim Warner
d04297843f top: enable user filtering via inclusion and exclusion
With this commit top can now display users which match
a user id/name or just those users which do not match.

The distinction is based on the presence or absence of
a leading exclamation point '!' (C negation operator).

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
Wishlist, http://bugs.debian.org/682086

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:45 +11:00
Jim Warner
c856a80ad5 top: end reliance on strdup not failing & roll our own
Lately, top has begun to rely more and more on dynamic
memory allocations rather than the static buffers that
were found in many of its structures. This was perhaps
most evident in the increasing use of the strdup call.

This commit trades that function call for the internal
equivalent which will protect us from malloc failures.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:44 +11:00
Jim Warner
44e61f0f6d top: man document now properly reflects delay interval
This commit corrects one reference to 'decimal place'.

Even though a running top supports a delay interval of
unlimited precision, and a delay interval of thousands
of a second in the rcfile, we intentionally imply that
any delay interval is limited to tenths of a sec only.

Later in the man document, in section 7a, one finds an
admission that a user can set any desired delay value.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
http://www.freelists.org/post/procps/tt,4

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:44 +11:00
Jim Warner
bc5af4ae51 top: keep cursor hidden after Inspect 'Locate' request
A recent commit, that was intended to normalize cursor
handling, unintentionally exposed the cursor following
an Inspect 'Locate' request. This change will hide the
cursor once again through inst_view_choice's lifetime.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit f3a87cf634

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:44 +11:00
Jim Warner
e2c2bc5a95 top: the third time was charmed for end-of-job reports
When top was changed to allow some core dumps, the two
potential end-of-job reports were disabled by mistake.
Later, that was corrected so that those reports always
were allowed, if the respective #defines were enabled.

However, if there was an early exit via a command line
option or an error, those reports should not be shown.

This commit may have gotten it right on our third try!

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 1da293bf59
commit d747659ad8

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:44 +11:00
Jim Warner
ca76af22ca top: lift the field management 6 col width restriction
When two somewhat cryptic error messages were recently
changed to more user friendly text, the logic limiting
maximum columns was left unchanged at six. This always
was a rather arbitrary limit but now the revised error
message could actually be misleading (ok, a huge lie).

With a 1 line code change (macro actually), this patch
lifts the internal restriction on maximum columns. Now
the real limit is based on a window's physical x-axis.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
commit 5a27c8095e
http://www.freelists.org/post/procps/top-won-the-sigwinch-war,6

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-05 22:11:22 +11:00
Jim Warner
dedaf6e1a8 top: disable tty scrollback buffer to improve SIGWINCH
A scrollback buffer used in several terminal emulators
could be a real inconvenience to a user following some
resize operations. Extra keystroke(s) would frequently
be required in order to properly render top's display.

After much sleuthing we unearthed two terminfo strings
which have the effect of disabling/restoring that darn
scrollback buffer. They were well hidden under a title
of strings 'to start/end programs using cup'. In turn,
'cup' deals with a tty's cursor addressing capability.

We don't care what you call them or what they refer to
so long as they get the job done. And these really do!
Be advised, however, that there are some side effects,
several of which can even be considered as beneficial:

. enter_ca_mode/smcup/ti disables scrollback buffering
( and that's good, it's what we had always hoped for )

. exit_ca_mode/rmcup/te restores the scrollback buffer
( but also restores screen contents existing pre-top )
( which is different from former program end results )
( where that last rendered screen was left untouched )

. the above screen replacement would impact ^Z suspend
( thus we keep the scrollback buffer disabled during )
( the suspend/resume sequence so that the users will )
( have a visual clue that top is suspended not ended )

If a terminal does not support these terminfo strings,
we will revert to top's former behavior at program end
where we position the cursor at screen bottom and then
output a single newline character. This will prevent a
shell prompt from embedding within top's final screen.

This commit's approach has been tested under a variety
of emulators and window managers, many of which linked
with libvte and others that employed their own scheme.
Examples are: gnome_terminal; kde konsole; lxterminal;
terminator; terminology; urxvt; xfce4-terminal; xterm.

I do now believe that the whole SIGWINCH deal is done!

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
http://www.freelists.org/post/procps/top-won-the-sigwinch-war
http://www.freelists.org/post/procps/top-won-the-sigwinch-war,4

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-05 22:11:22 +11:00
Jim Warner
5a27c8095e top: make field management window size error non-fatal
Reference(s):
http://www.freelists.org/post/procps/top-won-the-sigwinch-war,3

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-01-30 10:53:49 +11:00