PHOLD(9)
π PHOLD(9) β the "hold a process" manual, bestie edition π
okay so this is a Kernel Developer's Manual page, and today's main character is PHOLD β the macro that literally just holds a process. iconic behaviour honestly.
πΈ NAME πΈ
PHOLD β hold a process π«Ά
β¨ SYNOPSIS β¨
like, here's the whole cast, no cap:
#include <sys/proc.h>
PHOLD(struct proc *p);
_PHOLD(struct proc *p);
PRELE(struct proc *p);
_PRELE(struct proc *p);
PROC_ASSERT_HELD(struct proc *p);
PROC_ASSERT_NOT_HELD(struct proc *p);
π DESCRIPTION π
so the PHOLD() macro increments the hold count of a process, and the PRELE() macro decrements the hold count of a process. that's it, that's the vibe. π
and here's the part where it gets kind of serious, so listen up bestie π«Ά β if a process with a non-zero hold count tries to exit, it will sleep until its hold count has reached zero before the kernel begins releasing resources associated with the process. the way I think about it: nobody leaves the group chat until everyone's done holding. π
once a process has started exiting, it is invalid to increase its hold count. so callers must not attempt to hold a process that has the P_WEXIT flag set. π« (fr fr, don't do it.)
also the VM daemon will not swap out the kernel stack of a thread belonging to a process with a non-zero hold count. so that stack is staying right where it is, periodt. π
The _PHOLD() and _PRELE() macros are identical to PHOLD() and PRELE(), except that they must be called with the process lock held. π iykyk.
π AUTHORS π
This manual page was written by Mark Johnston <markj@FreeBSD.org>. slay, thank you Mark. π
that's the whole page, bestie β go forth and hold those processes responsibly β¨π¦πΈ
Debian Β· November 7, 2015 π β mwah, that's a wrap on the PHOLD(9) page, version and date and all π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2015 Mark Johnston <markj@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms