ADC Home > Reference Library > Reference > Darwin > Miscellaneous User Space API Reference

 


kern_control.h

Includes:
<sys/appleapiopts.h>

Introduction

This header defines an API to communicate between a kernel extension and a process outside of the kernel.



Structs and Unions


ctl_event_data


struct ctl_event_data { 
    u_int32_t ctl_id; /* Kernel Controller ID */
    u_int32_t ctl_unit; 
};  
Fields
ctl_id
The kernel control id.
ctl_unit
The kernel control unit.
Discussion

This structure is used for KEV_CTL_SUBCLASS kernel events.


ctl_info


struct ctl_info { 
    u_int32_t ctl_id; /* Kernel Controller ID */
    char ctl_name[96  ]; /* Kernel Controller Name (a C string) */
};  
Fields
ctl_id
The kernel control id, filled out upon return.
ctl_name
The kernel control name to find.
Discussion

This structure is used with the CTLIOCGINFO ioctl to translate from a kernel control name to a control id.


sockaddr_ctl


struct sockaddr_ctl { 
    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 sc_reserved[5]; 
};  
Fields
sc_len
The length of the structure.
sc_family
AF_SYSTEM.
ss_sysaddr
AF_SYS_KERNCONTROL.
sc_id
Controller unique identifier.
sc_unit
Kernel controller private unit number.
sc_reserved
Reserved, must be set to zero.
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.

#defines


CTLIOCGCOUNT


#define CTLIOCGCOUNT _IOR(
    'N', 2, int) /* get number of control structures registered */
Discussion

The CTLIOCGCOUNT ioctl can be used to determine the number of kernel controllers registered.


CTLIOCGINFO


#define CTLIOCGINFO _IOWR(
    'N', 3, struct ctl_info) /* get id from name */
Discussion

The CTLIOCGINFO ioctl can be used to convert a kernel control name to a kernel control id.


KEV_CTL_DEREGISTERED


#define KEV_CTL_DEREGISTERED 2 /* a controller disappears */
Discussion

The event code indicating a controller was unregistered. The data portion will contain a ctl_event_data.


KEV_CTL_REGISTERED


#define KEV_CTL_REGISTERED 1 /* a new controller appears */
Discussion

The event code indicating a new controller was registered. The data portion will contain a ctl_event_data.


KEV_CTL_SUBCLASS


#define KEV_CTL_SUBCLASS 2 
Discussion

The kernel event subclass for kernel control events.


MAX_KCTL_NAME


#define MAX_KCTL_NAME 96 
Discussion

Kernel control names must be no longer than MAX_KCTL_NAME.


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.
Last Updated: 2006-06-20