Path: blob/buildjre8/ios-missing-include/sys/kern_control.h
861 views
/*1* Copyright (c) 2000-2004, 2012-2016 Apple Inc. All rights reserved.2*3* @APPLE_OSREFERENCE_LICENSE_HEADER_START@4*5* This file contains Original Code and/or Modifications of Original Code6* as defined in and that are subject to the Apple Public Source License7* Version 2.0 (the 'License'). You may not use this file except in8* compliance with the License. The rights granted to you under the License9* may not be used to create, or enable the creation or redistribution of,10* unlawful or unlicensed copies of an Apple operating system, or to11* circumvent, violate, or enable the circumvention or violation of, any12* terms of an Apple operating system software license agreement.13*14* Please obtain a copy of the License at15* http://www.opensource.apple.com/apsl/ and read it before using this file.16*17* The Original Code and all software distributed under the License are18* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER19* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,20* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,21* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.22* Please see the License for the specific language governing rights and23* limitations under the License.24*25* @APPLE_OSREFERENCE_LICENSE_HEADER_END@26*/27/*!28* @header kern_control.h29* This header defines an API to communicate between a kernel30* extension and a process outside of the kernel.31*/3233#ifndef KPI_KERN_CONTROL_H34#define KPI_KERN_CONTROL_H353637#include <sys/appleapiopts.h>38#include <sys/_types/_u_char.h>39#include <sys/_types/_u_int16_t.h>40#include <sys/_types/_u_int32_t.h>4142/*43* Define Controller event subclass, and associated events.44* Subclass of KEV_SYSTEM_CLASS45*/4647/*!48* @defined KEV_CTL_SUBCLASS49* @discussion The kernel event subclass for kernel control events.50*/51#define KEV_CTL_SUBCLASS 25253/*!54* @defined KEV_CTL_REGISTERED55* @discussion The event code indicating a new controller was56* registered. The data portion will contain a ctl_event_data.57*/58#define KEV_CTL_REGISTERED 1 /* a new controller appears */5960/*!61* @defined KEV_CTL_DEREGISTERED62* @discussion The event code indicating a controller was unregistered.63* The data portion will contain a ctl_event_data.64*/65#define KEV_CTL_DEREGISTERED 2 /* a controller disappears */6667/*!68* @struct ctl_event_data69* @discussion This structure is used for KEV_CTL_SUBCLASS kernel70* events.71* @field ctl_id The kernel control id.72* @field ctl_unit The kernel control unit.73*/74struct ctl_event_data {75u_int32_t ctl_id; /* Kernel Controller ID */76u_int32_t ctl_unit;77};7879/*80* Controls destined to the Controller Manager.81*/8283/*!84* @defined CTLIOCGCOUNT85* @discussion The CTLIOCGCOUNT ioctl can be used to determine the86* number of kernel controllers registered.87*/88#define CTLIOCGCOUNT _IOR('N', 2, int) /* get number of control structures registered */8990/*!91* @defined CTLIOCGINFO92* @discussion The CTLIOCGINFO ioctl can be used to convert a kernel93* control name to a kernel control id.94*/95#define CTLIOCGINFO _IOWR('N', 3, struct ctl_info) /* get id from name */969798/*!99* @defined MAX_KCTL_NAME100* @discussion Kernel control names must be no longer than101* MAX_KCTL_NAME.102*/103#define MAX_KCTL_NAME 96104105/*106* Controls destined to the Controller Manager.107*/108109/*!110* @struct ctl_info111* @discussion This structure is used with the CTLIOCGINFO ioctl to112* translate from a kernel control name to a control id.113* @field ctl_id The kernel control id, filled out upon return.114* @field ctl_name The kernel control name to find.115*/116struct ctl_info {117u_int32_t ctl_id; /* Kernel Controller ID */118char ctl_name[MAX_KCTL_NAME]; /* Kernel Controller Name (a C string) */119};120121122/*!123* @struct sockaddr_ctl124* @discussion The controller address structure is used to establish125* contact between a user client and a kernel controller. The126* sc_id/sc_unit uniquely identify each controller. sc_id is a127* unique identifier assigned to the controller. The identifier can128* be assigned by the system at registration time or be a 32-bit129* creator code obtained from Apple Computer. sc_unit is a unit130* number for this sc_id, and is privately used by the kernel131* controller to identify several instances of the controller.132* @field sc_len The length of the structure.133* @field sc_family AF_SYSTEM.134* @field ss_sysaddr AF_SYS_KERNCONTROL.135* @field sc_id Controller unique identifier.136* @field sc_unit Kernel controller private unit number.137* @field sc_reserved Reserved, must be set to zero.138*/139struct sockaddr_ctl {140u_char sc_len; /* depends on size of bundle ID string */141u_char sc_family; /* AF_SYSTEM */142u_int16_t ss_sysaddr; /* AF_SYS_KERNCONTROL */143u_int32_t sc_id; /* Controller unique identifier */144u_int32_t sc_unit; /* Developer private unit number */145u_int32_t sc_reserved[5];146};147148149150#endif /* KPI_KERN_CONTROL_H */151152153