Skip to main content

kqueue_sys/constants/
netbsd.rs

1use bitflags::bitflags;
2
3#[allow(non_camel_case_types)]
4#[repr(u32)]
5#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)]
6pub enum EventFilter {
7    EVFILT_READ = 0,
8    EVFILT_WRITE = 1,
9    EVFILT_AIO = 2,
10    EVFILT_VNODE = 3,
11    EVFILT_PROC = 4,
12    EVFILT_SIGNAL = 5,
13    EVFILT_TIMER = 6,
14    EVFILT_SYSCOUNT = 7,
15}
16
17bitflags! {
18    #[repr(transparent)]
19    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd)]
20    pub struct EventFlag: u32 {
21        const EV_ADD       = 0x0001;
22        const EV_DELETE    = 0x0002;
23        const EV_ENABLE    = 0x0004;
24        const EV_DISABLE   = 0x0008;
25        const EV_ONESHOT   = 0x0010;
26        const EV_CLEAR     = 0x0020;
27        const EV_RECEIPT   = 0x0040;
28        const EV_DISPATCH  = 0x0080;
29        const EV_SYSFLAGS  = 0xF000;
30        const EV_NODATA    = 0x1000;
31        const EV_FLAG1     = 0x2000;
32        const EV_EOF       = 0x8000;
33        const EV_ERROR     = 0x4000;
34    }
35}
36
37impl EventFlag {
38    /// Convert from underlying bit representation, preserving all
39    /// bits (even those not corresponding to a defined flag).
40    ///
41    /// # Safety
42    ///
43    /// The caller of the `bitflags!` macro can chose to allow or
44    /// disallow extra bits for their bitflags type.
45    ///
46    /// The caller of `from_bits_unchecked()` has to ensure that
47    /// all bits correspond to a defined flag or that extra bits
48    /// are valid for this bitflags type.
49    #[deprecated = "use the safe `from_bits_retain` method instead"]
50    pub const unsafe fn from_bits_unchecked(bits: u32) -> Self {
51        Self::from_bits_retain(bits)
52    }
53}
54
55bitflags! {
56    #[repr(transparent)]
57    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd)]
58    pub struct FilterFlag: u32 {
59        const NOTE_LOWAT                           = 0x00000001;
60        const NOTE_DELETE                          = 0x00000001;
61        const NOTE_WRITE                           = 0x00000002;
62        const NOTE_EXTEND                          = 0x00000004;
63        const NOTE_ATTRIB                          = 0x00000008;
64        const NOTE_LINK                            = 0x00000010;
65        const NOTE_RENAME                          = 0x00000020;
66        const NOTE_REVOKE                          = 0x00000040;
67        const NOTE_EXIT                            = 0x80000000;
68        const NOTE_FORK                            = 0x40000000;
69        const NOTE_EXEC                            = 0x20000000;
70        const NOTE_SIGNAL                          = 0x08000000;
71        const NOTE_PDATAMASK                       = 0x000fffff;
72        const NOTE_PCTRLMASK                       = 0xf0000000;
73        const NOTE_TRACK                           = 0x00000001;
74        const NOTE_TRACKERR                        = 0x00000002;
75        const NOTE_CHILD                           = 0x00000004;
76    }
77}
78
79impl FilterFlag {
80    /// Convert from underlying bit representation, preserving all
81    /// bits (even those not corresponding to a defined flag).
82    ///
83    /// # Safety
84    ///
85    /// The caller of the `bitflags!` macro can chose to allow or
86    /// disallow extra bits for their bitflags type.
87    ///
88    /// The caller of `from_bits_unchecked()` has to ensure that
89    /// all bits correspond to a defined flag or that extra bits
90    /// are valid for this bitflags type.
91    #[deprecated = "use the safe `from_bits_retain` method instead"]
92    pub const unsafe fn from_bits_unchecked(bits: u32) -> Self {
93        Self::from_bits_retain(bits)
94    }
95}