Skip to main content

endpoint_sec/event/
event_kextload.rs

1//! [`EventKextLoad`]
2
3use std::ffi::OsStr;
4
5use endpoint_sec_sys::es_event_kextload_t;
6
7/// Load a kernel extension event.
8#[doc(alias = "es_event_kextload_t")]
9pub struct EventKextLoad<'a> {
10    /// Raw event
11    pub(crate) raw: &'a es_event_kextload_t,
12}
13
14impl<'a> EventKextLoad<'a> {
15    /// The signing identifier of the kext being loaded.
16    #[inline(always)]
17    pub fn identifier(&self) -> &'a OsStr {
18        // Safety: 'a tied to self, object obtained through ES
19        unsafe { self.raw.identifier.as_os_str() }
20    }
21}
22
23// Safety: safe to send across threads: does not contain any interior mutability nor depend on current thread state
24unsafe impl Send for EventKextLoad<'_> {}
25// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
26unsafe impl Sync for EventKextLoad<'_> {}
27
28impl_debug_eq_hash_with_functions!(EventKextLoad<'a>; identifier);