]> granicus.if.org Git - procps-ng/log
procps-ng
4 years agolibrary: a tweak to the UNREF_RPTHASH code, <pids> api
Jim Warner [Mon, 19 Oct 2020 05:00:00 +0000 (00:00 -0500)]
library: a tweak to the UNREF_RPTHASH code, <pids> api

If a hash results report is output (via UNREF_RPTHASH)
a portion is devoted to occupied table entries ordered
by depth. There is a possibility that some depths will
not be found among existing occupied table entries and
to avoid any confusion probably should not be printed.

[ to illustrate the potential for confusion prior to ]
[ this patch, force a very small table size (like 8) ]
[ & then trigger the procps_pids_unref() eoj report. ]

So this patch ensures only 'in use' entries are shown.

[ admittedly, all of the remaining logic in the loop ]
[ could/should be subordinate to this new 'if' test, ]
[ but we will keep the change to a minimum. besides, ]
[ there's no harm subtracting/adding a zero numdepth ]
[ especially since the chance of a zero is very low. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agodocs: Add procps_misc.3 manpage
Craig Small [Sat, 24 Oct 2020 07:25:48 +0000 (18:25 +1100)]
docs: Add procps_misc.3 manpage

The last (I think) of the newlib man pages for the new API.

4 years agofree,slabtop,uptime: complain about extra ops
Craig Small [Mon, 19 Oct 2020 11:36:06 +0000 (22:36 +1100)]
free,slabtop,uptime: complain about extra ops

free, slabtop and uptime would happily take extra command line
arguments and doing nothing about them. The programs now check
optind after option processing and will give you usage screen
if there is anything extra.

References:
 procps-ng/procps#181

4 years agowatch: Add no linewrap option
Craig Small [Mon, 19 Oct 2020 11:03:44 +0000 (22:03 +1100)]
watch: Add no linewrap option

For long lines from a process, watch would wrap them around to the
next. While this default option has it uses, sometimes you want to
just cut those long lines down.

watch has a -w flag which will truncate the lines to the number
of columns. A few simple lines to do this new trick.

I think I caught all the ANSI state correctly but there might be
a chance it bleeds to the next row.

References:
 procps-ng/procps#182

4 years agobuild-sys: Build check programs only on make check
Craig Small [Mon, 19 Oct 2020 09:05:41 +0000 (20:05 +1100)]
build-sys: Build check programs only on make check

noinst_PROGRAMS are built with "make" even though we had the
test programs in there and only needed them for "make check".

In theory the check target should depend on check_PROGRAMS as
check-am target does and the document states it should, but for
reasons understood by the automake whisperers only, it doesn't
build them.

check only depends on BUILT_SOURCES for some reason.

check-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
        $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) check-recursive

References:
 https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html

4 years agobuild-sys: Add check-lib target
Craig Small [Mon, 19 Oct 2020 08:25:33 +0000 (19:25 +1100)]
build-sys: Add check-lib target

The referenced commits created the library infrastructure and test
program to validate that the structures and macros line up with
each other.

The library needs to be (re)built with -DITEMTABLE_DEBUG and then
the test program ran.  We clean before and after so we are not
testing a non-debug library or having a debug library hanging around
to cause future problems.

Due to test_Itemtables depending on the library, we don't need to
explicitly build the library.

To validate the library structure/header corrospondence run:
make check-lib

References:
 commit e616409aa497b5dc656dc7a5bd0a21adf0ee4d36
 commit 92d0297e1e4d5946c5b098e37c91c7e524a0eca0
 https://www.freelists.org/post/procps/keep-on-patchin,19

4 years agolibrary: tweak that history hash algorithm, <pids> api
Jim Warner [Thu, 1 Oct 2020 05:00:00 +0000 (00:00 -0500)]
library: tweak that history hash algorithm, <pids> api

This patch just raises the size of the hash table used
to calculate elapsed task stuff. The net result should
be less need for 'chaining' under pid hash collisions.

[ the hash scheme is intentionally kept as primitive ]
[ and, therefore, as fast as possible. it employs an ]
[ 'and' approach versus a 'mod' operation since both ]
[ yield similar distribution but the former approach ]
[ was 4 fewer cpu instructions in terms of overhead. ]

[ additionally, for hash collisions, 'chaining' uses ]
[ an array index rather than the usual pointer since ]
[ the HST_t guys may move when they are reallocated. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: tweak the memory allocation logic, <pids> api
Jim Warner [Wed, 30 Sep 2020 05:00:00 +0000 (00:00 -0500)]
library: tweak the memory allocation logic, <pids> api

This patch separates the memory allocations into those
used initially from those used in later reallocations.
Thus, we can reduce that iterative realloc() overhead.

Additionally, we'll correct a long standing oops where
multiple history_info structures were created at 'new'
time when only one should have been allocated (jeeze).

[ originally the allocation was strangely based upon ]
[ number of 'items' (???) & later a #define constant ]

Reference(s):
. May, 2016 - subsequent bad history_info logic
commit 9ebadc1438a6665a98a9f0782523b0f9a2a6248f
. Aug, 2015 - original faulty history_info code
commit 7e6a371d8a36b250a2edddff9f5d059640b8132e

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agops: Match on truncated 16 char for -C
Craig Small [Thu, 24 Sep 2020 12:19:11 +0000 (22:19 +1000)]
ps: Match on truncated 16 char for -C

The referenced commit the comm length was increased from 16 to 64
characters to handle the larger command names for things like kernel
threads.

However most user processes are limited to 15 characters which means
if you try something like ps -C myprogramisbiggerthansixteen this would
fail to match because /proc/<PID>/comm would only be myprogramisbigg

ps now checks the comm length and if it is 15 and if the given match
is 15 or more, it will only match the first 15 characters.

This is also how killall has worked for about a year.

Thanks to Jean Delvare <jdelvare@suse.de> for the note.

Copy of commit from master.

References:
 commit 14005a371e5c14289e96a4927ffd1a827d3c9d85
 commit psmisc/psmisc@1188315cd037d73bf946a0003b70c6423cc330d2
 commit 3e1c00d051ae4a8319df7714d0545b4b7aa81557

Signed-off-by: Craig Small <csmall@dropbear.xyz>
4 years agotop: fix additional SEGVs if no tasks were displayable
Jim Warner [Sun, 13 Sep 2020 05:00:00 +0000 (00:00 -0500)]
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 d3203d99dd7f4508447ea3b4b056a9d134229d10

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agovmstat: Null the diskstats pointer
Craig Small [Sun, 13 Sep 2020 00:25:19 +0000 (10:25 +1000)]
vmstat: Null the diskstats pointer

I'm not sure why, but the make check will now fail for vmstat

Running ./vmstat.test/vmstat.exp ...
FAIL: vmstat disk information (-d option)

With the _new function returning the error.
In vmstat all other structures are set to NULL before calling _new
except the diskstat ones. This has been corrected.

4 years agotop: fix potential SEGV when no tasks were displayable
Jim Warner [Wed, 9 Sep 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: update user/system cpu % graph content (man page)
Jim Warner [Tue, 8 Sep 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agolibrary: tweak those system cpu statistics, <stat> api
Jim Warner [Tue, 8 Sep 2020 05:00:00 +0000 (00:00 -0500)]
library: tweak those system cpu statistics, <stat> api

This patch may be a little misleading in terms of size
since most of the changes just reorder a little logic.
The most significant changes involve two GUEST values.

My original implementation excluded such tics from the
TOTAL calculation and, therefore, the BUSY figure too.

That decision was erroneously based on some code found
in ./kernel/sched/cputime.c which in hindsight applies
only to processes, not those system level cpu figures.

[ another likely oops classified STOLEN tics as IDLE ]

So, this patch attempts to bring those SUM values into
better agreement with the calculations performed for a
root cgroup (see ./kernel/cgroup/rstat.c source file).

[ we differ from those above in that we also include ]
[ the IDLE plus IOWAIT tics in our TOTAL calculation ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: eliminate unused 'FUNCTION' in private header
Jim Warner [Tue, 1 Sep 2020 05:00:00 +0000 (00:00 -0500)]
library: eliminate unused 'FUNCTION' in private header

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agobuild-sys: updated autoscan for that configure.ac file
Jim Warner [Sun, 30 Aug 2020 05:00:00 +0000 (00:00 -0500)]
build-sys: updated autoscan for that configure.ac file

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: eliminate one potential source of human error
Jim Warner [Sat, 22 Aug 2020 05:00:00 +0000 (00:00 -0500)]
library: eliminate one potential source of human error

There's a huge toe-stubber awaiting future maintenance
as reflected in that commit below which deals with the
addition of new enumerators to the Item_table. Namely,
whenever the table is grown, one must remember to also
change that existing 'logical_end' enumerator's value.

Well, not anymore! Since that MAXTABLE macro was added
to the procps-private.h header we can now also exploit
it so a 'logical_end' automatically tracks table size.

This change also renders some code associated with the
ITEMTABLE_DEBUG #define unnecessary. So it's gone too.

Reference(s):
. 08/2016, add new enumerators
commit 09e1886c9e731f8b8c89a55d11f72f53f030b2de
. 08/2020, added MAXTABLE macro
commit c865b06c304e645c05eae0f5e06a1f49ea105285
. 08/2020, introduced ITEMTABLE_DEBUG
commit 92d0297e1e4d5946c5b098e37c91c7e524a0eca0

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: even more useless cosemetic stuff (only comments)
Jim Warner [Fri, 21 Aug 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: more useless cosemetic changes (chiefly comments)
Jim Warner [Thu, 20 Aug 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agolibrary: fix a flaw in one 'new' function, <diskstats>
Jim Warner [Wed, 19 Aug 2020 05:00:00 +0000 (00:00 -0500)]
library: fix a flaw in one 'new' function, <diskstats>

At 'new' time, the major API modules each ensure their
'info' parameter isn't NULL but what it pointed to was
except this single straggler, for some unknown reason.

So, this patch brings him into line with those others.

[ And, without going into the ugly details, this was ]
[ the reason I never experienced an abend originally ]
[ but Craig did. And, though related to stacks mgmt, ]
[ zero initialization was not a factor. Anyway, with ]
[ this patch, everybody would have experienced abend ]
[ under the original (faulty) test_Itemtables logic! ]

Reference(s):
https://www.freelists.org/post/procps/keep-on-patchin,13

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agobuild-sys: proper fix for the 'test_Itemtables' module
Jim Warner [Mon, 17 Aug 2020 17:12:12 +0000 (12:12 -0500)]
build-sys: proper fix for the 'test_Itemtables' module

Me thinks Craig had the right idea but perhaps not the
most correct solution. As currently structured, all of
the tests now go way too far by checking every 'unref'
and 'new' call when what we're trying for is survival.

In the final analysis, it doesn't matter who issues an
EXIT_FAILURE - that run_tests guy or an early Exit out
of a procps_new() function. They both will produce the
same end result of the desired "FAIL" test diagnostic.

[ and this patch once again allows the slabinfo test ]

Reference(s):
commit 4eeed6dcff8b3bf3930eb1998738b5c6d458f0c1

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agobuild-sys: Check return values and NULL ctx
Craig Small [Mon, 17 Aug 2020 12:47:39 +0000 (22:47 +1000)]
build-sys: Check return values and NULL ctx

The referenced commit introduced a test program for the API
but it would often fail due to:
  The given pointer for _new() not being NULL
  The return value for _new not checked, so the subsequent _unref()
  would free() random memory
  slabinfo checks failing due to permission denied errors.

The first two are fixed, as well as returning a fail to the test
if they don't return correctly, with slabinfo waiting to see if there
is a way of initialising the structure without reading the slabinfo.

References:
 commit e616409aa497b5dc656dc7a5bd0a21adf0ee4d36

Signed-off-by: Craig Small <csmall@dropbear.xyz>
4 years agobuild-sys: added a 'test_Itemtables' to testing scheme
Jim Warner [Sat, 15 Aug 2020 17:12:12 +0000 (12:12 -0500)]
build-sys: added a 'test_Itemtables' to testing scheme

This change sets the stage for exploiting the recently
added ITEMTABLE_DEBUG #define. All tests are performed
in a single module (after trying 6 separate programs).

The chances of each test detecting errors is extremely
remote (at least while I'm maintaining these modules).
However, this single program approach has one flaw and
it relates to the response whenever an error is found.

Each of those six new API modules calls Exit() if they
detect an error. Otherwise, incorrect results would be
produced at the least or an abend encountered at most.

This means that multiple 'make check' invocations will
be needed if more than 1 module actually was in error.

All in all, it is a small price for a large assurance.

Reference(s):
https://www.freelists.org/post/procps/keep-on-patchin,7

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agobuild-sys: fix some important 'tests.h' related issues
Jim Warner [Sat, 15 Aug 2020 16:11:11 +0000 (11:11 -0500)]
build-sys: fix some important 'tests.h' related issues

Exploiting a header file shouldn't also force users to
code their own '#include <stdio.h>'. More importantly,
unless this header is mentioned in dist_noinst_HEADERS
we'd fail 'make distcheck' with the error shown below.

[ the same error will apply to all 'noinst_PROGRAMS' ]
[ that happen to use this header. but please, do not ]
[ ask me to explain exactly why or how my fix works! ]

Reference(s):
../../proc/test_pids.c:24:10: fatal error: tests.h: No such file or directory
   24 | #include "tests.h"
      |          ^~~~~~~~~

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agobuild-sys: tweak make & activate some overlooked tests
Jim Warner [Sat, 15 Aug 2020 15:10:10 +0000 (10:10 -0500)]
build-sys: tweak make & activate some overlooked tests

This commit is just preparing for adding an Itemtables
verification test by reorganizing stuff and activating
a few previously inactive (overlooked?) test programs.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: introduced 'Item_table' validation provisions
Jim Warner [Mon, 10 Aug 2020 05:00:00 +0000 (00:00 -0500)]
library: introduced 'Item_table' validation provisions

The recent work on updating the <meminfo> and <vmstat>
modules with some newly added linux fields reminded me
(again) of a need for some mechanism guaranteeing that
a header file agrees with the source file assumptions.

Sadly, in the past, if a table entry was omitted or if
the table and header are ordered differently, then the
library would silently return the wrong results values
or even potentially experience a SIGSEGV abnormal end.

This patch offers a much needed development assist for
ensuring that Item_table entries are synchronized with
header file enumerators in terms of number plus order.

It's intended solely for our use as libprocps evolves.

Now, by activating ITEMTABLE_DEBUG, either directly or
via ./configure CFLAGS='-DITEMTABLE_DEBUG', the number
and order will be verified. It is envisioned that this
feature will be used at least once prior to a release.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: added MAXTABLE macro to proc/procps-private.h
Jim Warner [Mon, 10 Aug 2020 05:00:00 +0000 (00:00 -0500)]
library: added MAXTABLE macro to proc/procps-private.h

This macro should help the following patch be a little
less prolix. Besides, this private header could/should
do just a little more to help with our newlib efforts.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: <diskstats> api, regularize macro conventions
Jim Warner [Mon, 10 Aug 2020 05:00:00 +0000 (00:00 -0500)]
library: <diskstats> api, regularize macro conventions

This cosmetic change just prepares for the later patch
introducing validation of Item_tables and enumerators.

[ and, we'll now have better 'set' function names of ]
[ 'set_diskstats_ENUM' instead of the more redundant ]
[ current 'set_diskstats_DISKSTATS_ENUM' convention. ]

[ now our only exception is the <slabinfo> api where ]
[ a full enumerator identifier with 'SLAB' & 'SLABS' ]
[ prefixes are used, and 'SLABINFO_noop/extra' guys. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: <vmstat> api, updated for current linux state
Jim Warner [Fri, 7 Aug 2020 05:00:00 +0000 (00:00 -0500)]
library: <vmstat> api, updated for current linux state

Since last visited, there have been several new fields
added to the /proc/vmstat file. Now, we are caught up.

[ references shown below represent linux git commits ]

Reference(s):
. 6/2020, added 'pgscan_...' & 'pgsteal_...'
commit 497a6c1b09902b22ceccc0f25ba4dd623e1ddb7d
. 4/2020, added 'nr_shadow_call_stack'
commit 628d06a48f57c36abdc2a024930212e654a501b7
. 4/2020, added 'thp_...fallback_charge'
commit 85b9f46e8ea451633ccd60a7d8cacbfff9f34047
. 4/2020, added 'thp_file_fallback'
commit dcdf11ee144133328664d90836e712d840d047d9
. 4/2020, added 'nr_foll_pin_...'
commit 1970dc6f5226416957ad0cc70ab47386ed3195a6
. 9/2019, added 'nr_file_...'
commit 60fbf0ab5da1c360e02b7f7d882bf1c0d8f7e32a

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: <meminfo> api, update for current linux state
Jim Warner [Fri, 7 Aug 2020 05:00:00 +0000 (00:00 -0500)]
library: <meminfo> api, update for current linux state

Since last visited, there have been several new fields
added and one field deleted in the /proc/meminfo file.

[ references shown below represent linux git commits ]

Reference(s):
. 4/2020, added 'ShadowCallStack'
commit 628d06a48f57c36abdc2a024930212e654a501b7
. 9/2019, added 'FileHugePages' & 'FilePmdMapped'
commit 60fbf0ab5da1c360e02b7f7d882bf1c0d8f7e32a
. 9/2019, removed 'Quicklists'
commit 13224794cb0832caa403ad583d8605202cabc6bc

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: ensure 'XTRA_PROCPS_DEBUG' works in real life
Jim Warner [Sat, 25 Jul 2020 05:00:00 +0000 (00:00 -0500)]
library: ensure 'XTRA_PROCPS_DEBUG' works in real life

This commit attempts to smooth some wrinkles impacting
any future libprocps user exploitation. The 2 problems
relate exclusively to our XTRA_PROCPS_DEBUG provision.

1. The 'xtra-procps-debug.h' header had an include for
'procps-private.h', which was not an installed header.
So the STRINGIFY macros will now be embedded directly.

2. Each of the new api headers referenced '<proc/...>'
rather than '<procps/...>' for the debugging #include.
So, we must drop that prefix in favor of a quoted file
name so that debugging builds work regardless of where
that 'xtra-procps-debug.h' header happens to be found.

Reference(s):
. Jun, 2020 - changed target install directory
commit d64755ea5f48295f5b064da0ea667ee3503b4cd8
. Sep, 2018 - #include migrated from procps.h
commit fab37662efe92650063a45e6b20eda09afe07e14

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: added some justification emphasis, <pids> api
Jim Warner [Fri, 24 Jul 2020 15:24:57 +0000 (10:24 -0500)]
library: added some justification emphasis, <pids> api

I almost feel like I should apologize for this kind of
patch ( *almost* ). But, since this comment was unique
to the <pids> api and since it was especially designed
to align with the following comment and since the next
comment already carried the alignment emphasis, I will
refrain from issuing any apology and submit it anyway.

[ plus to prove that i am not totally anal-retentive ]
[ and can exercise some restraint there are two more ]
[ places where i COULD have added alignment emphasis ]

[ see lines 804-806 and lines 1360-1361 for my proof ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: for consistency, reposition a few man page macros
Jim Warner [Thu, 23 Jul 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agobuild-sys: suppress '-Wunused-result' with AM_CPPFLAGS
Jim Warner [Tue, 14 Jul 2020 05:00:00 +0000 (00:00 -0500)]
build-sys: suppress '-Wunused-result' with AM_CPPFLAGS

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: show allowable range in relative enum warning
Jim Warner [Mon, 13 Jul 2020 05:00:00 +0000 (00:00 -0500)]
library: show allowable range in relative enum warning

This patch just trades the 'typestr' for the much more
meaningful 'valid range' when a relative enum has been
deemed invalid under that XTRA_PROCPS_DEBUG provision.

[ and we'll also make one comment a bit more generic ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: address several 'mandoc -Tlint' errors & warnings
Jim Warner [Fri, 10 Jul 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: make that 'cpu_prt' function a tad more efficient
Jim Warner [Thu, 9 Jul 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: make the 'cpu_tics' function a tad more efficient
Jim Warner [Wed, 8 Jul 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotestsuite: Correct include
Craig Small [Sun, 5 Jul 2020 11:18:36 +0000 (21:18 +1000)]
testsuite: Correct include

procps.h got removed in the referenced commit, the test program
needs to include the correct header.

References:
 commit 1aa8b1644118ee84ff02158e1a9f409527fb5a96

4 years agobuild-sys: correct those installed development headers
Jim Warner [Wed, 1 Jul 2020 05:00:00 +0000 (00:00 -0500)]
build-sys: correct those installed development headers

These headers were used only in the library itself and
it's wrong to have them in the user include directory.

* devname.h .. is used only by: ... pids.c, readproc.c
* numa.h ..... is used only by: ....... pids.c, stat.c
* pwcache.h .. is used only by: ........... readproc.c
* readproc.h . is used only by: ..... escape.c, pids.c
* wchan.h .... is used only by: ............... pids.c

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: make that 'escape_str' private to our library
Jim Warner [Tue, 30 Jun 2020 05:00:00 +0000 (00:00 -0500)]
library: make that 'escape_str' private to our library

In that commit referenced below, a promise was made to
revisit an 'escape_str' function in efforts to make it
private to the library. The problem was it's needed by
both ps plus the library which is why it was exported.

So, in an effort to remove it from libprocps.sym, this
patch duplicates all the required code in ps/output.c.
Now, each version can be made private to their caller.

[ along the way we'll use this opportunity to remove ]
[ the 'restrict' qualifiers from function parameters ]
[ while swatting a compiler warning referenced below ]

Reference(s):
. April 2016, most escape functions made private
commit d916d5db86cbbf552401026aab15c3663412d662

proc/escape.c: In function `escape_command':
proc/escape.c:182:23: warning: initialization of `const char **' from incompatible pointer type `char **' [-Wincompatible-pointer-types]
  182 |     const char **lc = (char**)pp->cmdline;
      |                       ^

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: eliminated the questionable 'procps.h' header
Jim Warner [Tue, 30 Jun 2020 05:00:00 +0000 (00:00 -0500)]
library: eliminated the questionable 'procps.h' header

There was a time when that procps.h file served a more
traditional role. Prior to the commit referenced below
it held just macros plus manifest constants. But, with
that change, such items were replaced with a series of
includes embracing all the library exported functions.

That approach was known to disguise errors which would
have otherwise yielded a compiler warning. And without
such a warning, there was no way to address the error.

So this patch will trade the all inclusive header file
approach for individual includes only where necessary.

Reference(s):
. April 2016, procps.h header file revamped
commit ccb6ae8de14b0cde25b84369ef995bcd69cbf7b6
. Sept 2018, top abandoned use of procps.h
commit a6dfc2382ed1e023dd345cdb1d2388c9b67bcc7f

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: size two read buffers with manifest constants
Jim Warner [Mon, 29 Jun 2020 05:00:00 +0000 (00:00 -0500)]
library: size two read buffers with manifest constants

The meminfo & vmstat file read buffers are now defined
through symbolic constants next to the symbolic names.

[ recent attention to the /proc/stat buffer size led ]
[ to this (hopefully) better approach to definitions ]

Reference(s):
commit 81f4a6acdf204c5c898fa707e285cdbd2389150e

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agomisc: eliminate a couple of miscellaneous gcc warnings
Jim Warner [Sun, 28 Jun 2020 05:00:00 +0000 (00:00 -0500)]
misc: eliminate a couple of miscellaneous gcc warnings

This commit just address the two warnings shown below.

Reference(s):
pgrep.c: In function `select_procs':
pgrep.c:535:12: warning: variable `now' set but not used [-Wunused-but-set-variable]
  535 |     time_t now;
      |            ^~~

pidof.c: In function `select_procs':
pidof.c:201:9: warning: `stat_cmd' may be used uninitialized in this function [-Wmaybe-uninitialized]
  201 |        !strcmp(program, stat_cmd) ||
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agovmstat and watch manpage slight fixes
Jan Rybar [Thu, 30 Apr 2020 15:06:18 +0000 (17:06 +0200)]
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)

4 years agolibrary: raise amount by which the <stat> buffer grows
Jim Warner [Fri, 26 Jun 2020 05:00:00 +0000 (00:00 -0500)]
library: raise amount by which the <stat> buffer grows

We won't go as far as the merge request shown below in
increasing buffer size, but we will reduce by half the
total iterations while growing it to achieve one read.

[ and this seems in line with what was recently done ]
[ to help top under a massively parallel environment ]
[ 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>
4 years agodocs: just a few changes to that new pids man document
Jim Warner [Thu, 25 Jun 2020 05:00:00 +0000 (00:00 -0500)]
docs: just a few changes to that new pids man document

A patch to address the following man doc deficiencies:

. shorten NAME so there's no wrap in an 80x24 terminal
. typo wherein the 'item' parm should have been 'info'
. expand RETURN text for a potential NULL upon success

[ maybe, this might be my last tweak to this man doc ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agoNEWS: updated for those recent utf-8 translation fixes
Jim Warner [Thu, 25 Jun 2020 05:00:00 +0000 (00:00 -0500)]
NEWS: updated for those recent utf-8 translation fixes

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: response to revised numa stuff in that <stat> api
Jim Warner [Wed, 24 Jun 2020 05:00:00 +0000 (00:00 -0500)]
top: response to revised numa stuff in that <stat> api

[ actually, this patch goes a little beyond what was ]
[ strictly required. some messages were expanded for ]
[ clarity and should an inactive node be selected by ]
[ the '3' command, a second '2' no longer is needed. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: changes to some numa stuff in that <stat> api
Jim Warner [Wed, 24 Jun 2020 05:00:00 +0000 (00:00 -0500)]
library: changes to some numa stuff in that <stat> api

Now that we may be getting serious with documentation,
that stat module was revisited with an eye toward user
friendliness. Heck, even this author puzzled over some
of the existing notes and naming conventions employed.

So, this patch will adjust some identifiers and expand
the notes to (hopefully) better serve potential users.

The most significant change was making the STAT_TIC_ID
always valid for numa nodes, even if any are inactive.

Thus the -22222 special STAT_NODE_INVALID constant now
is applied only to STAT_TIC_NUMA_NODE. It will be used
on the cpu summary and reaps with STAT_REAP_CPUS_ONLY.
And it will also mark any numa node that was inactive.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agodocs: tweak both of those newly created man docs a tad
Jim Warner [Tue, 23 Jun 2020 22:29:14 +0000 (17:29 -0500)]
docs: tweak both of those newly created man docs a tad

An important fact was omitted in the DEBUGGING section
for the two newest man documents. Users must utilize a
macro in the header files before verification happens.

So, this commit will sneak in such mention and in that
way reduce future liability if the feature won't work.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agobuild-sys: tweak Makefile.am for two preceding patches
Jim Warner [Mon, 22 Jun 2020 05:00:00 +0000 (00:00 -0500)]
build-sys: tweak Makefile.am for two preceding patches

This commit cleans up some man document files. It also
changes the target install directory from the original
'proc/' to 'procps/' (feels like a more natural name).

[ and, now it agrees with those 2 preceding man docs ]
[ since it is obvious the tail was wagging this dog! ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agodocs: replace 'procps_pids' stuff with revised version
Jim Warner [Sun, 21 Jun 2020 05:00:00 +0000 (00:00 -0500)]
docs: replace 'procps_pids' stuff with revised version

The original approach contained a fatal flaw. In order
to use those man pages, users would have been required
to already know how to use the library. Or alternately
one could randomly search each of them while trying to
ascertain which function call satisfies their need and
what exactly was the proper compliment/order required.

So, this revised approach tries to simplify things and
document only what is not apparent in the header file.
Along the way, the following assumptions were germane.

1) It is the kernel folks' job to document /proc files
not to mention fields within those files. And since we
don't yet know what some of those fields represent, we
shouldn't attempt to document any of those we do know.

2) Our header file serves as an essential reference in
successful exploitation of this new library interface.

3) The description represents functions as they appear
in the header itself making them immediately familiar.

4) Armed with our header file users can easily see the
self-documenting enumerators & structures. There isn't
a need to explain them yet again in this man document.

5) Contrary to man guidelines, we shouldn't list error
codes. Simple generic guidance serves everyone better.

The following references represent a history for those
man documents this new version is intended to replace.

Reference(s):
. 04/18/16, create libproc.3 + procps_pids_new.3
commit 4217eddf474debe55a7651757ccce1e86aeb04a5
. 04/19/16, create procps_pids_read_open.3
commit d48c54f6793d5faf44e420df43a75e04372d5945
. 01/05/17, create many procps_pids_... docs
commit 2598e9f2ce39c93ebf55f664454d3bea919ed4e0

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agodocs: update 'first cut' procps.3 with revised version
Jim Warner [Sat, 20 Jun 2020 05:00:00 +0000 (00:00 -0500)]
docs: update 'first cut' procps.3 with revised version

This represents the 'second cut' at providing a shared
man page that supports more than one newlib interface.

In this approach, the following assumptions were made:

1) It is the kernel folks' job to document /proc files
not to mention fields within those files. And since we
don't yet know what some of those fields represent, we
shouldn't attempt to document any of those we do know.

2) Our header files serve as an essential reference in
successful exploitation of the new library interfaces.

3) The description represents functions as they appear
in the header itself making them immediately familiar.

4) Some inconsistencies among the interfaces have been
handled more visually rather than in a narrative form.

5) Armed with our header file users can easily see the
self-documenting enumerators & structures. There isn't
a need to explain them yet again in this man document.

6) Contrary to man guidelines, we shouldn't list error
codes. Simple generic guidance serves everyone better.

Reference(s):
. 05/19/20, procps.3 man page introduced
commit fc69028d374ae933b55b05b0f1418ac6a3da87e2

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agomisc: respond to library rename of structs to 'reaped'
Jim Warner [Fri, 19 Jun 2020 05:00:00 +0000 (00:00 -0500)]
misc: respond to library rename of structs to 'reaped'

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: rename a couple of 'reap' structs to 'reaped'
Jim Warner [Fri, 19 Jun 2020 05:00:00 +0000 (00:00 -0500)]
library: rename a couple of 'reap' structs to 'reaped'

In preparation for a documentation attempt, this patch
renames 'struct reap' to 'struct reaped' in two of our
interfaces. That will bring all the non-pid interfaces
into agreement since the <stat> api already used that.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: provide for zero length character in utf8 support
Jim Warner [Thu, 18 Jun 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agolibrary: correct that 'escape_str_utf8' guy's behavior
Jim Warner [Wed, 17 Jun 2020 13:58:50 +0000 (08:58 -0500)]
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>
4 years agotop: some miscellaneous accumulated tweaks and cleanup
Jim Warner [Mon, 15 Jun 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agodocs: some manpage fixes
Craig Small [Thu, 4 Jun 2020 12:25:26 +0000 (22:25 +1000)]
docs: some manpage fixes

Some editorial changes so the man pages follow the standards.

References:
 procps#173

4 years agotop: fix a minor startup flaw for the '2 abreast' mode
Jim Warner [Sun, 31 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: help the '#define PRETEND48CPU' be more realistic
Jim Warner [Sat, 30 May 2020 05:00:00 +0000 (00:00 -0500)]
top: help the '#define PRETEND48CPU' be more realistic

An old PRETEND8CPUS #define was reintroduced & 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>
4 years agotop: preserved those new '4' and '!' toggles in rcfile
Jim Warner [Fri, 29 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: warn users if rcfile save prevents older top read
Jim Warner [Fri, 29 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: reduce minimum terminal width with 2 abreast mode
Jim Warner [Thu, 28 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: address each of the most recent coverity warnings
Jim Warner [Wed, 27 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agoNEWS: acknowledge those two new top command provisions
Jim Warner [Mon, 25 May 2020 05:00:00 +0000 (00:00 -0500)]
NEWS: acknowledge those two new top command provisions

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: adapt former PRETEND8CPUS #define as PRETEND48CPU
Jim Warner [Sun, 24 May 2020 16:25:01 +0000 (11:25 -0500)]
top: adapt former PRETEND8CPUS #define as PRETEND48CPU

This patch simply allows for better testing of our two
new toggles: '4' (2 abreast) plus '!' (combined cpus).

It had previously been dropped under the newlib branch
since top no longer managed cpus. However, now that we
have those new toggles, it seemed worth the efforts to
once again re-imagine then implement such a provision.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: add '!' toggle for combined cpus display, man doc
Jim Warner [Sat, 23 May 2020 13:51:43 +0000 (08:51 -0500)]
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>
4 years agotop: add '!' toggle for combined cpus display, program
Jim Warner [Sat, 23 May 2020 13:51:43 +0000 (08:51 -0500)]
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>
4 years agotop: add '4' toggle for 2 abreast cpu display, man doc
Jim Warner [Fri, 22 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: add '4' toggle for 2 abreast cpu display, program
Jim Warner [Fri, 22 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agotop: eliminate a long standing extraneous comment line
Jim Warner [Thu, 21 May 2020 05:00:00 +0000 (00:00 -0500)]
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>
4 years agolibrary: misc accumulated cosmetic header file changes
Jim Warner [Wed, 20 May 2020 05:00:00 +0000 (00:00 -0500)]
library: misc accumulated cosmetic header file changes

Well gosh, I only accumulated 1 minor cosmetic change.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agodoc: First cut at new combined API doc
Craig Small [Tue, 19 May 2020 12:43:21 +0000 (22:43 +1000)]
doc: First cut at new combined API doc

Instead of repeating the same thing for each info type, use one
huge man page. Needs more work but lets see how it looks for now.

4 years agodocs: Add namespace man pages
Craig Small [Mon, 18 May 2020 11:42:49 +0000 (21:42 +1000)]
docs: Add namespace man pages

4 years agodocs: Update the uptime man pages
Craig Small [Mon, 18 May 2020 11:10:03 +0000 (21:10 +1000)]
docs: Update the uptime man pages

Three functions in the same manpage but use the so commands
to refer to the main man page.

4 years agopgrep: Allow older than selection
Craig Small [Sun, 17 May 2020 13:00:27 +0000 (23:00 +1000)]
pgrep: Allow older than selection

Re-work merge request !79 of @edneville to permit older than
selection using the new library API.

References:
 procps-ng/procps!79

4 years agowatch: add additional notes about environment
Craig Small [Tue, 12 May 2020 09:30:28 +0000 (19:30 +1000)]
watch: add additional notes about environment

References:
 procps-ng/procps!62
 commit d3e0ff5a0a1c6d123d270b822a828ff52ca8ecaf

4 years agoAdd information on WATCH_INTERVAL env var to watch documentation
Harry Wagstaff [Mon, 23 Apr 2018 10:43:47 +0000 (11:43 +0100)]
Add information on WATCH_INTERVAL env var to watch documentation

4 years agoAdd ability to specify watch interval using environment variable WATCH_INTERVAL
Harry Wagstaff [Mon, 23 Apr 2018 10:34:08 +0000 (11:34 +0100)]
Add ability to specify watch interval using environment variable WATCH_INTERVAL

4 years agovmstat: Add NEWS and revert comment from prev
Craig Small [Tue, 12 May 2020 08:57:26 +0000 (18:57 +1000)]
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 01c1b2345ee952c28a9995c5766839f43f8e5ac9

4 years agoUse wide columns for r/b too in wide mode
Ivan Skytte Jørgensen [Thu, 8 Jun 2017 12:14:50 +0000 (14:14 +0200)]
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.

References:
 procps-ng/procps!48

4 years agoFixes small bug in struct proc_t documentation.
Dylan Swiggett [Tue, 29 Nov 2016 22:34:37 +0000 (22:34 +0000)]
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)).

4 years agokill: use sigqueue to pass value with the signal.
Arun Chandrasekaran [Fri, 24 Apr 2020 09:22:47 +0000 (19:22 +1000)]
kill: use sigqueue to pass value with the signal.

New -q/--queue option for kill so it will send an integer to the
signalled process. See sigqueue(3) for details.

References:
 https://pubs.opengroup.org/onlinepubs/009695399/functions/sigqueue.html
 procps-ng/procps!32

Signed-off-by: Craig Small <csmall@dropbear.xyz>
4 years agobuild-sys: Enable testing of sigqueue
Craig Small [Tue, 28 Apr 2020 09:40:07 +0000 (19:40 +1000)]
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 7d55409b82602dac540c011000c9c5abedb5158a
 commit 2b804a532a90a98bccc5255a728da9076a5e4f4f

4 years agopgrep: use sigqueue to pass value with the signal.
Arun Chandrasekaran [Sat, 25 Apr 2020 03:15:06 +0000 (13:15 +1000)]
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>
4 years agokill: Adjust documentation for sigqueue
Craig Small [Fri, 24 Apr 2020 09:29:34 +0000 (19:29 +1000)]
kill: Adjust documentation for sigqueue

Added NEWS item
Changed the section for sigqueue as its 3 for me.

4 years agoINSTALL.md: Replace blockquotes with code blocks
Wieland Hoffmann [Fri, 17 Apr 2020 09:50:46 +0000 (09:50 +0000)]
INSTALL.md: Replace blockquotes with code blocks

The previous syntax (`> `) is for blockquotes, which don't keep newlines when
rendered. Codeblocks (` ` at the beginning of the line) do.

4 years agofree: Adjust space to really use 9 chars
Craig Small [Fri, 24 Apr 2020 07:42:58 +0000 (17:42 +1000)]
free: Adjust space to really use 9 chars

@steffhip found that while the translation hint said use 9 characters in
the free headers, it really was only 7.

Currently each line is constructed with the following (in non wide format):
Header + 6 Columns.  The header takes 7 characters and each column is 11
characters wide and prefixed with one space. Thus we have
7 + (1 + 11) * 6 = 79 characters for each line

By dropping the leading space for the first column after the header -the
header is already terminated by a colon- one could indeed provide the needed
9 letters for the header and thus have 9 + 11 * 1 + (1 + 11) * 5 = 80 Chars
per line which would fit into one line.

4 years agoFix user and group name to number conversion for uid/gid above 2^31.
Todd Lewis [Mon, 29 Oct 2018 18:33:48 +0000 (18:33 +0000)]
Fix user and group name to number conversion for uid/gid above 2^31.

4 years agotop: updated man page and copyright dates to year 2020
Jim Warner [Wed, 15 Apr 2020 05:00:00 +0000 (00:00 -0500)]
top: updated man page and copyright dates to year 2020

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agolibrary: adapted to the latest lxc conventions (again)
Jim Warner [Tue, 14 Apr 2020 05:00:00 +0000 (00:00 -0500)]
library: adapted to the latest lxc conventions (again)

Well, shit! With release 4.0 on March 25th the lxc/lxd
folks have stuck it to us once again. They changed the
cgroup lxc prefix used to identify the container name.

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agoNEWS: Add item for previous entry
Craig Small [Fri, 10 Apr 2020 04:47:32 +0000 (14:47 +1000)]
NEWS: Add item for previous entry

Added NEWS item for pidof show worker threads patch

References:
 commit 9c3296bae97a6862d716b2a74f0ef3b76b061d7c

4 years agopidof: show worker threads
Jan Rybar [Tue, 7 Apr 2020 11:41:48 +0000 (13:41 +0200)]
pidof: show worker threads

Reimplementation of pidof for procps toolset contains sort of deactivated code and does not return results for processes without task.cmdline entry (usually kernel worker threads). Old pidof and pgrep do that in comparison. Despite all perks provided by using pgrep instead, pidof should show those workers again.

4 years agoNEWS: fix top alpha order, add 'e' command line switch
Jim Warner [Sun, 29 Mar 2020 05:00:00 +0000 (00:00 -0500)]
NEWS: fix top alpha order, add 'e' command line switch

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: for symmetry with 'E' add 'e' command line switch
Jim Warner [Sun, 29 Mar 2020 05:00:00 +0000 (00:00 -0500)]
top: for symmetry with 'E' add 'e' command line switch

Several years after the 'e' & 'E' interactive commands
were introduce to affect memory scaling, an 'E' switch
was added. This was after discovering a dropped Redhat
patch which provided a unique 'M' command line switch.

If only for symmetry it makes sense to offer a similar
command switch ('e') for the Task Area memory scaling.

As was true with 'E', top's help text will show 'e' as
if it were a switch without arguments in order to keep
help text displayed without wrap in an 80x24 terminal.
The man page, however, will show all of the arguments.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/165
. 03/2017, added 'E' command line switch
commit b2bd65407a2b0c3eb88bbeb05c1d8682a2bfd958
. 12/2012, added 'e' interactive command
commit 21e550bc080eb30f503b2ca6fe4e9cb12b8a1616
. 12/2012, added 'E' interactive command
commit bc46f67f9a63c9f43c9a697b3bfa85abf721c5da

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agops: eliminated inadvertent trailing double semi-colons
Jim Warner [Wed, 11 Mar 2020 05:00:00 +0000 (00:00 -0500)]
ps: eliminated inadvertent trailing double semi-colons

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agotop: eliminate inadvertent trailing double semi-colons
Jim Warner [Wed, 11 Mar 2020 05:00:00 +0000 (00:00 -0500)]
top: eliminate inadvertent trailing double semi-colons

Signed-off-by: Jim Warner <james.warner@comcast.net>
4 years agoNEWS: synchronise the entries
Craig Small [Tue, 7 Apr 2020 09:40:35 +0000 (19:40 +1000)]
NEWS: synchronise the entries