|SPLX(9)||Kernel Developer's Manual||SPLX(9)|
spltty() blocks interrupts of priority less than or equal to
IPL_TTY). The code may then safely access variables and data structures which are used by kernel code that runs at an equal or lower priority level.
spl function exists for each distinct
priority level which can exist in the system. These macros and the
corresponding priority levels are used for various defined purposes, and may
be divided into two main types: hard and soft. Hard interrupts are generated
by hardware devices, while soft interrupts are generated by callouts and
called from the kernel's periodic timer interrupt service routine.
In order of highest to lowest priority, the priority-raising macros are:
schedclock() function needs to be blocked. On some systems this is a separate clock; on others it is the same as the statistics clock and, on these,
splsched() must block everything that
splstatclock() does. Code running at or above this level may not call tsleep(9) or wakeup(9), nor may it post signals. Note that "running" means invoked by an interrupt handler that operates at this level or higher. Kernel code that operates in the context of a process and has called
splhigh() for blocking purposes can use tsleep(9) or wakeup(9).
hardclock() to update kernel and process times, and must be used by any other code that accesses time-related data.
statclock() to update kernel profiling and other statistics, and must be used by any code that accesses that data. This level is identical to
splclock() if there is no separate statistics clock.
Two macros lower the system priority level. They are:
splraise() macro blocks interrupts at
the interrupt priority level specified by ipl.
splx() macro restores the system
priority level to the one encoded in s, which must be
a value previously returned by one of the other
splassert() function checks that the
system is running at a certain priority level. The argument
s should be one of these constants:
splassert() function is optional and
is not necessarily implemented on all architectures nor enabled in all
kernel configurations. It checks the current system priority level to see if
it's at least at the level specified in the argument
s. If possible, it also checks if it hasn't been
called from an interrupt handler with a level higher than the one requested,
which must be an error (if some code is protected from
IPL_SOFTNET interrupts, but accessed from an
IPL_NET interrupt, it must be a design error in the
The behavior of the
is controlled by the kern.splassert
sysctl(8). Valid values for it are:
Any other value causes a system panic on errors.
|August 16, 2016||OpenBSD-current|