1 /* 2 * Copyright (c) 2025 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ 29 /*! 30 * @header kern_event.h 31 * This header defines in-kernel functions for generating kernel events as 32 * well as functions for receiving kernel events using a kernel event 33 * socket. 34 */ 35 36 #ifndef SYS_KERN_EVENT_PRIVATE_H 37 #define SYS_KERN_EVENT_PRIVATE_H 38 39 #include <sys/kern_event.h> 40 41 struct xkevtpcb { 42 u_int32_t kep_len; 43 u_int32_t kep_kind; 44 u_int64_t kep_evtpcb; 45 u_int32_t kep_vendor_code_filter; 46 u_int32_t kep_class_filter; 47 u_int32_t kep_subclass_filter; 48 }; 49 50 struct kevtstat { 51 u_int64_t kes_pcbcount __attribute__((aligned(8))); 52 u_int64_t kes_gencnt __attribute__((aligned(8))); 53 u_int64_t kes_badvendor __attribute__((aligned(8))); 54 u_int64_t kes_toobig __attribute__((aligned(8))); 55 u_int64_t kes_nomem __attribute__((aligned(8))); 56 u_int64_t kes_fullsock __attribute__((aligned(8))); 57 u_int64_t kes_posted __attribute__((aligned(8))); 58 }; 59 60 #ifdef KERNEL 61 /* 62 * Internal version of kev_msg_post. Allows posting Apple vendor code kernel 63 * events. 64 */ 65 int kev_post_msg(struct kev_msg *event); 66 int kev_post_msg_nowait(struct kev_msg *event); 67 68 LIST_HEAD(kern_event_head, kern_event_pcb); 69 70 struct kern_event_pcb { 71 decl_lck_mtx_data(, evp_mtx); /* per-socket mutex */ 72 LIST_ENTRY(kern_event_pcb) evp_link; /* glue on list of all PCBs */ 73 struct socket *evp_socket; /* pointer back to socket */ 74 u_int32_t evp_vendor_code_filter; 75 u_int32_t evp_class_filter; 76 u_int32_t evp_subclass_filter; 77 }; 78 79 #define sotoevpcb(so) ((struct kern_event_pcb *)((so)->so_pcb)) 80 81 #endif /* KERNEL */ 82 #endif /* SYS_KERN_EVENT_PRIVATE_H */ 83