Commit Graph

2335 Commits

Author SHA1 Message Date
Jim Warner
6e1715d9eb top: fix additional SEGVs if no tasks were displayable
This patch is an outgrowth of that commit shown below.

Many additional potential segmentation faults might be
encountered if interactive commands are opened up to a
user when a '-p' switch has a single non-existent pid.

[ always the 'k', 'L', 'r', 'Y' keys & maybe 'v' too ]

So, this patch will restrict such a loser (oops, user)
to a reduced subset of normal commands until he/she/it
quits then restarts top with something to be displayed
or issues the '=' command overriding that '-p' switch.

Reference(s):
commit f57a0301e3

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-16 14:27:31 +10:00
Jim Warner
f57a0301e3 top: fix potential SEGV when no tasks were displayable
This patch fixes a nearly decade old bug discovered by
Frederik Deweerdt. His merge request shown below would
be an adequate solution except for iterative overhead.

This alternate patch will represent substantially less
overhead for an admittedly extremely rare possibility.

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

And-thanks-to: Frederik Deweerdt <fdeweerdt@fastly.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-13 10:28:50 +10:00
Jim Warner
7a19961fc2 top: update user/system cpu % graph content (man page)
What had been stated as the contents of the cpu graphs
was never really inclusive enough. Those recent newlib
tweaks highlighted the need for these man doc changes.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-13 10:28:50 +10:00
Jim Warner
5646506488 build-sys: updated autoscan for that configure.ac file
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-13 10:28:50 +10:00
Jim Warner
762249e8ec top: even more useless cosemetic stuff (only comments)
[ this is what happens when i've run out of bugs and ]
[ issues and am now left with way too much free time ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-13 10:28:50 +10:00
Jim Warner
072a850761 top: more useless cosemetic changes (chiefly comments)
All of these changes are self-explanatory, so I'll not
provide any more comments thus avoiding further shame.

[ everything's perfectly justified and right margins ]
[ are filled entirely, but of course it must be luck ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-09-13 10:28:50 +10:00
Jim Warner
e319650278 misc: eliminate a couple of miscellaneous gcc warnings
This commit just addresses those warnings shown below.

Reference(s):
proc/sysinfo.c: In function `getrunners':
proc/sysinfo.c:491:26: warning: `%s' directive writing up to 255 bytes into a region of size 26 [-Wformat-overflow=]
  491 |     sprintf(tbuf, "/proc/%s/stat", ent->d_name);
      |                          ^~

pgrep.c: In function `select_procs':
pgrep.c:591:11: warning: suggest explicit braces to avoid ambiguous `else' [-Wdangling-else]
  591 |   else if (opt_older)
      |           ^

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-07-29 18:58:33 +10:00
Jim Warner
71d49f168a top: for consistency, reposition a few man page macros
This patch just repositions some .PP macros so they'll
immediately precede the paragraphs to which they apply
rather than a comment line used as a visual separator.

[ ok we also update the document date to 'July 2020' ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-07-29 18:58:33 +10:00
Jim Warner
723f146b24 build-sys: suppress '-Wunused-result' with AM_CPPFLAGS
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-07-20 16:12:00 +10:00
Jim Warner
78053c85fc top: address several 'mandoc -Tlint' errors & warnings
This commit addresses the errors/warnings shown below.

Reference(s):
ERROR: skipping end of block that is not open: RE
WARNING: skipping paragraph macro: sp after PP
WARNING: skipping paragraph macro: PP empty

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-07-20 16:12:00 +10:00
Jim Warner
3e92b4c9ff top: make that 'cpu_prt' function a tad more efficient
This commit only eliminates two 'nop' instructions and
one 'jmp' instruction. However, it makes that C source
code look a little bit prettier than it looked before.

[ and yes, some unnecessary parenthesis were used to ]
[ force an alignment of some related lines. it costs ]
[ us nothing in extra code yet helps in readability. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-07-20 16:12:00 +10:00
Jim Warner
246c5fa812 top: make the 'cpu_tics' function a tad more efficient
This patch eliminates one variable which resulted in a
corresponding elimination of three 'mov' instructions.

[ that was 6 bytes per 'mov' for a total of 18 bytes ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-07-20 16:12:00 +10:00
Craig Small
9232625f0f Merge branch 'jrybar/procps-vmstat-watch-manpage-fix'
References:
 procps-ng/procps!103
2020-07-01 08:04:51 +10:00
Jan Rybar
354b5a56bf vmstat and watch manpage slight fixes
vmstat - align wording with proc manpage to clarify ambiguities  (rhbz#1796043)
watch - manpage presumes ntp tools are present by default (which they're not on rpm and deb distros, rhbz#1583669)
2020-06-30 10:54:58 +02:00
Jim Warner
63691d6734 top: raise the amount by which top's stat buffer grows
We won't go as far as the merge request shown below in
increasing buffer size, but we'll reduce substantially
total iterations while growing it to achieve one read.

[ and this seems in line with what was recently done ]
[ to accommodate the massively parallel environments ]
[ thru 2 abreast ('4') and combined cpus ('!') modes ]

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

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-29 21:12:02 +10:00
Jim Warner
8ebdaf8bcf NEWS: updated for those recent utf-8 translation fixes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-29 21:12:02 +10:00
Jim Warner
c509d9bcbb top: provide for zero length character in utf8 support
This commit is prompted by the preceding change to the
library's escape.c module which, in turn, was prompted
by that issue shown below (with thanks to Konstantin).

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/176

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-23 19:05:03 +10:00
Jim Warner
bb1a79f2c8 library: correct that 'escape_str_utf8' guy's behavior
Thanks to Konstantin for discovering 2 problems in the
issue referenced below. That 15+ year old logic went a
little too far overboard wrestling with a utf8 string.

Henceforth, we will not treat 'x9b' as special. And we
also will handle a 'combining acute accent' correctly.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/176

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-23 19:05:03 +10:00
Jim Warner
e3249ebb97 top: some miscellaneous accumulated tweaks and cleanup
I've grown to hate that man document rendering when it
comes to hyphenation. So this patch will eliminate it.

And we'll also eliminate an unnecessary initialization
in that top program code concerned with combined cpus.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-23 19:05:03 +10:00
Craig Small
cc032cbd99 docs: some manpage fixes
Some editorial changes so the man pages follow the standards.

References:
 procps#173
2020-06-04 22:25:26 +10:00
Jim Warner
f0fb35b645 top: fix a minor startup flaw for the '2 abreast' mode
This ensures that a single '4' keystroke will reliably
toggle the new 2 abreast mode ON. Depending on whether
an older configuration file existed or whether top was
configured with '--disable-modern-top', keying the '4'
for a second time might otherwise have been necessary.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-04 20:16:21 +10:00
Jim Warner
f73d8d180f top: help the '#define PRETEND48CPU' be more realistic
The previous PRETEND8CPUS #define was recently changed
to PRETEND48CPU to better exercise the new '4' and '!'
toggles. But, the implementation simply duplicated the
/proc/stat summary line for each cpu. Therefore, every
cpu showed the same graph/detail (depending upon 't').

This patch shows the actual individual cpu information
(duplicated, of course, when total cpus are exceeded).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-04 20:16:21 +10:00
Jim Warner
f858e563b7 top: preserved those new '4' and '!' toggles in rcfile
This patch will address Craig's feedback regarding the
original implementation of top's two new toggles. It's
likely other users would have questioned why they were
not saved also, once they discover these new features.

And, since the minimum terminal width was just lowered
to 80 columns, the default for window #1 is also being
changed to show the individual cpu graphs two abreast.

[ assuming no '--disable-modern-top' for ./configure ]

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172
https://www.freelists.org/post/procps/two-major-changes-to-top,1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-31 21:59:57 +10:00
Jim Warner
ad6917e3cf top: warn users if rcfile save prevents older top read
I'm about to break older top rcfile compatibility when
preserving those two new toggles. And, though this has
happened several times over the years, we never issued
any warnings that such thing was just about to happen.

So, this patch corrects the long standing shortcoming.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-31 21:59:57 +10:00
Jim Warner
6db0d5eab6 top: reduce minimum terminal width with 2 abreast mode
For the original implementation of the '4' toggle, the
minimum width was set at 165 columns. This was done to
avoid truncations when detailed cpu statistics (versus
graphs) were being displayed. Those can not be scaled.

Upon reflection, it seems more appropriate to give the
user the choice of whether or not to truncate. And, by
reducing that minimum width requirement to 80 columns,
we'll vastly expand potential use of two abreast mode.

[ we'll keep that original as '#define TOG4_NOTRUNC' ]

The patch also updates the man document appropriately.
Along the way, we will trade the potentially confusing
word 'adjacent' for the more natural 'additional' when
detailing the '!' toggle in 4b. Summary-Area-Commands.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172
https://www.freelists.org/post/procps/two-major-changes-to-top

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-31 21:59:57 +10:00
Jim Warner
e5ddd7ff55 top: address each of the most recent coverity warnings
This patch attempts to supress the following warnings:

. MISSING_BREAK, TAINTED_SCALAR plus SIZEOF_MISMATCH .

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-31 21:59:57 +10:00
Jim Warner
ae4ad637af NEWS: acknowledge those two new top command provisions
Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:37:58 +10:00
Jim Warner
a8a6005d32 top: bump up that PRETEND8CPUS #define to PRETEND48CPU
This patch simply allows for better testing of our two
new toggles: '4' (2 abreast) plus '!' (combined cpus).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:37:58 +10:00
Jim Warner
f6a40a8fdb top: add '!' toggle for combined cpus display, man doc
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:37:58 +10:00
Jim Warner
5e1e14b019 top: add '!' toggle for combined cpus display, program
When implementing that earlier '4' toggle, in response
to the issue referenced below, I got to thinking about
those environments with massively parallel processors.

Such environments may not benefit from the '4' toggle.

So, I decided to implement a feature that could enable
use of those '1' and/or '4' toggles no matter how many
active processors top may have ultimately encountered.

With the new '!' toggle, adjacent cpus can be combined
to any degree, represented as a single cpu group/line.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:37:58 +10:00
Jim Warner
f93980910e top: add '4' toggle for 2 abreast cpu display, man doc
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:37:58 +10:00
Jim Warner
fca48e7e99 top: add '4' toggle for 2 abreast cpu display, program
In the back of my mind, I've always wanted to enable a
two abreast cpu display. Folks with massively parallel
machines must surely have been frustrated with the '1'
toggle when Off (individual cpus in the Summary Area).

So, I'll use that recently raised issue shown below as
a justification for finally implementing this feature.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:37:58 +10:00
Jim Warner
43a8d0328d top: eliminate a long standing extraneous comment line
Wow, hard to believe the extraneous comment line dates
all way back to an introduction of NLS support (2011).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:37:58 +10:00
Craig Small
0930cfca54 build-sys: Some version fixes
tarball-version should be shipped in tarball
version is not.
2020-05-22 17:11:13 +10:00
Craig Small
77b60ae15e NEWS: add pgrep older than item 2020-05-17 22:00:51 +10:00
Craig Small
cec87f4aee Merge branch 'edneville/procps-master'
References:
 procps-ng/procps!79
2020-05-17 21:54:55 +10:00
ed
9975595b9b pgrep.c: simplifying uptime call 2020-05-17 21:53:39 +10:00
ed
79a4eb6128 pgrep.c: Replacing seconds_since_boot with uptime as suggested by Craig Small 2020-05-17 21:53:39 +10:00
ed
41b9e62be7 pgrep.c: change to allow 'older than' style selection
pgrep.1: man page addition for above selection
Makefile.am: addition of global.c to include sections since boot in pgrep.
2020-05-17 21:53:36 +10:00
Craig Small
d3e0ff5a0a Merge branch 'awesomeclaw/procps-master'
References:
 procps-ng/procps!62

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2020-05-12 19:22:48 +10:00
Harry Wagstaff
06df067464 Add information on WATCH_INTERVAL env var to watch documentation 2020-05-12 19:12:21 +10:00
Harry Wagstaff
c1214a56a6 Add ability to specify watch interval using environment variable WATCH_INTERVAL 2020-05-12 19:12:21 +10:00
Craig Small
a68d628adf vmstat: Add NEWS and revert comment from prev
Reverted the translation hint as the fields are used for both
normal and wide modes, so need to fit the smaller of the two.

Added NEWS item

References:
 commit 01c1b2345e
2020-05-12 18:57:26 +10:00
Craig Small
fd346ded61 Merge branch 'isj4/procps-mode_wide_columns'
References:
 procps-ng/procps!48
2020-05-12 18:52:03 +10:00
Ivan Skytte Jørgensen
01c1b2345e Use wide columns for r/b too in wide mode
2 digits are not enough for number of runnable/blocked processes on modern
systems. Changed to 4 digits with given the -w option.
2020-05-12 18:51:41 +10:00
Craig Small
2aaa16a727 Merge branch 'swiggett/procps-patch-1'
References:
 procps-ng/procps!34

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2020-05-11 17:43:12 +10:00
Dylan Swiggett
b52a267404 Fixes small bug in struct proc_t documentation.
From http://man7.org/linux/man-pages/man5/proc.5.html:

(22) starttime  %llu
                        The time the process started after system boot.  In
                        kernels before Linux 2.6, this value was expressed
                        in jiffies.  Since Linux 2.6, the value is expressed
                        in clock ticks (divide by sysconf(_SC_CLK_TCK)).
2020-05-11 17:39:47 +10:00
Craig Small
4090fa711b build-sys: Enable testing of sigqueue
The referenced commits enavled both pkill and kill to send an integer to
the killed or signalled process. The test_process now will report on the
integer if sent and the testsuite changes take advantage of this
new feature.

Another process make/destroy set had to be made as using spawn
instead of exec changes both the SID and TTY for the underlying
process, making other tests fail.

References:
 commit 7d55409b82
 commit 2b804a532a
2020-04-28 19:47:39 +10:00
Arun Chandrasekaran
7d55409b82 pgrep: use sigqueue to pass value with the signal.
Based on the command line option, use 'sigqueue'
instead of 'kill' to pass the integer value with
the signal.

References:
 procps-ng/procps!32

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2020-04-25 13:15:06 +10:00
Craig Small
5335851452 kill: Adjust documentation for sigqueue
Added NEWS item
Changed the section for sigqueue as its 3 for me.
2020-04-24 19:29:34 +10:00