endpoint_sec/event/event_mprotect.rs
1//! [`EventMprotect`]
2
3use endpoint_sec_sys::es_event_mprotect_t;
4
5/// Control protection of pages event.
6#[doc(alias = "es_event_mprotect_t")]
7pub struct EventMprotect<'a> {
8 /// Raw event
9 pub(crate) raw: &'a es_event_mprotect_t,
10}
11
12impl EventMprotect<'_> {
13 /// The desired new protection value.
14 #[inline(always)]
15 pub fn protection(&self) -> i32 {
16 self.raw.protection
17 }
18
19 /// The base address to which the protection value will apply.
20 #[inline(always)]
21 pub fn address(&self) -> usize {
22 self.raw.address as usize
23 }
24
25 /// The size of the memory region the protection value will apply.
26 #[inline(always)]
27 pub fn size(&self) -> usize {
28 self.raw.size as usize
29 }
30}
31
32// Safety: safe to send across threads: does not contain any interior mutability nor depend on current thread state
33unsafe impl Send for EventMprotect<'_> {}
34// Safety: safe to share across threads: does not contain any interior mutability nor depend on current thread state
35unsafe impl Sync for EventMprotect<'_> {}
36
37impl_debug_eq_hash_with_functions!(EventMprotect<'a>; protection, address, size);