kqueue_sys/constants/
freebsd.rs1use bitflags::bitflags;
2use libc::{c_uint, c_ushort};
3
4#[allow(non_camel_case_types)]
5#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)]
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"]
59 pub const unsafe fn from_bits_unchecked(bits: c_ushort) -> Self {
60 Self::from_bits_retain(bits)
61 }
62}
63
64bitflags! {
65 #[repr(transparent)]
66 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Ord, PartialOrd)]
67 pub struct FilterFlag: c_uint {
68 const NOTE_FFNOP = 0x00000000;
69 const NOTE_FFAND = 0x40000000;
70 const NOTE_FFOR = 0x80000000;
71 const NOTE_FFCOPY = 0xc0000000;
72 const NOTE_FFCTRLMASK = 0xc0000000;
73 const NOTE_FFLAGSMASK = 0x00ffffff;
74 const NOTE_TRIGGER = 0x01000000;
75
76 const NOTE_LOWAT = 0x00000001;
77 const NOTE_FILE_POLL = 0x00000002;
78
79 const NOTE_DELETE = 0x00000001;
80 const NOTE_WRITE = 0x00000002;
81 const NOTE_EXTEND = 0x00000004;
82 const NOTE_ATTRIB = 0x00000008;
83 const NOTE_LINK = 0x00000010;
84 const NOTE_RENAME = 0x00000020;
85 const NOTE_REVOKE = 0x00000040;
86 const NOTE_OPEN = 0x00000080;
87 const NOTE_CLOSE = 0x00000100;
88 const NOTE_CLOSE_WRITE = 0x00000200;
89 const NOTE_READ = 0x00000400;
90
91 const NOTE_EXIT = 0x80000000;
92 const NOTE_FORK = 0x40000000;
93 const NOTE_EXEC = 0x20000000;
94 const NOTE_PCTRLMASK = 0xf0000000;
95 const NOTE_PDATAMASK = 0x000fffff;
96
97 const NOTE_TRACK = 0x00000001;
98 const NOTE_TRACKERR = 0x00000002;
99 const NOTE_CHILD = 0x00000004;
100
101 const NOTE_SECONDS = 0x00000001;
102 const NOTE_MSECONDS = 0x00000002;
103 const NOTE_USECONDS = 0x00000004;
104 const NOTE_NSECONDS = 0x00000008;
105 const NOTE_ABSTIME = 0x00000010;
106 }
107}
108
109impl FilterFlag {
110 #[deprecated = "use the safe `from_bits_retain` method instead"]
122 pub const unsafe fn from_bits_unchecked(bits: c_uint) -> Self {
123 Self::from_bits_retain(bits)
124 }
125}