Skip to main content

kqueue_sys/constants/
freebsd.rs

1use bitflags::bitflags;
2use libc::{c_uint, c_ushort};
3
4#[allow(non_camel_case_types)]
5#[derive(Clone, Copy, Debug, PartialEq)]
6#[repr(i16)]
7pub enum EventFilter {
8    EVFILT_READ = -1,
9    EVFILT_WRITE = -2,
10    EVFILT_AIO = -3,
11    EVFILT_VNODE = -4,
12    EVFILT_PROC = -5,
13    EVFILT_SIGNAL = -6,
14    EVFILT_TIMER = -7,
15    EVFILT_PROCDESC = -8,
16    EVFILT_FS = -9,
17    EVFILT_LIO = -10,
18    EVFILT_USER = -11,
19    EVFILT_SENDFILE = -12,
20    EVFILT_EMPTY = -13,
21    EVFILT_SYSCOUNT = 13,
22}
23
24bitflags! {
25    #[repr(transparent)]
26    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd)]
27    pub struct EventFlag: c_ushort {
28        const EV_ADD          = 0x0001;
29        const EV_DELETE       = 0x0002;
30        const EV_ENABLE       = 0x0004;
31        const EV_DISABLE      = 0x0008;
32        const EV_FORCEONESHOT = 0x0100;
33        const EV_ONESHOT      = 0x0010;
34        const EV_CLEAR        = 0x0020;
35        const EV_RECEIPT      = 0x0040;
36        const EV_DISPATCH     = 0x0080;
37        const EV_SYSFLAGS     = 0xF000;
38        const EV_DROP         = 0x1000;
39        const EV_FLAG1        = 0x2000;
40        const EV_FLAG2        = 0x4000;
41        const EV_EOF          = 0x8000;
42        const EV_ERROR        = 0x4000;
43    }
44}
45
46impl EventFlag {
47    #[deprecated = "use the safe `from_bits_retain` method instead"]
48    pub const unsafe fn from_bits_unchecked(bits: c_ushort) -> Self {
49        Self::from_bits_retain(bits)
50    }
51}
52
53bitflags! {
54    #[repr(transparent)]
55    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd)]
56    pub struct FilterFlag: c_uint {
57        const NOTE_FFNOP                        = 0x00000000;
58        const NOTE_FFAND                        = 0x40000000;
59        const NOTE_FFOR                         = 0x80000000;
60        const NOTE_FFCOPY                       = 0xc0000000;
61        const NOTE_FFCTRLMASK                   = 0xc0000000;
62        const NOTE_FFLAGSMASK                   = 0x00ffffff;
63        const NOTE_TRIGGER                      = 0x01000000;
64
65        const NOTE_LOWAT                        = 0x00000001;
66        const NOTE_FILE_POLL                    = 0x00000002;
67
68        const NOTE_DELETE                       = 0x00000001;
69        const NOTE_WRITE                        = 0x00000002;
70        const NOTE_EXTEND                       = 0x00000004;
71        const NOTE_ATTRIB                       = 0x00000008;
72        const NOTE_LINK                         = 0x00000010;
73        const NOTE_RENAME                       = 0x00000020;
74        const NOTE_REVOKE                       = 0x00000040;
75        const NOTE_OPEN                         = 0x00000080;
76        const NOTE_CLOSE                        = 0x00000100;
77        const NOTE_CLOSE_WRITE                  = 0x00000200;
78        const NOTE_READ                         = 0x00000400;
79
80        const NOTE_EXIT                         = 0x80000000;
81        const NOTE_FORK                         = 0x40000000;
82        const NOTE_EXEC                         = 0x20000000;
83        const NOTE_PCTRLMASK                    = 0xf0000000;
84        const NOTE_PDATAMASK                    = 0x000fffff;
85
86        const NOTE_TRACK                        = 0x00000001;
87        const NOTE_TRACKERR                     = 0x00000002;
88        const NOTE_CHILD                        = 0x00000004;
89
90        const NOTE_SECONDS                      = 0x00000001;
91        const NOTE_MSECONDS                     = 0x00000002;
92        const NOTE_USECONDS                     = 0x00000004;
93        const NOTE_NSECONDS                     = 0x00000008;
94        const NOTE_ABSTIME                      = 0x00000010;
95    }
96}
97
98impl FilterFlag {
99    #[deprecated = "use the safe `from_bits_retain` method instead"]
100    pub const unsafe fn from_bits_unchecked(bits: c_uint) -> Self {
101        Self::from_bits_retain(bits)
102    }
103}