#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.
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.
| u_int32_t | ctl_id | Kernel Controller ID |
| u_int32_t | ctl_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.
| u_int32_t | ctl_id | Kernel Controller ID |
| char[96] | ctl_name | Kernel 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.
| u_char | sc_len | depends on size of bundle ID string |
| u_char | sc_family | AF_SYSTEM |
| u_int16_t | ss_sysaddr | AF_SYS_KERNCONTROL |
| u_int32_t | sc_id | Controller unique identifier |
| u_int32_t | sc_unit | Developer private unit number |
| u_int32_t[5] | sc_reserved |