Commit Graph

2554 Commits

Author SHA1 Message Date
Craig Small
fa31656f07 watch.1: Correct long option for no linewrap.
The correct long option for -w is --no-wrap but the man page
said it was --no-linewrap

References:
 procps-ng/procps#203

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-04-24 12:01:49 +10:00
Christian Hermann
d40db79c60 build-sys: find split systemd libraries
With 4e7f4237 and 5e73c832, systemd library detection through pkg-config
was changed to unconditionally look for unified libsystemd.

This adds a fallback to match the previous behavior and find the split
libs as well.

References:
 procps-ng/procps!128

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-04-24 11:57:32 +10:00
Issam E. Maghni
6c36ab4fc7 escape.c: Fix missing nl_langinfo on certain configs
nl_langinfo and CODESET are undefined in a musl system. Instead of
uncondionally including langinfo.h, this change includes include/nls.h
which has the tests and work-arounds for systems that don't have these
features. This is similar to how other programs within procps include
langinfo.h via nls.h

References:
 procps-ng/procps!130

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-04-24 11:46:48 +10:00
Issam E. Maghni
71764980c3 configure: Add --disable-w
Some systems implement utmp as a stub so it doesn't make sense to have
a non-functioning w.  This change mitigates #193 and !126

References:
 procps-ng/procps!129
 procps-ng/procps!126
 procps-ng/procps#193
2021-04-24 11:29:48 +10:00
Jim Warner
c082779769 library: fix an insidious bug affecting TICS_ALL_DELTA
This simple two line code change fixes an intermittent
bug whereby %CPU for parent(s) with collapsed children
could be vastly understated from those displayed under
the current 3.3.17 publicly available top & libprocps.

If one started several top instances in the background
using very a small delay interval (zero?), then if the
shell under which they were running was collapsed, you
would see similar %CPU results for both the libraries.

However, when running a demanding 'make' like a kernel
compile (especially if backed by fast processors and a
SSD), then newlib would generally show only 1/3 to 1/2
of the collapsed %CPU values that appeared for 3.3.17.

Of course, now that the bug has been swatted with this
commit the disparities between those results is easily
explained. Since newly created tasks never contributed
tics during the interval where they were created, only
with many short lived tasks would differences surface.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-04-24 11:11:03 +10:00
Jim Warner
0f691226ec library: lower addr resolution cost for TICS_ALL_DELTA
Rather than run risks of more expensive and repetitive
address resolution, we will establish this local index
for a one time cost and avoid any potential gcc bloat.

