Commit Graph

2366 Commits

Author SHA1 Message Date
Craig Small
a7aaeaef65 sysctl: print dotted keys again
When the globbing update was put into sysctl, you could no longer
simply use the keys because one key could potentially be
multiple paths once the glob expansion occured.  Using the path
instead gave a unique output.

Except certain programs, such as salt, expected the output to use
the dotted path "kernel.hostname" and not "kernel/hostname".

We can no longer use the original key, so now for each path:
  Copy the path
  strip off /proc/
  convert all / to .

The sysctl testsuite was also updated to check for a few different
types of conversion failures.

References:
 commit 6389deca5b
 https://www.freelists.org/post/procps/some-procpsn4400-fixes,4
 https://repo.saltproject.io/

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2022-04-09 14:33:34 +10:00
Jim Warner
99fed92200 ps: that restored aix behavior is now even more robust
With the commit referenced below a nasty bug affecting
aix parsing was swatted. Beyond the bug, the logic was
enhanced to disallow commas in the format string since
they would otherwise be shown with their field's data.

However, there remained many characters other than ','
that could survive the edits to then be shown adjacent
to the data. Well, with this patch they won't anymore!

[ along the way we will no longer try to forgive the ]
[ use of a double '%%' prefix since that resulted in ]
[ display of one '%' and field code instead of data. ]

Reference(s):
. March, 2022 - restored aix bahavior
commit f0b7fd31db

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-09 13:00:59 +10:00
Jim Warner
f0b7fd31db ps: restore aix behavior while keeping an original fix
[ since our'master' branch will suffer the same fate ]
[ this was ported from a patch created for 'newlib'. ]

-------------------------- original newlib commit text
-------------------------- (showing our master commit)

The commit shown below broke the aix behavior that Dr.
Fink recently reported. However, in the proposed patch
the old behavior, showing garbage when '%cpu' was used
with an invalid formatting option, would appear again.

So this patch, based on Werner's patch, goes the extra
distance to prevent that. Along the way we'll disallow
commas in the aix format str to prevent their display.

Reference(s):
https://www.freelists.org/post/procps/Procpsng-400-released-with-newlib,2
. Mar, 2022 - where aix bug was introduced
commit 05187e4f17

Prototyped-by: Dr. Werner Fink <werner@suse.de>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-04-01 17:21:34 +11:00
Jim Warner
edc5efcac2 top: add another tiny bit of robustness to rcfile code
At this point I don't know if the Rc.id ever carried a
value of 'b', 'c', 'd' or 'e' in a public release. But
I do know that those values ought not to be recognized
in any configuration file. Now they won't be for sure.

