#include <sys/kern_control.h>

sys/kern_control.h

@header kern_control.h This header defines an API to communicate between a kernel extension and a process outside of the kernel.
7 macros · 3 structs

macroKPI_KERN_CONTROL_H

#define KPI_KERN_CONTROL_H 

macroKEV_CTL_SUBCLASS

@defined KEV_CTL_SUBCLASS @discussion The kernel event subclass for kernel control events.
#define KEV_CTL_SUBCLASS 2

macroKEV_CTL_REGISTERED

@defined KEV_CTL_REGISTERED @discussion The event code indicating a new controller was registered. The data portion will contain a ctl_event_data.
#define KEV_CTL_REGISTERED 1
a new controller appears

macroKEV_CTL_DEREGISTERED

@defined KEV_CTL_DEREGISTERED @discussion The event code indicating a controller was unregistered. The data portion will contain a ctl_event_data.
#define KEV_CTL_DEREGISTERED 2
a controller disappears

structctl_event_data

@struct ctl_event_data @discussion This structure is used for KEV_CTL_SUBCLASS kernel events. @field ctl_id The kernel control id. @field ctl_unit The kernel control unit.
size 8, align 4
u_int32_tctl_idKernel Controller ID
u_int32_tctl_unit

macroCTLIOCGCOUNT

@defined CTLIOCGCOUNT @discussion The CTLIOCGCOUNT ioctl can be used to determine the number of kernel controllers registered.
#define CTLIOCGCOUNT _IOR('N', 2, int)
get number of control structures registered

macroCTLIOCGINFO

@defined CTLIOCGINFO @discussion The CTLIOCGINFO ioctl can be used to convert a kernel control name to a kernel control id.
#define CTLIOCGINFO _IOWR('N', 3, struct ctl_info)
get id from name

macroMAX_KCTL_NAME

@defined MAX_KCTL_NAME @discussion Kernel control names must be no longer than MAX_KCTL_NAME.
#define MAX_KCTL_NAME 96

structctl_info

@struct ctl_info @discussion This structure is used with the CTLIOCGINFO ioctl to translate from a kernel control name to a control id. @field ctl_id The kernel control id, filled out upon return. @field ctl_name The kernel control name to find.
size 100, align 4
u_int32_tctl_idKernel Controller ID
char[96]ctl_nameKernel Controller Name (a C string)

structsockaddr_ctl

@struct sockaddr_ctl @discussion The controller address structure is used to establish contact between a user client and a kernel controller. The sc_id/sc_unit uniquely identify each controller. sc_id is a unique identifier assigned to the controller. The identifier can be assigned by the system at registration time or be a 32-bit creator code obtained from Apple Computer. sc_unit is a unit number for this sc_id, and is privately used by the kernel controller to identify several instances of the controller. @field sc_len The length of the structure. @field sc_family AF_SYSTEM. @field ss_sysaddr AF_SYS_KERNCONTROL. @field sc_id Controller unique identifier. @field sc_unit Kernel controller private unit number. @field sc_reserved Reserved, must be set to zero.
size 32, align 4
u_charsc_lendepends on size of bundle ID string
u_charsc_familyAF_SYSTEM
u_int16_tss_sysaddrAF_SYS_KERNCONTROL
u_int32_tsc_idController unique identifier
u_int32_tsc_unitDeveloper private unit number
u_int32_t[5]sc_reserved