PFIND(9)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’– PFIND(9) β€” locate a process by number πŸ’–

okay so this is from the Kernel Developer's Manual, section 9, and we're doing a little process-hunting expedition, bestie. no cap. 🫢

πŸŽ€ 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 πŸ¦‹

okay so pfind() is the main character here: it walks the list of processes in the system, looking for the one with a process ID of pid. if that process exists, and is not in the zombie state, you get a pointer to the process structure back. slay. πŸ’…

pfind_any() takes a pid as its argument too. it searches the allproc list and returns the first process with a matching PID, and its state may be PRS_ZOMBIE β€” so yes, zombies are allowed here, no cap. πŸ§Ÿβ€β™€οΈ

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. iykyk. πŸ”

all three functions β€” pfind(), pfind_any(), and pfind_any_locked() β€” lock the proc structure before returning. periodt. πŸ‘‘

🌸 RETURN VALUES 🌸

pfind(), pfind_any(), and pfind_any_locked() return pointer to a proc structure on success or NULL on failure. that's the whole vibe check. ✨

πŸ¦‹ SEE ALSO πŸ¦‹

πŸ’œ AUTHORS πŸ’œ

this manual page was written by Evan Sarmiento <kaworu@sektor7.ath.cx>. iconic. 🫢


Debian Β· November 3, 2025 Β· PFIND(9) β€” mwah πŸ’‹

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms