kqueue_sys/constants/
darwin.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,      /* attached to aio requests */
11    EVFILT_VNODE = -4,    /* attached to vnodes */
12    EVFILT_PROC = -5,     /* attached to struct proc */
13    EVFILT_SIGNAL = -6,   /* attached to struct proc */
14    EVFILT_TIMER = -7,    /* timers */
15    EVFILT_MACHPORT = -8, /* Mach portsets */
16    EVFILT_FS = -9,       /* Filesystem events */
17    EVFILT_USER = -10,    /* User events */
18    EVFILT_VM = -12,      /* Virtual memory events */
19    EVFILT_SYSCOUNT = 14,
20}
21
22bitflags! {
23    pub struct EventFlag: c_ushort {
24        const EV_ADD            = 0x0001;   /* add event to kq (implies enable) */
25        const EV_DELETE         = 0x0002;   /* delete event from kq */
26        const EV_ENABLE         = 0x0004;   /* enable event */
27        const EV_DISABLE        = 0x0008;   /* disable event (not reported) */
28        const EV_UDATA_SPECIFIC = 0x0100;   /* unique kevent per udata value */
29                                            /* ... in combination with EV_DELETE */
30                                            /* will defer delete until udata-specific */
31                                            /* event enabled. EINPROGRESS will be */
32                                            /* returned to indicate the deferral */
33
34        const EV_ONESHOT        = 0x0010;   /* only report one occurrence */
35        const EV_CLEAR          = 0x0020;   /* clear event state after reporting */
36        const EV_RECEIPT        = 0x0040;   /* force EV_ERROR on success, data == 0 */
37        const EV_DISPATCH       = 0x0080;   /* disable event after reporting */
38
39        const EV_SYSFLAGS       = 0xF000;   /* reserved by system */
40        const EV_FLAG0          = 0x1000;   /* filter-specific flag */
41        const EV_FLAG1          = 0x2000;   /* filter-specific flag */
42        const EV_EOF            = 0x8000;   /* EOF detected */
43        const EV_ERROR          = 0x4000;   /* error, data contains errno */
44    }
45}
46
47bitflags! {
48    pub struct FilterFlag: c_uint {
49        const NOTE_FFNOP                        = 0x00000000;   /* ignore input fflags */
50        const NOTE_FFAND                        = 0x40000000;   /* and fflags */
51        const NOTE_FFOR                         = 0x80000000;   /* or fflags */
52        const NOTE_FFCOPY                       = 0xc0000000;   /* copy fflags */
53        const NOTE_FFCTRLMASK                   = 0xc0000000;   /* mask for operations */
54        const NOTE_FFLAGSMASK                   = 0x00ffffff;
55        const NOTE_LOWAT                        = 0x00000001;   /* low water mark */
56        const NOTE_DELETE                       = 0x00000001;   /* vnode was removed */
57        const NOTE_WRITE                        = 0x00000002;   /* data contents changed */
58        const NOTE_EXTEND                       = 0x00000004;   /* size increased */
59        const NOTE_ATTRIB                       = 0x00000008;   /* attributes changed */
60        const NOTE_LINK                         = 0x00000010;   /* link count changed */
61        const NOTE_RENAME                       = 0x00000020;   /* vnode was renamed */
62        const NOTE_REVOKE                       = 0x00000040;   /* vnode access was revoked */
63        const NOTE_NONE                         = 0x00000080;   /* No specific vnode event: to test for EVFILT_READ activation*/
64        const NOTE_EXIT                         = 0x80000000;   /* process exited */
65        const NOTE_FORK                         = 0x40000000;   /* process forked */
66        const NOTE_EXEC                         = 0x20000000;   /* process exec'd */
67        const NOTE_SIGNAL                       = 0x08000000;   /* shared with EVFILT_SIGNAL */
68        const NOTE_EXITSTATUS                   = 0x04000000;   /* exit status to be returned, valid for child process only */
69        const NOTE_EXIT_DETAIL                  = 0x02000000;   /* provide details on reasons for exit */
70        const NOTE_PDATAMASK                    = 0x000fffff;   /* mask for signal & exit status */
71        const NOTE_PCTRLMASK                    = 0xf0000000;
72        const NOTE_SECONDS                      = 0x00000001;   /* data is seconds         */
73        const NOTE_USECONDS                     = 0x00000002;   /* data is microseconds    */
74        const NOTE_NSECONDS                     = 0x00000004;   /* data is nanoseconds     */
75        const NOTE_ABSOLUTE                     = 0x00000008;   /* absolute timeout        */
76                                                                /* ... implicit EV_ONESHOT */
77        const NOTE_LEEWAY                       = 0x00000010;   /* ext[1] holds leeway for power aware timers */
78        const NOTE_CRITICAL                     = 0x00000020;   /* system does minimal timer coalescing */
79        const NOTE_BACKGROUND                   = 0x00000040;   /* system does maximum timer coalescing */
80        const NOTE_VM_PRESSURE                  = 0x80000000;   /* will react on memory pressure */
81        const NOTE_VM_PRESSURE_TERMINATE        = 0x40000000;   /* will quit on memory pressure, possibly after cleaning up dirty state */
82        const NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000;   /* will quit immediately on memory pressure */
83        const NOTE_VM_ERROR                     = 0x10000000;   /* there was an error */
84        const NOTE_TRACK                        = 0x00000001;   /* follow across forks */
85        const NOTE_TRACKERR                     = 0x00000002;   /* could not track child */
86        const NOTE_CHILD                        = 0x00000004;   /* am a child process */
87    }
88}