Created a test process test_shm that allocates a shared memory
segment and prints the segment ID. pmap testsuite runs pmap to
check that the segment is found.
The value returned by shmget() is the same value that is printed
in the fifth column /proc/<PID>/maps
Signed-off-by: Craig Small <csmall@dropbear.xyz>
For some unknown reason, make check doesn't depend on either
the check programs or the actual programs under test. This means
if you try to run make check right off the bat from a clean git
repositorty, it will fail as it won't be able to run the unbuilt
binaries.
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>
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>
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>
So as to not obscure the results from this new target,
we'll redirect that final 'make clean' output to null.
Signed-off-by: Jim Warner <james.warner@comcast.net>
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
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 e616409aa4
commit 92d0297e1ehttps://www.freelists.org/post/procps/keep-on-patchin,19
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>
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>
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>
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 d916d5db86
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>
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 ccb6ae8de1
. Sept 2018, top abandoned use of procps.h
commit a6dfc2382e
Signed-off-by: Jim Warner <james.warner@comcast.net>
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>
--------------- Original Master Branch Commit Message:
Update NEWS with the version
Add library API change into NEWS
Update c:r:a for library to 7:0:1
This means the current and age are incremented, so old programs can
use new library but not vice-versa as they won't have the numa*
functions.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Now that the procio logic was removed from the library
we must move the header file, lest we break make dist.
In the process, we will relocate that source file too.
[ we'll take a slightly different approach than that ]
[ used under the master branch by exploiting those 2 ]
[ non-library directories 'include' and 'lib', while ]
[ avoiding any sysctl hard coded function prototype. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
The procio functions that were in the library have been
moved into sysctl. sysctl is not linked to libprocps in
newlib and none of the other procps binaries would need
to read/write large data to the procfs.
References:
be6b048a41
to be able to read and write large buffers below /proc.
The buffers and file offsets are handled dynamically
on the required buffer size at read, that is lseek(2)
is used to determine this size. Large buffers at
write are split at a delimeter into pieces and also
lseek(2) is used to write each of them.
Signed-off-by: Werner Fink <werner@suse.de>
In response to that suggestion referenced below, these
changes allow display of task/thread level NUMA nodes.
Currently, only the 'top' program offers any NUMA type
support and it is limited to the Summary Area display.
With this commit both the 'top' and 'ps' programs will
be able to display NUMA nodes associated with threads.
Reference(s):
https://gitlab.com/procps-ng/procps/issues/58
Signed-off-by: Jim Warner <james.warner@comcast.net>
During development, we now have a means for validating
that a type referenced in application code matches the
actual type set by the library. The new feature can be
activated through either of the following two methods:
1) ./configure CFLAGS='-DXTRA_PROCPS_DEBUG' (all pgms)
2) an #include <proc/xtra-procps-debug.h> (single pgm)
[ in the future, one could add a formal configure.ac ]
[ provision. but for now a manual approach is safer. ]
Lastly, for any module which provides a sort function,
the handling for both 'noop' & 'extra' enumerators was
made consistent. Now, 'noop' is not sorted and 'extra'
will be sorted as that module's widest supported type.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Where possible, libprocps files convey the name of the
actual source pseudo file under the '/proc' directory.
This brings diskstats into line with such an approach.
Signed-off-by: Jim Warner <james.warner@comcast.net>
Previously there was a commit to change all noinst_PROGRAMS into
check_PROGRAMS. This was not a good idea.
check_PROGRAMS are built before TESTS are run. However they are
NOT build before the dejagnu tests are run, causing those tests
to fail.
So:
If the program is required for dejagnu, it needs to go into
noinst_PROGRAMS
If the program is required for TESTS or is one of those TESTS,
it needs to go into check_PROGRAMS
For some unknown reason, check_PROGRAMS are not built before check.
They are built before recheck and after check, which isn't very
useful.
This means any tests by dejagnu that need those programs will fail.
On my console I get a build error, the CI merrily reports the error
but considers the build OK; go figure.
The kludge adds check_PROGRAMS to be a dependency to check.
Note, TESTS don't need to be included in this, because they are
properly compliled after the dejagnu tests but before they are
run.
Where possible, libprocps files convey the name of the
actual source pseudo file under the '/proc' directory.
This patch brings slab into line with such a standard.
Signed-off-by: Jim Warner <james.warner@comcast.net>
In an attempt to normalize the 'stat' interface, we'll
first shed any reminders of the old readproc interface
by changing file names to be more descriptive & brief.
Signed-off-by: Jim Warner <james.warner@comcast.net>
With the configure option --enable-harden-flags the CFLAGS and
LDFLAGS are manipulated to provide some hardening protection
to the binaries.
psmisc uses these flags on by default with no troubles, however
it doesn't have a library in it either.
References:
https://wiki.debian.org/Hardening
Generalised the library API tests and created a common
test-runner. Instead of copy and pasting the same code in
each time.
First cut of pids API test, for _new so far.