#include <kern/work_interval.h>

kern/work_interval.h Kernel.framework

11 functions · 3 structs

structkern_work_interval_args

size 56, align 8
uint64_twork_interval_id
uint64_tstart
uint64_tfinish
uint64_tdeadline
uint64_tnext_start
uint32_tnotify_flags
uint32_tcreate_flags
uint16_turgency

structkern_work_interval_create_args

size 16, align 8
uint64_twica_idout param
mach_port_name_twica_portout param
uint32_twica_create_flags

structkern_work_interval_workload_id_args

size 32, align 8
uint32_twlida_flagsin/out param
uint32_twlida_wicreate_flagsin/out param
char *wlida_namein param
uint64_t[2]wlida_syscall_maskout param

functionkern_work_interval_create

extern kern_return_t kern_work_interval_create(
	thread_t thread,
	struct kern_work_interval_create_args *create_params
)
Allocate/assign a single work interval ID for a thread, and support deallocating it.

functionkern_work_interval_get_flags_from_port

extern kern_return_t kern_work_interval_get_flags_from_port(
	mach_port_name_t port_name,
	uint32_t*flags
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/work_interval.c
Returns through flags the creation flags (WORK_INTERVAL_FLAG_*) of the work interval named by port_name in the current space. Returns KERN_INVALID_ARGUMENT/KERN_INVALID_NAME if the port is not a valid work interval port, else KERN_SUCCESS. The work interval reference taken for the lookup is dropped before return.

functionkern_port_name_to_work_interval

extern kern_return_t kern_port_name_to_work_interval(
	mach_port_name_t name,
	struct work_interval **work_interval
)
A private interface for kevent subsystem. Returns a +1 ref to the work_interval associated with a given port.

functionkern_work_interval_get_policy

extern kern_return_t kern_work_interval_get_policy(
	struct work_interval *work_interval,
	integer_t *policy,
	integer_t *priority
)
A private interface for kevent subsystem. Returns following scheduling policies associated with a work interval, if available. : Priority : Scheduling policy/mode

functionkern_work_interval_release

extern void kern_work_interval_release(struct work_interval *work_interval)
A private interface for kevent subsystem. Routine to release a ref count on the work interval. For more information, see work_interval_release.

functionkern_work_interval_explicit_join

extern kern_return_t kern_work_interval_explicit_join(
	thread_t thread,
	struct work_interval *work_interval
)
A private interface for workqueue subsystem. Routine to join a work interval specified in @work_interval argument. It takes +1 ref on the work interval and passes it to the thread as a part of join the work interval. Expects @thread to be the calling thread.

functionkern_work_interval_destroy

extern kern_return_t kern_work_interval_destroy(
	thread_t thread,
	uint64_t work_interval_id
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/work_interval.c
Un-joins the given thread from the work interval identified by work_interval_id. Returns KERN_INVALID_ARGUMENT if the id is 0 or does not match the work interval the thread has joined; otherwise the thread's work interval association is cleared and KERN_SUCCESS is returned.

functionkern_work_interval_join

extern kern_return_t kern_work_interval_join(thread_t thread, mach_port_name_t port_name)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/work_interval.c
Joins the given thread to the work interval named by port_name, adopting its thread group and scheduling properties; a port_name of MACH_PORT_NULL un-joins the thread from its current work interval. The work interval must have been created with WORK_INTERVAL_FLAG_JOINABLE. Returns a port-translation error for an invalid name, or the result of the join.

functionkern_work_interval_notify

extern kern_return_t kern_work_interval_notify(
	thread_t thread,
	struct kern_work_interval_args* kwi_args
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/work_interval.c
Notifies the performance controller of a completed frame/period for the work interval the calling thread has adopted, passing start, finish, deadline and complexity data in kwi_args; the thread's scheduling urgency is filled into kwi_args->urgency. Returns KERN_INVALID_ARGUMENT unless the thread has joined the work interval identified by kwi_args->work_interval_id and the calling task is the interval's creator.

functionkern_work_interval_set_name

extern kern_return_t kern_work_interval_set_name(
	mach_port_name_t port_name,
	char *name,
	size_t len
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/work_interval.c
Sets a debugging name for the work interval named by port_name; when the interval owns a thread group, the group is renamed to "WI<id> <name>". Returns KERN_INVALID_ARGUMENT if len exceeds WORK_INTERVAL_NAME_MAX, if a thread has already joined the interval, or if it has no thread group; a port-translation error for an invalid name; else KERN_SUCCESS.

functionkern_work_interval_set_workload_id

extern kern_return_t kern_work_interval_set_workload_id(
	mach_port_name_t port_name,
	struct kern_work_interval_workload_id_args *workload_id_args
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/work_interval.c
Associates a workload identifier (looked up in the workload configuration table) with the work interval named by port_name, applying the configured scheduling properties and creating the deferred thread group. The interval must have been created with WORK_INTERVAL_FLAG_JOINABLE and WORK_INTERVAL_FLAG_HAS_WORKLOAD_ID, the id name must be non-empty, the configured type must match the interval's type, and the id must be set before any thread joins; violations return KERN_INVALID_ARGUMENT. Ids not found in the table fall back to basic validation of the creation flags.