[ this commit was made in pursuit of a bug involving ]
[ the distortion of elapsed task tics. but, it turns ]
[ out these changes had nothing to do with that bug. ]
[ however, the patch is being retained as desirable. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-04-24 11:11:03 +10:00
Jim Warner
8e0e3aff64 top: respond to library type change for TICS_ALL_DELTA
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-04-24 11:11:03 +10:00
Jim Warner
9b601307ff library: lessen chance of distortion on TICS_ALL_DELTA
That old library defined this field as 'unsigned int'.
However, here it was known as a 'signed int'. Thus for
consistency we'll now also treat it as 'unsigned int'.

[ this commit was made in pursuit of a bug involving ]
[ the distortion of elapsed task tics. but, it turns ]
[ out these changes had nothing to do with that bug. ]
[ however, the patch is being retained as desirable. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-04-24 11:11:03 +10:00
Jim Warner
17c30484bc docs: fix a couple of spelling errors in new man pages
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-04-06 16:51:03 +10:00
Jim Warner
b2115a0c7b top: eliminate the #define VER_J_RCFILE as superfluous
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 b46af6d213

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-04-06 16:51:03 +10:00
Craig Small
992b8b64f4 pkill: Add lt- variants
The pgrep code checks to see if the program is run as pkill or pidwait
and changes its behaviour accordingly.  Some older versions of libtool
run the programs as lt-pkill and lt-pidwait which means the tests fail.

We add these two program names to the checks.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-04-05 14:40:00 +10:00
Craig Small
dc143c8dc0 docs: escape circumflex in sysctl.8
Groff says special characters should be escaped and some gettext
versions choke on it, so escape the ^

References:
 procps-ng/procps#147
2021-03-29 22:28:30 +11:00
Craig Small
fc97889b2d build-sys: Handle zero length diskstats in tests
vmstat -d testsuite will fail if your /proc/diskstats is present
but zero length. While this seems buggy behaviour from lxcfs, its
there and its a simple matter to test for it and skip those tests
if we are run on a zero length /proc/diskstats system.
2021-03-29 22:23:03 +11:00
Craig Small
3dd1661a3d docs: psr ps field is last run processor
The ps.1 manpage incorrectly stated that psr field showed the
processor the process was assigned to. However if the assignment
has changed but the process has not run, then the field doesn't
change.

Some digging by @srikard showed it wasn't the processor assigned
but the last one it was run on. The man page now correctly
describes psr in that way.

References:
 procps-ng/procps#187
2021-03-29 22:11:27 +11:00
Craig Small
6d08b92374 docs: Explain sysctl --system better
The sysctl.8 manpage explained the directory order but not that the
files were then ordered and run in lexiographic order no matter
the directory name.

References:
 procps-ng/procps#200
2021-03-29 22:07:08 +11:00
Shaohua Zhan
6b8980a3b6 top: replaced one use of fputs(3) with a write(2) call
This patch is ported from a merge request shown below,
and the following represents the original commit text.

------------------------------------------------------
top: In the bye_bye function, replace fputs with the write interface.

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>
------------------------------------------------------

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

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-03-23 21:43:13 +11:00
Craig Small
2e1e8fcc85 slabtop: Check for bad d and o option combination
If you run slabtop with the -d option and then -o option the
delay gets set to zero and it runs forever. slabtop now checks
for this combination and errors.

Adding a DEJAGNU test also found that none of the slabtop
checks were running so they got added to the list and only the
ones that need /proc/slabinfo (if not readable) are skipped.

References:
 #160
2021-03-11 22:10:37 +11:00
Craig Small
15c8b8e2cf w: Remove unreachable l option code
@ruihongw quite rightly pointed out we removed the l option
from the man page and getopt but the iunreachable case statement
remained.

References:
 commit 94468ac0b3
 #162

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-03-11 21:48:14 +11:00
Craig Small
32b3dafdcd free: Typo fix in error messages
doesn't to don't

References:
 #195

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-03-11 21:45:14 +11:00
Jim Warner
2a3997e2f0 misc: needed adaptations for the changes in <pids> api
That snowball, which began as a simple removal of some
brackets, now ends with this third patch restoring the
ability to build our project. It was made necessary by
the renaming (and rearranging) of several enumerators.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-03-11 21:21:23 +11:00
Jim Warner
39a8c08161 library: fix a few source/origin notations, <pids> api
After removing brackets from those 'derived' notations
I was surprised to discover that several origin/source
comments were wrong. So this patch fixes those errors.

[ along the way a couple enumerators were renamed to ]
[ better (i hope) reflect what they're representing. ]

[ that, in turn, also required a little rearranging. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-03-11 21:21:23 +11:00
Jim Warner
c16c05cce5 library: clean 'derived' origins in header, <pids> api
None of the other four new api headers use brackets on
derived items. With this patch we normalize the fifth.

[ it makes for a cleaner, less confusing, appearance ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-03-11 21:21:23 +11:00
Jim Warner
62928cf461 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).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-03-11 21:21:23 +11:00
Craig Small
9ddbc82000 ps: Add OOM and OOMADJ fields
top has had the OOMs and OOMa fields since 2011. Ten years its
probably time that ps had these fields added too.

ps output options have oom and oomadj for OOM Score and OOM Adjustment
respectively.

References:
 procps-ng/procps#198
 commit 367fd902da
 https://www.freelists.org/post/procps/PATCH-12-Add-missed-oom-support-to-libproc
2021-03-05 17:22:29 +11:00
Jim Warner
add01998e4 library: tweaked key used in hash table, <meminfo> api
This small change was a result of some experimentation
trading our current 'hsearch' hash scheme for 'gperf'.

I discovered that when the ':' character was a part of
each 'gperf' key, that generated search logic was more
complicated and thus slower. But without a ':', it was
a little cleaner/leaner and therefore slightly faster.

Assuming that the same trailing ':' *might* affect the
current 'hsearch' logic, to be safe we will remove it.

[ while the 'gperf' version will slightly outperform ]
[ an 'hsearch', too many ugly implementation details ]
[ were exposed which complicates future maintenance. ]

[ thus, we'll retain our current 'hsearch' approach. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-28 21:18:26 +11:00
Jim Warner
f4e9195149 library: normalized the 'read_failed' guys across APIs
This patch will condense some logic in those functions
associated with the file input operations. The changes
will not, for the most part, alter any generated code.

More significantly (though not very) was the change to
two 'strtoul' calls. Since the returned 'endptr' value
isn't exploited, when that parm is set to NULL, we can
save one instruction on each side of such calls (wow).

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-28 21:18:26 +11:00
Craig Small
3d0e7f3d03 build-sys: Fix the uninstall-man target
If automake doesn't see a dist_man_MANS then there is no
uninstall-man target. This fix uses the main Makefile
targets.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-02-24 20:58:28 +11:00
Craig Small
cce0e21e59 tests: Fix paths for testsuite
make distcheck gets confused what is in srcdir and what is in
topdir

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-02-24 20:41:38 +11:00
Jim Warner
76a8d7b5cb docs: tweak two man pages due to renaming of libproc-2
Reference(s):
commit 9aa09d8862

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-23 22:07:48 +11:00
Jim Warner
b0bda71ac0 library: eliminate a useless conditional in readproc.h
When #define QUICK_THREADS was introduced, for copying
some task data for a child thread, one proc_t pad byte
was used to mark, then later identify, those children.

Later the QUICK_THREADS was recycled as FALSE_THREADS,
and used for a different purpose, but a conditional in
the header file erroneously remained. Now, it is gone!

Reference(s):
. Jul, 2016 - QUICK_THREADS become FALSE_THREADS
commit c546d9dd44
. Aug, 2011 - QUICK_THREADS intruduced
commit bb4f08ba29

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-23 22:07:48 +11:00
Craig Small
9aa09d8862 library: Rename to libproc-2
What to call the new library?

Keep using libprocps wouldn't do, its a very different library from
the programs' point of view. It would also mean we could have some
clashes around the packages (two package names, same library name).

The ancient procps used libproc or libproc-a.b.c where a.b.c was the
package version. Kept the revision numbers down (it was always 0.0.0)
but the name of the library changed.

So if we use libproc-2 is there a clash with an ancient procps?
procps v 2.0.0 was around in 1999 so it was 22 years ago, also the
name of the library would have been libproc-2.0.0.so not libproc-2.so
so we're fine with that.

libproc-2 seems to fit, our second major re-work of the procps
library.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-02-20 22:30:31 +11:00
Jim Warner
aaa0cd48b0 docs: adjust revision date for our three new man pages
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-18 18:35:32 +11:00
Jim Warner
9c98179558 docs: expand 2 man pages 'Usage' to include VAL macros
Maybe, the biggest obstacle to successfully exploiting
this new library is after those `stacks' are returned.

Unless a user requests all available `items', there is
always a need to translate an actual enumerator into a
relative position within returned stack(s) of results.

So, this patch attempts to bridge that gap by adding a
brief explanation to the existing discussion in Usage.

[ along the way, 'Usage' & 'Caveats' were refactored ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-18 18:35:32 +11:00
Jim Warner
333a1bb6b8 library: tweak logic for /proc not mounted, <pids> api
Since 'procps_uptime' will access the /proc filesystem
the <pids> 'new' guy should should protect against the
possibility /proc isn't mounted when 'boot_seconds' is
established. A zero is better than the negative value.

[ the only distortion would be to PIDS_TIME_ELAPSED. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-18 18:35:32 +11:00
Jim Warner
0b689adde0 library: normalized 'extents_free_all' use across APIs
With the way those 'extents_free_all' guys were coded,
there's no real need to check for a NULL this->extents
before calling 'em. That's how <stat> already does it.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-18 18:35:32 +11:00
Craig Small
6e5d4c8ec0 nls: Update man translations for pidwait 2021-02-16 21:05:05 +11:00
Craig Small
0864cf9a68 pidwait: Add missing name change line
Missed one of the lines that changes from pwait to pidwait
in referenced commit.

References:
 commit 9c1a62b637
2021-02-16 06:48:51 +11:00
Craig Small
9c1a62b637 pidwait: Rename from pwait
pwait is already in at least Debian in a different package

References:
 https://bugs.debian.org/982391
2021-02-15 21:55:05 +11:00
Craig Small
779ca44b2d build-sys: Ignore temp directory for POTFILES.in
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.
2021-02-15 21:47:35 +11:00
Craig Small
dd990f8638 nls: Update the man po files
Takes into account the procps*.3 manpages and updates them to the
corrected latest versions.
2021-02-15 21:46:53 +11:00
Craig Small
7e4f21ddcc nls: Update translation files 2021-02-15 21:37:56 +11:00
Craig Small
10c6b859b0 build-sys: Update building of translations
newlib was lagging behind oldlib in how the build system created
the translation files.
2021-02-15 21:36:57 +11:00
Jim Warner
fb0e4f3f68 library: update those source files for copyright dates
In addition to copyright date, the initial descriptive
line was changed from a generic statement to one which
reflects the specific portion of the proc/ filesystem.

[ such descriptions alternate between 'declarations' ]
[ (h files) & corresponding 'definitions' (c files). ]

Also, a few missing copyright attributions were added.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-09 16:40:52 +11:00
Jim Warner
0749704006 top: update the man page & source file copyright dates
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-09 16:40:52 +11:00
Jim Warner
9a0869e8ba docs: bring 2 man pages into agreement regarding sorts
Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-09 16:40:52 +11:00
Jim Warner
3c87c46439 library: tweak 'other' user/group names for efficiency
This commit just ensures that the relatively expensive
ID to name conversions aren't performed unless they're
explicitly requested. It also internalizes those flags
that required the PROC_FILLSTATUS flag to also be set.

[ requiring a caller, in our case pids.c, to provide ]
[ two flags when a single field was the objective is ]
[ wrong & represents a future potential toe-stubber. ]

[ moreover, what's worse is that those two flags are ]
[ seemingly unrelated. but, without both, a SEGV can ]
[ can be expected when a result.str pointer is NULL. ]

[ by contrast, in the master branch those fields are ]
[ arrays which, when set to zeroes, produce an empty ]
[ string. So, there is no abend (but no name either) ]
[ when one of those two required flags were omitted. ]

[ and worth noting, in that branch it's not just one ]
[ caller required to observe a two flag requirement. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-02-09 16:40:52 +11:00
Craig Small
4770195b87 docs: vmstat.8 - swap is not virtual memory
Chanson Shen rightly pointed out that vmstat swpd stat is
swap memory used not virtual memory used.

Signed-off-by: Craig Small <csmall@dropbear.xyz>
2021-01-21 18:01:31 +11:00
Craig Small
bc16fa87f0 misc: Update Craig's email 2021-01-21 17:37:48 +11:00
Jim Warner
baa9dc93f9 docs: adapt procps_misc.3 for new 'misc.h' header file
This commit adapts our man page for a new consolidated
'misc.h' header file. Along the way, some descriptions
were shortened, others lengthened and whitespace added
in an effort to (hopefully) improve readability a bit.

[ the #include subdirectory was also corrected while ]
[ rearranging & grouping functions into 3 categories ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-01-21 17:30:25 +11:00
Jim Warner
423297c9db all: make buildable again for new 'misc.h' header file
With the 4 header files removed in the previous patch,
this commit just changes all those obsolete references
to that new consolidated 'misc.h' header file instead.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2021-01-21 17:30:25 +11:00