PHOLD(9)

PHOLD9

Hold a process

Usage

#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);

Overview

The PHOLD() macro increments the hold count of a process, and the PRELE() macro decrements the hold count of a process.

If a process with a non-zero hold count attempts to exit, it will sleep until its hold count has reached zero before the kernel begins releasing resources associated with the process. Once a process has started exiting, it is invalid to increase its hold count. Thus, callers must not attempt to hold a process that has the P_WEXIT flag set. The VM daemon will not swap out the kernel stack of a thread belonging to a process with a non-zero hold count.

The _PHOLD() and _PRELE() macros are identical to PHOLD() and PRELE(), except that they must be called with the process lock held.

Releases

25 releases since FreeBSD 11.0-RELEASE; the text changed 11 times.

  1. 11.0
  2. 11.1
  3. 11.2
  4. 11.3
  5. 11.4
  6. 12.0
  7. 12.1
  8. 12.2
  9. 12.3
  10. 12.4
  11. 13.0–13.2
  12. 13.3–16.0

Authors

This manual page was written by Mark Johnston ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.