PROC_FIND(9)
π PROC_FIND(9) β bestie's guide to finding procs and pgrps π
okay so this is a page from the Kernel Developer's Manual, and honestly? it's giving "short but essential" β¨ like it's not long but it ate.
πΈ NAME πΈ
proc_find, pgrp_find β your two new besties for finding a process or a process group π«Ά
β¨ SYNOPSIS β¨
#include <sys/proc.h>
struct proc *
proc_find(pid_t pid);
struct pgrp *
pgrp_find(pid_t pgid);
extern kmutex_t *proc_lock;
like yes, that's the whole vibe. three lines of declarations and we're off π
π¦ DESCRIPTION π¦
okay so listen: proc_find() and pgrp_find() are the functions that go retrieve your process and process group structures for you π β specifically, proc_find() takes a process ID (pid) and pgrp_find() takes a process group ID (pgid).
and here's the part you cannot skip, bestie, no cap: both functions must be called by holding a mutex(9) on proc_lock. both of them. every single time. this is not optional, this is not a "maybe", this is the whole rules of the game π₯
π RETURN VALUES π
upon successful completion, the described functions return a pointer to either struct proc or struct pgrp π β so like, congrats, you got your struct, iconic.
otherwise, if the requested ID was not found, NULL is returned π so like, check that pointer. fr fr.
π SEE ALSO π
ngl the proc_lock thing is the main character of this whole page β hold the mutex, or don't come crying to me π
and that's the whole page, bestie! this gem is from Debian, dated July 1, 2010, and it lives in the Kernel Developer's Manual section π mwah, go hold that lock π§β¨
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2010 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms