#include <sys/kern_event.h>

sys/kern_event.h Kernel.framework

@header kern_event.h This header defines in-kernel functions for generating kernel events as well as functions for receiving kernel events using a kernel event socket.
includes: sys/appleapiopts.h, Kernel/sys/ioccom.h, Kernel/sys/sys_domain.h
2 structs · 2 functions · 1 macro

macroN_KEV_VECTORS

@define N_KEV_VECTORS @discussion The maximum number of kev_d_vectors for a kernel event.
#define N_KEV_VECTORS 5

structkev_d_vectors

@struct kev_d_vectors @discussion This structure is used to append some data to a kernel event. @field data_length The length of data. @field data_ptr A pointer to data.
size 16, align 8
u_int32_tdata_lengthLength of the event data
void *data_ptrPointer to event data

structkev_msg

@struct kev_msg @discussion This structure is used when posting a kernel event. @field vendor_code The vendor code assigned by kev_vendor_code_find. @field kev_class The event's class. @field kev_class The event's subclass. @field kev_class The event's code. @field dv An array of vectors describing additional data to be appended to the kernel event.
size 96, align 8
u_int32_tvendor_codeFor non-Apple extensibility
u_int32_tkev_classLayer of event source
u_int32_tkev_subclassComponent within layer
u_int32_tevent_codeThe event code
struct kev_d_vectors[5]dvUp to n data vectors

functionkev_vendor_code_find

errno_t kev_vendor_code_find(const char *vendor_string, u_int32_t *vendor_code)
@function kev_vendor_code_find @discussion Lookup a vendor_code given a unique string. If the vendor code has not been used since launch, a unique integer will be assigned for that string. Vendor codes will remain the same until the machine is rebooted. @param vendor_string A bundle style vendor identifier(i.e. com.apple). @param vendor_code Upon return, a unique vendor code for use when posting kernel events. @result May return ENOMEM if memory constraints prevent allocation of a new vendor code.

functionkev_msg_post

errno_t kev_msg_post(struct kev_msg *event_msg)
@function kev_msg_post @discussion Post a kernel event message. @param event_msg A structure defining the kernel event message to post. @result Will return zero upon success. May return a number of errors depending on the type of failure. EINVAL indicates that there was something wrong with the kerne event. The vendor code of the kernel event must be assigned using kev_vendor_code_find. If the message is too large, EMSGSIZE will be returned.