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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Sometimes, it might be useful to isolate a parent task
and its forked children from other system activity. As
an example, a user might want to examine workload in a
specific lxc container. Or maybe there is some need to
question what's happening under the same tmux session.
Since forest view mode tends to be a relatively stable
display, it will sometimes satisfy the above need. But
that mode can't currently guarantee the target process
always remains as the topmost task or even is visible.
So, this patch will enable focusing on any parent task
and keeping it as the topmost process while displaying
it and its forked children only. It then appears as if
there is no other activity in that system by virtue of
the blank lines which follow that final child process.
To implement this new feature, top's redundant 'F' key
has been repurposed. It made little sense devoting two
keys to the Fields Management screen (especially since
the key we've taken required two separate keystrokes).
[ and while we're at it, i also added punctuation to ]
[ that prologue for 'forest_display' since all other ]
[ forest functions used punctuation. And, instead of ]
[ a pointer to a proc_t he will now get a ppt index. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
In the merge request shown below, 1 too many bytes are
written to stdout thus including the terminating null.
As the cure, this commit just reduces the length by 1.
[ along the way, we will remove some unneeded braces ]
[ plus add some additional comments with attribution ]
Reference(s):
https://gitlab.com/procps-ng/procps/-/merge_requests/127
. original merged change
commit 0bf15c004d
Signed-off-by: Jim Warner <james.warner@comcast.net>
In the patch referenced below, 2 potential abends were
fixed both of which involved 'alternate display mode'.
The root cause of those abends was a negative value in
the 'begnext' field for other than the current window.
And while that potential is fixed for now the existing
code almost invites such problems again in the future.
So, this patch will remove any temptation to name some
other window in the 'mkVIZrow1' macro. And, since that
macro is not the only source of 'begnext' changes, the
'mkVizrowX' is being added to identify such occasions.
[ and for symmetry i've added a 'mkVIZyes' macro and ]
[ ameliorated an otherwise surreptitious assignment! ]
Reference(s):
commit 84e85611c3
Signed-off-by: Jim Warner <james.warner@comcast.net>
- Simplify control flow a bit. We don't need two loop variables, either.
- Consistently use %lld for bytes.
- Fix the base handling for human-readable output. The code used to
calculate *mebibytes* first, then scale that to the required exponent
with the selected base, which is patently wrong.
Fixes https://gitlab.com/procps-ng/procps/-/issues/133
This commit will address potential abends upon leaving
the windows help or color mapping screens and invoking
alternate display mode ('A'). It only happens if that
current window was changed with multiple 'a'/'w' keys.
So now, rather than leaving a trail of negative values
in the 'begtask' field, compliments of that win_select
function, we'll remove the mkVIZrow1 macro. Henceforth
it will be issued just once per user interaction. Thus
a promise of 'Curwin' only being impacted is restored.
[ my thanks to Vladimir Chren for reporting this bug ]
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/210https://gitlab.com/procps-ng/procps/-/merge_requests/135
Discovered by:Vladimir Chren <vladimir.chren@gmail.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
With that commit referenced below, which preserved the
'4' and + '!' toggles in the rcfile, this VER_J_RCFILE
macro was made superfluous. But, it was never removed.
Reference(s):
commit f858e563b7
Signed-off-by: Jim Warner <james.warner@comcast.net>
in include/c.h we check if HAVE___PROGNAME is defined, but the
corresponding macro for setting (or not setting) it is missing from
the configure script. This commit adds the missing macro, by
copying it from the macro in tmux.
When top calls malloc, if a signal is received, it will
call sig_endpgm to process the signal. In the bye_bye function, if the
-b option is enable, the Batch variable is set, the fputs function
will calls malloc at the same time. The malloc function is not reentrant, so
it will cause the program to crash.
Signed-off-by: Shaohua Zhan <shaohua.zhan@windriver.com>
The build system tested for the presence of po4a binary at the
install step. procps ships with translated man pages so doesn't
need po4a for install/uninstallation.
Works already in psmisc!
References:
5fab6b7ab3
Signed-off-by: Craig Small <csmall@dropbear.xyz>
Some of the translation files did not escape the < properly leading
to po4a aborting. Also some translators are using old templates
and this merges them to the new ones.
References:
procps-ng/procps#188
Sometimes the testing sequence would leave a source tree
under procps-ng-(version) which, if update-potfiles was
run, would include these temporary files in the list, causing issues
later.
The script now explicitly ignores those temporary files.
Since this master library isn't quite as sophisticated
as the newlib version, this patch will protect against
the possibility of multibyte characters in a program's
name combined with some locale without UTF-8 encoding.
[ it is better to treat the COMMAND column length as ]
[ more than what's actually printed than to have the ]
[ line overflow & corrupt the remaining screen lines ]
Signed-off-by: Jim Warner <james.warner@comcast.net>