[ while the absence of this new check didn't produce ]
[ an error message, it would skip the initialization ]
[ of default values plus possible string extensions. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-22 07:43:56 +11:00
Jim Warner
a03a09ae1e top: do not add an extra line when rcfile is rewritten
When the configuration file is first written, there is
just the normal single newline which ends that rcfile.

However, when any existing rcfile was rewritten, there
was one extra newline '\n' character added at the end.
This will happen just once. The file does NOT continue
to grow with the extra blank lines always being added.

Anyway, this patch will put an end to such a practice.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-22 07:43:56 +11:00
Jim Warner
8269e18b3f doc: document catch-up of new scalable 'STARTED' field
[ the original newlib commit message(s) appear below ]
[ but 'cpu utilization' was not implemented to avoid ]
[ any library modifications and thus version impact! ]

------------------------------------- newlib patch ---
doc: updated with new 'start time' & 'cpu utilization'

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-15 22:13:44 +11:00
Jim Warner
ed8dbd05e7 top: squashed catch-up of new scalable 'STARTED' field
[ the original newlib commit message(s) appear below ]
[ but 'cpu utilization' was not implemented to avoid ]
[ any library modifications and thus version impact! ]

--------------------------------- newlib patch #1 ---
top: added fields for 'start time' & 'cpu utilization'

This patch will exploit some new library capabilities.

[ one will raise eyebrows, the other likely will not ]

A new 'STARTED' field was added which shows the time a
process started after system boot. As such the largest
interval represents the most recently started process.

This is the field that will likely be questioned since
it's somewhat counterintuitive. But were we to instead
use TIME_ELAPSED, the value will change with every top
refresh. This will defeat any PUFF macro optimization.

The new '%CUU' field will probably be better received.
It represents the cpu usage over the life of the task.
When a process was showing high %CPU usage, this field
can be used to determine if it's an anomaly or normal.

[ and as with %CPU, %CUU shows a '?' when running in ]
[ a namespace when /proc was mounted with subset=pid ]

---------------------------------- newlib patch #2 ---
top: tweaked the recently introduced 'STARTED' support

When the 'STARTED' field was added, the width was made
the same as the 'TIME+' field. Thus, a full time could
be shown (which then included hundredths of a second).

That kind of granularity is totally unnecessary. After
all, this column is potentially confusing enough since
it is so counterintuitive. So, this commit will reduce
the width of the field with some help from scale_tics.

Henceforth it will not include those ol' centiseconds.

[ along the way let's expand the man document with a ]
[ a remainder about content representation & scaling ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-15 22:13:44 +11:00
Jim Warner
dd57e856d8 doc: document 'scale_tics' catch-up for Ctrl-E scaling
[ the original newlib commit message(s) appear below ]

------------------------------------- newlib patch ---
doc: document 'scale_tics' function for Ctrl-E scaling

[ i also tweaked that 'STARTED' narrative just a bit ]
[ since its original wording implied the value could ]
[ change, whereas it's fixed when a task is started. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-15 22:13:44 +11:00
Jim Warner
953016291a top: squashed 'scale_tics' catch-up for Ctrl-E scaling
[ the original newlib commit message(s) appear below ]

---------------------------------- newlib patch #1 ---
top: refactor 'scale_tics' function for better scaling

This patch refactors the 'scale_tics' function to more
closely parallel uptime shown on the first line of the
summary area. The old logic has been preserved through
the header file's new  #define SCALE_FORMER provision.

However, the former logic was actually a big disaster.
These are some potential problems with that old logic:

1. With respect to our time fields top no longer deals
solely with cpu time. So, the old limits of '68 weeks'
could possibly be insufficient to reflect those times.

2. Given the widths of top's new time fields, the code
never got beyond scaling to hours. For example, with a
ridiculously large span of 19 years, the scaled result
would then be shown as '167832h'. We never reached the
days ('6993d') or even the weeks ('999w') equivalents.

3. Similarly, with that 'TIME+' field and a large tics
value, results would then appear as 'MMMMMM:SS' rather
than the more meaningful 'HH:MM:SS' or days and hours.

So henceforth we will adopt these scaling conventions:

  MMM:SS.hh ... minutes:seconds.hundredths
  MMM:SS ...... minutes:seconds
  HH,MM ....... hours,minutes
  D+H ......... days+hours (with 'd' & 'h' suffixes)
  D ........... days (with 'd' suffix)
  W+D ......... weeks+days (with 'w' & 'd' suffixes)
  W ........... weeks (with 'w' suffix)

Note that, unlike our former scaling logic, that 'MMM'
portion won't be allowed to grow unconditionally. It's
limited (arbitrarily?) to 360 total minutes (6 hours).
Additionally, the 'HH' guy will be limited to 96 hours
(4 days) while that 'D' limit was set at 14 (2 weeks).

Whenever a limit is hit, scaling will advance a level.

---------------------------------- newlib patch #2 ---
top: extended 'scale_tics' function for Ctrl-E scaling

That normalization of the 'scale_tics' function in the
prior commit convinced me that I won't please everyone
with my arbitrary choices for the scaling transitions.

So, this patch will provide the users with a means for
setting their own scaling transition points with a new
toggle. Ctrl-E was chosen since the 'e/E' toggles were
already present as a means of scaling (albeit memory).

[ this toggle will also serve an educational purpose ]
[ by allowing one to see all the scaling conventions ]

The scaling a user establishes is saved in the rcfile.

---------------------------------- newlib patch #3 ---
top: enhanced 'scale_tics' function for Ctrl-E scaling

When scale_tics was refactored and then Ctrl-E support
added to top, the complete range of scaling values was
not visible. Namely, a single 'd' (days) & 'w' (weeks)
was never seen with ^E. With this commit they will be.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-15 22:13:44 +11:00
Jim Warner
05187e4f17 ps: swat insidious bug with the %cpu' format specifier
[ the original newlib commit message(s) appear below ]

----------------------------------------- newlib patch
ps: swat insidious bug with the %cpu' format specifier

Whoa, my head really hurts but this commit should help
with a speedy recovery hopefully, after it is applied.

If the '%cpu' field is used as a format specifier with
that 'o' option, you will encounter a SIGSEGV if there
is also an invalid argument on that same command line.

For example, try 'ps/pscommand -o %cpu,x' with newlib.
With any format specifier other than the '%cpu', there
is an error message, as would happen with '-o pcpu,x'.

For a 3.3.17 version of ps, there's no abend. Instead,
the program will just display a bunch of gobbledygook.
This boo-boo was found to exist as far back as v3.3.0.

[ ok, i am starting to feel very much better already ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-15 22:13:44 +11:00
Jim Warner
204194cdc4 top: trade that 'strncpy' for more efficient 'memccpy'
This patch was prompted by the merge request for pgrep
referenced below. In top's case, any performance gains
will be minimal since the now defunct strncpy was only
employed for termcap rebuilds after interacting with a
user (+ 1 other non-termcap related user interaction).

[ golly, strncpy always calls at least two functions ]
[ but usually calls a total of 3. on the other hand, ]
[ memccpy will only call a maximum of two functions. ]

And thanks to Baruch Siach for these strncpy insights.

Reference(s):
https://gitlab.com/procps-ng/procps/-/merge_requests/148

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-02-17 18:24:55 +11:00
Jim Warner
41b2b9dca8 top: let's eliminate some additional compiler warnings
This patch eliminates those warnings referenced below.

[ the last error shown needed a little extra cleanup ]
[ for when that '#define SCROLLVAR_NO' is activated. ]

Reference(s):
top.c: In function 'adj_geometry':
top.c:1976:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
 1976 |    if (Screen_cols < DOUBLE_limit) Curwin->rc.double_up = 0;
      |                    ^
top.c: In function 'zap_fieldstab':
top.c:2436:26: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 2436 |    if (wtab[EU_CPN].wmin < digits) {
      |                          ^
top.c:2442:26: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 2442 |    if (wtab[EU_NMA].wmin < digits) {
      |                          ^
top.c: In function 'keys_summary':
top.c:5382:45: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
 5382 |          if (w->rc.double_up && Screen_cols < DOUBLE_limit) {
      |                                             ^
top.c: In function 'task_show':
top.c:6306:13: error: expected ';' before 'else'
 6306 |             else
      |             ^~~~

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-02-17 18:24:55 +11:00
Jim Warner
081126f36f top: attempt to clarify the 'iokey' parameter meanings
The 'iokey' function's parameter 'action' was utilized
with literal numbers in the calling functions. So this
change will replace those literal numbers with #define
constants which, one hopes, will clarify their impact.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-02-17 18:24:55 +11:00
Jim Warner
101ca76786 top: tweak the heck out of some command line help text
This patch began as just an attempt to make any option
which also included an argument a little more readable
by adding one space before the '=ARGUMENT' convention.

[ by the way, i don't agree with most of those other ]
[ procps-ng programs that use an '<arg>' convention. ]
[ it's too easily misread as an 'optional' argument. ]

[ top uses a convention like that found in coreutils ]
[ albeit now with one extra space before the equals. ]

In adjusting those arguments it was apparent that many
explanations already lined up nicely at the right hand
margin. So, this commit will force right-justification
with all explanations (as we do with commit messages).

[ and as a final challenge, for those options taking ]
[ an argument, that argument was repeated within the ]
[ explanation and made the rightmost item on a line. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-02-01 16:11:55 +11:00
Jim Warner
5f19a76c2b top: eliminate the potential warnings '-Wsign-compare'
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-02-01 16:11:55 +11:00
Jim Warner
7ea6ba6d4d top: avoid a potential warning '-Wmaybe-uninitialized'
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-02-01 16:11:55 +11:00
Jim Warner
53147c9a80 top: avoid a possible warning '-Wimplicit-fallthrough'
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-02-01 16:11:55 +11:00
Jim Warner
292e831418 top: add visual clue when focus toggle ('F') is active
When in forest view mode, that focus toggle ('F') is a
useful tool occasionally. But, if a focused parent has
enough cloned siblings to exceed screen rows, it could
be hard to remember that such a toggle remains active.

So, this patch will provide a subtle visual clue added
to the leftmost position in the COMMAND column. Now if
the focus toggle was active, regardless of total tasks
affected, the users will always know when it's active.

Reference(s):
. 07/28/21, introduced new focus toggle ('F')
commit bdd50fa2fc
. 09/23/21, ensure focused tasks stay focused
commit d7e6c27a79

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:21 +11:00
Jim Warner
376d44d580 top: eliminate warnings for '-Wmisleading-indentation'
Reference(s):
. 01/08/22, newlib branch equivalent commit
commit 68995bee95d145f84c27849c47e4512da3f77a7e

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:21 +11:00
Jim Warner
169761e186 top: eliminate every warning for '-Wformat-truncation'
Reference(s):
. 01/08/22, newlib branch equivalent commit
commit f05c78d174d3383afc3f71956c23e3e1e75bb2ed

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:21 +11:00
Jim Warner
d23a920d76 top: repair several inconsistencies in email addresses
[ you wouldn't believe how many back-and-forths were ]
[ involved in Craig convincing me there were several ]
[ inconsistencies. i am so dense sometimes (often?). ]

Reference(s):
. 01/2022, newlib branch equivalent commits
commit 91ffe81734
commit c83cd6e6c0

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:21 +11:00
Jim Warner
1f30c205d7 top: bust up that overly large 'summary_show' function
Over the years the summary_show function has increased
from around 77 lines of code & comments to its current
size of 195 lines. This is well beyond an ideal length
of available screen rows. So this patch will split it.

We'll take the cpu and memory duties and make separate
functions out of them. Of course, this will incur some
additional call overhead but, given current cpu/memory
logic, any such increase really becomes insignificant.

Now summary_show's a svelte 31 lines of code/comments.

[ this is like what was done to that do_key function ]
[ a decade ago except overhead of new function calls ]
[ plus table lookup was even less of a concern since ]
[ a human was involved, not normal iterative output. ]

Reference(s):
. 01/03/22, newlib branch equivalent commit
commit cbff1d;d10645cb8c7fc55dda08b06fbafed05932

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:21 +11:00
Jim Warner
99ec6247ec top: provide for avoiding task focus ('F') distortions
In the patch referenced below the focus task logic was
improved to ensure that newly cloned tasks 'above' the
focused task did not force an effect like the up arrow
key. That commit also acknowledged that when some task
'above' ended, it *would* act like the down arrow key.

Well, with this commit a task ending 'above' a focused
task no longer distorts the focus. That's assuming the
new '#define FOCUS_HARD_Y' is specified plus the total
focused tasks does not exceed the current screen rows.

Thus, the manual scrolling with up and down arrow keys
is allowed when the total focused exceeds screen rows.

[ but keep in mind that when a focused task has been ]
[ hardened some otherwise useful toggles will not be ]
[ available. keystrokes like 'v' and even 'F' itself ]
[ can not be applied to another task with no scroll. ]

    Reference(s):
. 01/03/22, newlib branch equivalent commit
commit 0e744d3656
. 09/24/21, master branch 'focus' logic improved
commit d7e6c27a79

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:20 +11:00
Jim Warner
6ba099a4d6 top: update the man page & source file copyright dates
This just updates the copyright dates in the documents
within the top subdirectory only. Others are unchanged.

Reference(s):
. 01/01/22, newlib branch equivalent commit
commit afdd4690fc

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:20 +11:00
Jim Warner
9105ce0e6c top: justify those header #define description comments
This commit is an example of what can happen when this
author is waiting around for the release of our newlib
& otherwise runs out of legitimate changes to be made.

[ on the other hand, such changes surely make us run ]
[ quite a bit more efficiently, if i am not mistaken ]

Reference(s):
. 09/14/21, newlib branch equivalent commit
commit 6049c13b4d

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:20 +11:00
Jim Warner
4b54518721 top: enabled arbitrarily large numbers in 'scale' guys
While experimenting with a new feature, wherein select
fields display the total upon request, the capacity of
the 'num' passed to some 'scale' guys became an issue.

So this commit will, with the compiler's help, put the
responsibility for converting the integer into a float
within the calling code (instead of the called logic).

Reference(s):
. 03/08/21, newlib branch equivalent commit
commit 62928cf461

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:20 +11:00
Jim Warner
e03be322b5 top: a silly change forcing right margin justification
Reference(s):
. 01/11/21, newlib branch equivalent commit
commit 0cf6942be7

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:20 +11:00
Jim Warner
5ae84fac6e top: allow setting variable width col scroll (1 vs. 8)
The Inspection feature already offered an INSP_SLIDE_1
provision. This patch now offers similar extensions to
variable width column scrolling (assuming SCROLLVAR_NO
isn't defined). Such a provision was useful during the
development of some recent library UTF-8 enhancements.

Reference(s):
. 12/30/20, newlib branch equivalent commit
commit edce9ed612

Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-01-17 20:27:20 +11:00
Todd Lewis
401d587d2d fix uid/gid > 2^31 2021-10-25 19:38:10 -04:00
Tommi Rantala
23da4f40ea ps: ignore SIGURG
Stop registering signal handler for SIGURG, to avoid ps failure if
someone sends such signal. Without the signal handler, SIGURG will
just be ignored.

  Signal 23 (URG) caught by ps (3.3.16).
  ps:ps/display.c:66: please report this bug

https://man7.org/linux/man-pages/man7/signal.7.html
https://www.freebsd.org/cgi/man.cgi?sektion=3&query=signal
2021-10-13 20:47:44 +00:00
Craig Small
fc960774d5 testsuite: Make test program compile on Hurd
procps fails to build from source due to usage of field si_int of struct
siginfo_t in lib/test_process.c which does not exist on GNU/Hurd.

Thanks to Svante Signell for the patch.

References:
 https://bugs.debian.org/987557

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-10-13 07:59:04 +11:00
Jim Warner
aa3348db86 top: restore ending ']' when summary graphs are scaled
When a visual separator was added to 2 abreast summary
items in a recent commit, this bug was introduced. So,
from that earlier patch we'll revert one line of code.

The bug surfaced under an 80/even column terminal only
when that '4' toggle was off. With an an 81/odd column
screen, it existed in both single and 2 abreast modes.

[ this commit also goes the extra distance to ensure ]
[ two abreast mode maximizes available screen width. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-10-08 18:19:17 +11:00
Jim Warner
d7e6c27a79 top: ensure those potential focused tasks stay focused
When that 'F' focus command has been applied to a task
in forest view it should remain as the topmost process
in a particular window. But without this patch that is
not guaranteed. Newly forked/cloned tasks 'above' such
a process result in task(s) appearing which shouldn't.

The effect was as if that up arrow key scrolled beyond
the topmost parent task, which would never be allowed.

[ since scrolling is permitted within a focus range, ]
[ when any task 'above' our focus/topmost task ends, ]
[ we respond as if scrolled with the down arrow key. ]

[ that result is completely appropriate. if the user ]
[ wishes to return to a focused parent, the up arrow ]
[ or home key can be used to accomplish such a goal. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-10-02 13:01:15 +10:00
Craig Small
474847ed35 sysctl: Support systemd glob patterns
systemd-sysctl handles glob patterns along with overrides and
exceptions. Now the procps sysctl does it too.

The return value for sysctl is consistently either 0 or 1.

Added tests to check sysctl functions.

References:
 procps-ng/procps#191

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-09-13 22:07:37 +10:00
Jim Warner
271004bd0d top: some minor tweaks supporting long cmdline options
This darn patch began as 1 correction to an extraneous
comma in the man document. Then, it grew to include an
adjustment for a couple of additional man page things.

After that, I figured I might as well tighten up logic
dealing with those awful gaps in the getopt_long code.

[ the error_exit mentioned in the associated comment ]
[ will only be taken when '=' ends the argv vectors! ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-09-08 21:35:54 +10:00
Jim Warner
24bb9227ac NEWS: update to acknowledge top's long cmdline options
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-09-07 08:01:25 +10:00
Jim Warner
dbc6532128 top: update man document with new long cmdline options
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-09-07 08:01:25 +10:00
Jim Warner
016ddc6bff top: utilize getopt and introduce long cmdline options
For quite some time now, top has stood out like a sore
thumb regarding the approach to cmdline options & help
text.  Only short options were used and that same help
text was displayed for '-h' (help) plus 'v' (version).

[ also, top 'rolled his own' when it came to parsing ]
[ options while avoiding that getopt implementation. ]

Well, with this commit all of that has changed and top
now has added a long form of his options. Additionally
he employs getopt_long() for the bulk of that parsing.

[ however, top will still avoid separate fputs calls ]
[ characteristic of other procps-ng programs when it ]
[ comes to help. rather all such text is one string. ]

Along the way, the following major getopt deficiencies
were addressed, assuming the absence of a new #define:

* an equals sign ('=') is allowed on both option forms

* whitespace is allowed before & after the equals sign

* optional arguments needn't abut their related option
for short form nor is an '=' required with either form

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-09-07 08:01:25 +10:00
Jim Warner
43f1cc0dcf top: some minor organizational tweaks for man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-09-07 08:01:25 +10:00
Jim Warner
2480bc0221 top: and just eliminate a couple of unnecessary braces
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-24 20:53:27 +10:00
Jim Warner
2c3b251b11 top: reposition call to cpus_refresh() for consistency
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-24 20:53:27 +10:00
Jim Warner
97ef7fe504 top: corrected some more miscellaneous man page errata
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-24 20:53:27 +10:00
Jim Warner
3b69883c07 top: whack a label & branch in 'summary_show' function
Catch-up with newlib, original commit message follows:
------------------------------------------------------

If there are zero numa nodes then the View_CPUNOD flag
cannot possibly be set. So it was unnecessary to check
both the numa total and View_CPUNOD in 'summary_show'.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-24 20:53:27 +10:00
Jim Warner
7a30fd0f51 top: added a new #define to test absence of numa nodes
Catch-up with newlib, original commit message follows:
------------------------------------------------------

This new #define will produce top results identical to
the results achieved for './configure --disable-numa'.

However it keeps the change entirely local to our top.

[ it has been introduced to test the following patch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-24 20:53:27 +10:00
Jim Warner
6b4e4a006c top: man page reflects '-H' impact for '-p' provisions
Reference(s):
https://www.freelists.org/post/procps/important-extension-to-newlib,4

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-17 22:06:57 +10:00
Jim Warner
bddc9fb3e6 top: thread mode transitions should remove focus ('F')
The commit referenced below forced a return to row one
whenever there was a thread mode transition. Now, with
our new focus ('F') feature, we should adopt a similar
philosophy so as to avoid potential display anomalies.

Reference(s)
. Jun 2018, force row 1 w/ thread mode transition
commit 9dd7a97c4a

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-17 22:06:57 +10:00
Jim Warner
5e6b354a0c top: document summary area changes involving 2 abreast
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-06 20:19:18 +10:00
Jim Warner
8ef60b84af top: allow the summary memory lines to print 2 abreast
The commit shown below introduced two abreast printing
for %Cpu statistics. But, the Memory & Swap lines have
always been printed on separate lines when '4' was on.

With this commit, those lines will now be treated just
like %Cpu stats, either separate lines or two abreast.

Reference(s):
. May 2020, added '4' toggle for 2 abreast
commit fca48e7e99

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-06 20:19:18 +10:00
Jim Warner
c725207c44 top: add a visual separator to lines printed 2 abreast
When the '4' toggle is on, and Summary Area %Cpu lines
are shown two abreast, it's not always clear where the
separation is between the two processors. So with this
patch we'll now print a vertical bar separator between
them (looking similar to the existing field headings).

We will also reduce that 'GRAPH_suffix' constant to 1,
reflecting the the trailing ']' bracket only, so as to
maximize top's exploitation of available screen width.

[ plus a superfluous double '+ +' has now been fixed ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-06 20:19:18 +10:00
Jim Warner
d19ee838a6 top: new #define added for focus ('F') toggle tweaking
Just to see if I could, the new #define will force the
indentation of a parent task to be reset to zero while
maintaining the proper child indentation relationship.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-08-01 20:39:46 +10:00