#include <sys/select.h>

sys/select.h Kernel.framework

includes: sys/appleapiopts.h, sys/cdefs.h, sys/_types.h, sys/_types/_fd_def.h, Kernel/sys/_types/_timespec.h, Kernel/sys/_types/_timeval.h, Kernel/sys/_types/_time_t.h, Kernel/sys/_types/_suseconds_t.h, Kernel/sys/_types/_sigset_t.h, Kernel/sys/_types/_fd_setsize.h, Kernel/sys/_types/_fd_set.h, Kernel/sys/_types/_fd_clr.h, Kernel/sys/_types/_fd_isset.h, Kernel/sys/_types/_fd_zero.h, Kernel/sys/_types/_fd_copy.h, sys/kernel_types.h, kern/waitq.h, sys/event.h
3 functions · 1 variable

variableselwait

extern int selwait

functionselrecord

void selrecord(proc_t selector, struct selinfo *, void *)
Now these are the laws of VNOP_SELECT, as old and as true as the sky, And the device that shall keep it may prosper, but the device that shall break it must receive ENODEV: 1. Take a lock to protect against other selects on the same vnode. 2. Return 1 if data is ready to be read. 3. Return 0 and call `selrecord` on a handy `selinfo` structure if there is no data. 4. Call `selwakeup` when the vnode has an active `selrecord` and data can be read or written (depending on the seltype). 5. If there's a `selrecord` and no corresponding `selwakeup`, but the vnode is going away, call `selthreadclear`.

functionselwakeup

void selwakeup(struct selinfo *)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/sys_generic.c
Wakes up all threads blocked in select() or poll() that recorded interest in the selinfo via selrecord(), and posts to any attached knotes. After selrecord() has been called, the selinfo's owner must call at least one of selwakeup() or selthreadclear(); the call also tears down the selinfo's internal wait queue linkages.

functionselthreadclear

void selthreadclear(struct selinfo *)
claude-fable-5, 2026-08-23 · not from Apple sources · verified against xnu bsd/kern/sys_generic.c
Clears a selinfo that is going away, waking any threads selecting on it with THREAD_RESTART and notifying attached knotes with NOTE_REVOKE, then tearing down the wait queue linkages. Must be called before freeing a selinfo that has been passed to selrecord(), typically when the device or resource is being closed or revoked.