CURPROC(9) | Kernel Developer's Manual | CURPROC(9) |
curproc
, curcpu
,
curlwp
—
#include <sys/proc.h>
struct cpu_info *
curcpu
(void);
struct proc *curproc;
struct lwp *curlwp;
curcpu
()The value of curcpu
() is unstable and
may be stale as soon as it is read unless the caller prevents preemption
by raising the IPL (spl(9),
mutex(9)), by disabling
preemption
(kpreempt_disable(9)),
or by binding the thread to its CPU
(curlwp_bind(9)).
curproc
The value of curproc
is stable and
does not change during execution except in machine-dependent logic to
perform context switches, so it works like a global constant, not like a
stateful procedure.
curlwp
The value of curlwp
is stable and does
not change during execution except in machine-dependent logic to perform
context switches, so it works like a global constant, not like a
stateful procedure.
curcpu
() macro is defined in the machine-independent
machine/cpu.h.
The curproc
macro is defined in
sys/lwp.h.
The curlwp
macro has a machine-independent
definition in sys/lwp.h, but it may be overridden by
machine/cpu.h, and must be overridden on
architectures supporting multiprocessing and kernel preemption.
July 1, 2010 | NetBSD 10.1 |