PFIND(9) BSD Kernel Developer's Manual PFIND(9)NAME
pfind, zpfind -- locate a process by number
SYNOPSIS
#include <sys/param.h>
#include <sys/proc.h>
struct proc *
pfind(pid_t pid);
struct proc *
zpfind(pid_t pid);
DESCRIPTION
pfind() takes a pid as its argument and returns a pointer to the proc structure whose PID is specified in the argument only if the pid is on
the allproc list.
zpfind() takes a pid as its argument. If zpfind() finds a process whose PID is equal to that of argument and is a zombie process, meaning
that it must reside on the zombproc list, zpfind() returns a pointer to that proc structure.
Both pfind() and zpfind() lock the proc structure that is returned using PROC_LOCK(p).
RETURN VALUES
pfind() and zpfind() return a pointer to a proc structure on success and a NULL on failure.
SEE ALSO pgfind(9)AUTHORS
This manual page was written by Evan Sarmiento <kaworu@sektor7.ath.cx>.
BSD July 11, 2001 BSD
Check Out this Related Man Page
PGET(9) BSD Kernel Developer's Manual PGET(9)NAME
pget -- locate a process by number
SYNOPSIS
#include <sys/param.h>
#include <sys/proc.h>
int
pget(pid_t pid, int flags, struct proc **pp);
DESCRIPTION
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 If set, the found process will be held and unlocked.
PGET_CANSEE If set, the found process will be checked for its visibility. See p_cansee(9).
PGET_CANDEBUG If set, the found process will be checked for its debuggability. See p_candebug(9).
PGET_ISCURRENT If set, the found process will be checked that it matches the current process context.
PGET_NOTWEXIT If set, the found process will be checked that it does not have the process flag P_WEXIT set.
PGET_NOTINEXEC If set, the found process will be checked that it does not have the process flag P_INEXEC set.
PGET_NOTID If set, pid is not assumed as a thread id for values larger than PID_MAX.
PGET_WANTREAD If set, the found process will be checked that the caller may get a read access to its structure. A shorthand for (PGET_HOLD
| PGET_CANDEBUG | PGET_NOTWEXIT).
RETURN VALUES
If the process is found in the specified way, then zero is returned, otherwise an appropriate error code is returned.
SEE ALSO p_candebug(9), p_cansee(9), pfind(9)BSD May 3, 2014 BSD