openproc, closeproc - initialize process information from /proc/
#include <proc/readproc.h>
PROCTAB* openproc (int flags, ... );
void closeproc (PROCTAB* PT);
The openproc function initializes a PROCTAB structure which can be used by iterated readproc calls to get information on current processes. Depending on flags, openproc may need a second argument or a second and third argument (see below).
closeproc closes all files opened by openproc and deallocates the memory allocated by openproc.
The PROCTAB structure is defined in <proc/readproc.h>
openproc returns a pointer to a PROCTAB structure, or NULL if an error occurs. This usually means that /proc cannot be read by the process.
The behaviour of openproc is controlled by the following set of flags, which may be ORed together. There are three different kinds of flags. The first group of flags determines which information gets read from /proc/#pid for each process. The second group of flags (of which only one can be enacted for a opendir call) restricts which processes information is read for by providing a list of criteria. The third group of flags restricts this as well, but doesn't need arguments. These may be used together again.
read information from /proc/#pid/statm
allocate cmdline part of proc_t and read information from /proc/#pid/cmdline
allocate environ part of proc_t and read information from /proc/#pid/environ
resolve user ids to names via /etc/passwd
resolve group ids to names via /etc/group
read information from /proc/#pid/status
read information from /proc/#pid/stat
equivalent to PROC_FILLCOM
alloc and fill in cgroup
resolve supplementary group id -> group name
fill in proc_t oom_score and oom_adj
fill in proc_t namespace information
fill in proc_t systemd information
threat threads as if they were processes
lookup only processes whose pid is contained in pidlist (the list is terminated with 0)
lookup only processes whose user id is contained in uidlist (where n is the number of uids contained in the list)
edit cgroup as single vector
edit cmdline as single vector
edit environ as single vector
Only one of the flags needing additional arguments (PROC_{PID,UID}) may be used at a time.
readproc(3), readproctab(3), /proc/, /usr/include/proc/readproc.h,