PGET(9) | Kernel Developer's Manual | PGET(9) |
pget
— locate a
process by number
#include
<sys/param.h>
#include <sys/proc.h>
int
pget
(pid_t
pid, int flags,
struct proc **pp);
This function takes a pid as its argument,
which can be either a process or thread id, and fills a pointer to the
proc structure in *pp. In the
latter case, a process owning the specified thread is looked for. The
operation is performed by invoking the pfind(9) function.
The found process is returned locked. For the
PGET_HOLD
case, it is returned unlocked (but held).
The
pget
()
function can perform additional manipulations, depending on a
flags argument.
The flags argument is the logical OR of some subset of:
PGET_HOLD
PGET_CANSEE
PGET_CANDEBUG
PGET_ISCURRENT
PGET_NOTWEXIT
P_WEXIT
set.PGET_NOTINEXEC
P_INEXEC
set.PGET_NOTID
PID_MAX
.PGET_WANTREAD
PGET_HOLD
| PGET_CANDEBUG
| PGET_NOTWEXIT
).If the process is found in the specified way, then zero is returned, otherwise an appropriate error code is returned.
May 3, 2014 | Debian |