Copyright (c) 2015 Mark Johnston <markj@FreeBSD.org> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other...
NAMEPHOLD - hold a process
SYNOPSISIn sys/proc.h Fn PHOLD struct proc *p Fn _PHOLD struct proc *p Fn PRELE struct proc *p Fn _PRELE struct proc *p Fn PROC_ASSERT_HELD struct proc *p Fn PROC_ASSERT_NOT_HELD struct proc *p
DESCRIPTIONThe Fn PHOLD macro increments the hold count of a process, and the Fn 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 Fn _PHOLD and Fn _PRELE macros are identical to Fn PHOLD and Fn PRELE , except that they must be called with the process lock held.