PFIND(9)

NAME
pfind, pfind_any, pfind_any_locked - locate a process by number

SYNOPSIS
#include <sys/param.h>
#include <sys/proc.h>
struct proc *
pfind(pid_t pid);
struct proc *
pfind_any(pid_t pid);
struct proc *
pfind_any_locked(pid_t pid);

DESCRIPTION
The pfind() function walks the list of processes in the system, looking for the one with a process ID of pid. If the process exists, and is not in the zombie state, a pointer to the process structure will be returned.

pfind_any() takes a pid as its argument. pfind_any() searches the allproc list and returns the first process with a matching PID, whose state may be PRS_ZOMBIE.

pfind_any_locked() is similar to pfind_any(), but it does not lock the process hash bucket for the given pid. Instead, it asserts the corresponding process hash bucket is already locked.

All three functions pfind(), pfind_any(), and pfind_any_locked() lock the proc structure before returning.

RETURN VALUES
pfind(), pfind_any(), and pfind_any_locked() return pointer to a proc structure on success or NULL on failure.

SEE ALSO
pget(9), pgfind(9)

AUTHORS
This manual page was written by Evan Sarmiento <kaworu@sektor7.ath.cx>.