PFIND(9)

πŸ“¦ version 14.5, in freebsd 14.5

✨ PFIND(9) ✨

okay so this is a page from the Kernel Developer's Manual (yes, the kernel one, we're in the big leagues bestie πŸ’…) and it's all about pfind and zpfind β€” the little duo that helps you locate a process by number. iykyk 🌸


πŸŽ€ 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);

like, just include those two headers and you're literally ready to go ✨


πŸ’– DESCRIPTION πŸ’–

so pfind() takes a pid as its argument, and it returns a pointer to the proc structure whose PID is specified in the argument β€” but only if that pid is on the allproc list. no allproc, no pointer. that's the vibe check 🫢

then there's zpfind(), which also takes a pid as its argument. if zpfind() finds a process whose PID is equal to that of the argument and it's a zombie process β€” meaning it must reside on the zombproc list β€” then zpfind() returns a pointer to that proc structure. zombies stay on the zombproc list, that's just how it is πŸ§Ÿβ€β™€οΈ

and listen: both pfind() and zpfind() lock the proc structure that is returned, using PROC_LOCK(p). so the thing you get back comes pre-locked, no cap πŸ”₯


πŸ‘‘ RETURN VALUES πŸ‘‘

  • pfind() and zpfind() return a pointer to a proc structure on success πŸ’–
  • and NULL on failure 😭

that's it, that's the whole return story, periodt.


🌈 SEE ALSO 🌈

(the sibling page, go say hi ✨)


πŸ’œ AUTHORS πŸ’œ

This manual page was written by Evan Sarmiento <kaworu@sektor7.ath.cx>. iconic behavior fr fr πŸ‘‘


quick reminder bestie: these return a locked proc β€” don't forget you're holding that lock, mkay? πŸŽ€

and that's the whole page!! 🌟 this Debian edition dropped on July 11, 2001 (a vintage baddie πŸ’…) β€” mwah, go read pgfind(9) next, ily πŸ«ΆπŸ’–

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