#include <sys/systm.h>
sys/systm.h
macroSYSINIT
#define SYSINIT(a, b, c, d, e)
macroMALLOC_DEFINE
#define MALLOC_DEFINE(a, b, c)
macrogetenv_int
#define getenv_int(a, b) (*b = 0)
macroKASSERT
#define KASSERT(exp, msg)
functionnullop
int nullop(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/subr_xxx.c
Generic null operation; always returns 0 (success). Installed in device switch and operation tables for entry points that require no action.
functionnulldev
int nulldev(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/subr_xxx.c
Null device routine; always returns 0. Placed in insignificant entries of the bdevsw and cdevsw device switch tables.
functionenoioctl
int enoioctl(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/subr_xxx.c
Returns ENOTTY. Stub installed for device entry points that do not support ioctl.
functionenosys
int enosys(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/subr_xxx.c
Returns ENOSYS. Stub used for an otherwise-reasonable operation that is not supported by the current system binary.
functionenxio
int enxio(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/subr_xxx.c
Returns ENXIO. Stub installed in device switch tables for devices that are not configured.
functioneopnotsupp
int eopnotsupp(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/subr_xxx.c
Returns ENOTSUP, for an operation not supported on a specific object or file type. The xnu source notes the routine's name is historical and does not match the errno it returns.
functionhashinit
void *hashinit(int count, int type, u_long *hashmask)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/kern_subr.c
Allocates and zero-fills a hash table of list heads whose length is the largest power of two not greater than count, and stores the bucket mask (length - 1) through hashmask for indexing the table. The type argument, a legacy BSD malloc type, is ignored. Panics if count is not positive; returns NULL only on allocation failure. Free the table with hashdestroy, passing the same hashmask.
functionhashdestroy
void hashdestroy(void *, int type, u_long hashmask)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/kern_subr.c
Frees a hash table allocated by hashinit. hashmask must be the mask hashinit returned (asserted to be one less than a power of two); the type argument is ignored.
functionovbcopy
void ovbcopy(const void *from, void *to, size_t len)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/x86_64/loose_ends.c
Copies len bytes from from to to, like bcopy, but recognizes overlapping source and destination ranges and copies in the direction that handles them correctly (memmove semantics).
functionfubyte
int fubyte(user_addr_t addr)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Fetches one byte from the given user-space address of the current process via copyin. Returns the byte value (0-255), or -1 if the address cannot be read.
functionfuibyte
int fuibyte(user_addr_t addr)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Identical to fubyte: fetches one byte from the given user-space address via copyin, returning the byte value or -1 on fault. Historically the variant that was safe from interrupt context; in xnu the two are the same.
functionsubyte
int subyte(user_addr_t addr, int byte)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Stores the low-order byte of byte at the given user-space address of the current process via copyout. Returns 0 on success, -1 on fault.
functionsuibyte
int suibyte(user_addr_t addr, int byte)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Identical to subyte: stores the low-order byte of byte at the given user-space address via copyout, returning 0 on success and -1 on fault. Historically the interrupt-safe variant; in xnu the two are the same.
functionfuword
long fuword(user_addr_t addr)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Fetches a 32-bit word (sizeof(int), despite the long return type) from the given user-space address via copyin. Returns the value, or -1 on fault; note -1 is also a legitimate stored value, so the failure return is ambiguous.
functionfuiword
long fuiword(user_addr_t addr)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Identical to fuword: fetches a 32-bit word from the given user-space address, returning the value or -1 on fault. Historically the interrupt-safe variant; in xnu the two are the same.
functionsuword
int suword(user_addr_t addr, long word)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Stores the low-order 32 bits (sizeof(int), despite the long parameter type) of word at the given user-space address via copyout. Returns 0 on success, -1 on fault.
functionsuiword
int suiword(user_addr_t addr, long word)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Identical to suword: stores the low-order 32 bits of word at the given user-space address, returning 0 on success and -1 on fault. Historically the interrupt-safe variant; in xnu the two are the same.
macrofusize
#define fusize(_a) ((user_size_t)fulong(_a))
macrosusize
#define susize(_a, _s) sulong((_a), (_s))
macrofuptr
#define fuptr(a) ((user_addr_t)fulong(_a)
macrosuptr
#define suptr(_a, _p) sulong((_a), (_p))
functionuseracc
int useracc(user_addr_ut addr, user_size_ut len, int prot)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/vm/vm_unix.c
Returns nonzero if the current task's address map permits access to the user address range addr through addr + len, checking VM_PROT_READ when prot is B_READ and VM_PROT_WRITE otherwise (vm_map_check_protection). Checks map protections only; it does not fault pages in or guard against concurrent unmapping, so a subsequent copyin or copyout can still fail.
typedeftimeout_fcn_t
typedef void (*timeout_fcn_t)(void *)
functionbsd_timeout
void bsd_timeout(void (*)(void *), void *arg, struct timespec * ts)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/kern_clock.c
Schedules fcn to be called with arg after the interval given by ts, via a delayed thread call (thread_call_func_delayed); the callout runs in thread-call context. A NULL or zero ts schedules the function to run immediately. Cancel with bsd_untimeout.
functionbsd_untimeout
void bsd_untimeout(void (*)(void *), void *arg)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/kern_clock.c
Cancels a pending bsd_timeout callout identified by the function and argument pair (thread_call_func_cancel, without waiting for a running callout). The xnu source marks this mechanism deprecated because cancellation by function/argument is very inefficient; new code should use an allocated thread call instead.
functionset_fsblocksize
void set_fsblocksize(struct vnode *)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
For a block-device vnode (VBLK), re-derives the device's block size by calling the device's bdevsw d_psize entry, defaulting to DEV_BSIZE if the routine is missing or fails, and stores it in the vnode (v_specsize) under the vnode lock. Vnodes of other types, and majors beyond the bdevsw table, are ignored. Called by file systems after changing a device's block size so that subsequent buffer I/O against the device vnode uses the new size.
functiontvtoabstime
uint64_t tvtoabstime(struct timeval *)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/kern_time.c
Converts a struct timeval interval to Mach absolute-time units, converting the seconds and microseconds components separately with clock_interval_to_absolutetime_interval and summing them.
functiontstoabstime
uint64_t tstoabstime(struct timespec *)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/kern/kern_time.c
Converts a struct timespec interval to Mach absolute-time units, converting the seconds and nanoseconds components separately with clock_interval_to_absolutetime_interval and summing them.
functionthrottle_info_create
void *throttle_info_create(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Allocates a throttle info structure used for low-priority I/O throttling and returns an opaque pointer for the file system to pass to throttle_info_update. A reference is taken on the structure; every create must be balanced by a throttle_info_release.
functionthrottle_info_mount_ref
void throttle_info_mount_ref(mount_t mp, void * throttle_info)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Attaches the throttle info structure to the mount point, taking a reference on it; the association is used by the cluster I/O layer. File systems that call throttle_info_create must call this from their mount routine and balance it with throttle_info_mount_rel in their unmount routine. Any throttle info previously attached to the mount is released first. A NULL mount or throttle info is ignored.
functionthrottle_info_mount_rel
void throttle_info_mount_rel(mount_t mp)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Releases the throttle info reference attached to the mount point by throttle_info_mount_ref and clears the association. File systems that called throttle_info_mount_ref must call this in their unmount routine.
functionthrottle_info_release
void throttle_info_release(void *throttle_info)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Drops the reference taken by throttle_info_create, freeing the throttle info structure when the last reference is gone. Must be called once for every throttle_info_create. NULL is ignored.
functionthrottle_info_update
void throttle_info_update(void *throttle_info, int flags)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Records an I/O against the given throttle info for throttled-I/O bookkeeping; usually called before every I/O. If the calling thread runs at a throttled I/O tier, opens or refreshes a lowpri I/O window that throttle_lowpri_io will later honor; I/Os flagged B_PASSIVE in flags do not open a throttle window. Low overhead and never sleeps. A NULL throttle_info is ignored.
functionthrottle_lowpri_io
uint32_t throttle_lowpri_io(int sleep_amount)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Called by a thread at the end of an I/O to pay the low-priority I/O penalty. If the current uthread has an open throttle window, blocks until woken by the throttle timer or a rethrottle, waiting at most sleep_amount throttle I/O periods; sleep_amount 0 performs only bookkeeping and does not sleep. Closes the thread's window and drops its reference on the throttle info. Returns the number of times the thread blocked, 0 if it was not throttled. Kernel-fault paths are never throttled.
functionthrottle_lowpri_io_will_be_throttled
int throttle_lowpri_io_will_be_throttled(int sleep_amount)
returns TRUE if the throttle_lowpri_io called with the same sleep_amount would've slept
functionthrottle_set_thread_io_policy
void throttle_set_thread_io_policy(int policy)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Sets the current thread's I/O policy; policy may be IOPOL_NORMAL, IOPOL_THROTTLE, IOPOL_PASSIVE, IOPOL_UTILITY, or IOPOL_STANDARD, with the semantics described in setiopolicy_np(2). Wrapper around proc_set_thread_policy(TASK_POLICY_IOPOL).
functionthrottle_get_thread_effective_io_policy
int throttle_get_thread_effective_io_policy(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Returns the current thread's effective I/O policy (IOPOL_* value), as computed by proc_get_effective_thread_policy with TASK_POLICY_IO.
functionthrottle_thread_io_tier_above_metadata
int throttle_thread_io_tier_above_metadata(void)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Returns nonzero if the current thread's effective I/O tier is above the metadata tier (numerically less than IOSCHED_METADATA_TIER), i.e. its I/O takes priority over file system metadata I/O.
typedefthrottle_info_handle_t
typedef struct __throttle_info_handle *throttle_info_handle_t
functionthrottle_info_ref_by_mask
int throttle_info_ref_by_mask( uint64_t throttle_mask, throttle_info_handle_t *throttle_info_handle )
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Returns, through throttle_info_handle, a referenced handle for the throttle info of the device identified by the lowest set bit of throttle_mask (a mount's mnt_throttle_mask). Returns 0 on success, EINVAL if throttle_info_handle is NULL or throttle_mask is 0. The handle must be released with throttle_info_rel_by_mask.
functionthrottle_info_rel_by_mask
void throttle_info_rel_by_mask(throttle_info_handle_t throttle_info_handle)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Releases the throttle info reference held by a handle obtained from throttle_info_ref_by_mask.
functionthrottle_info_update_by_mask
void throttle_info_update_by_mask(void *throttle_info_handle, int flags)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Records an I/O against the throttle info identified by a handle from throttle_info_ref_by_mask; equivalent to throttle_info_update on the underlying throttle info, with the same flags (B_PASSIVE I/Os do not open a throttle window). Usually called before every I/O; low overhead, never sleeps.
functionthrottle_info_disable_throttle
void throttle_info_disable_throttle(int devno, boolean_t isfusion)
▾
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/miscfs/specfs/spec_vnops.c
Marks the throttle info for the given device number as disabled; used for devices whose driver performs its own I/O scheduling. If isfusion is true (the device is part of a Fusion pair), software throttling remains enabled with priority handling and the throttle periods are reset to hard-disk values. Panics if devno is not in [0, LOWPRI_MAX_NUM_DEV).
functionthrottle_info_io_will_be_throttled
int throttle_info_io_will_be_throttled(void *throttle_info_handle, int policy)
'throttle_info_handle' acquired via 'throttle_info_ref_by_mask'
'policy' should be specified as either IOPOL_UTILITY or IPOL_THROTTLE,
all other values will be treated as IOPOL_NORMAL (i.e. no throttling)