Psetflags
,
Punsetflags
—
set and unset process flags
Process Control Library (libproc, -lproc)
#include
<libproc.h>
int
Psetflags
(
struct
ps_prochandle *P,
long flags);
int
Punsetflags
(
struct
ps_prochandle *P,
long flags);
The
Psetflags
() and
Punsetflags
() functions manipulate the
process flags for the process handle
P. The
process flags determine how the process behaves in the face of various
actions. For example, setting the
PR_FORK flag
indicates that the tracing flags of the process and the inherit-on-fork mode
should be set on children. A full list of the process flags is available in
the
PCSET section in
proc(4).
The
Psetflags
() function sets the flags
specified in
flags by doing a
bitwise-inclusive-OR with the previously set flags.
The
Punsetflags
() function removes the flags
specified in
flags from the tracing flags of
the process. Items not listed in
flags will
remain.
To see the current set of flags active on the process, check the
pr_flags member of the
pstatus_t for the process. It can be obtained
through the
Pstatus(3PROC) function.
Note, attempting to modify the process flags only works on active processes.
Attempting to call these functions of process handles corresponding to core
files, zombie processes, or files, will result in an error.
Upon successful completion, the
Psetflags
()
and
Punsetflags
() functions return
0. Otherwise,
-1 is
returned and
errno is set to indicate the error.
For a full list of possible errors see the
DIAGNOSTICS section in
proc(4).
Uncommitted
See
LOCKING in
libproc(3LIB).
libproc(3LIB),
Pstatus(3PROC),
proc(4)