rustix/backend/linux_raw/fs/
inotify.rs

1//! inotify support for working with inotify objects.
2
3use crate::backend::c;
4use bitflags::bitflags;
5
6bitflags! {
7    /// `IN_*` for use with [`inotify::init`].
8    ///
9    /// [`inotify::init`]: crate::fs::inotify::init
10    #[repr(transparent)]
11    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
12    pub struct CreateFlags: c::c_uint {
13        /// `IN_CLOEXEC`
14        const CLOEXEC = linux_raw_sys::general::IN_CLOEXEC;
15        /// `IN_NONBLOCK`
16        const NONBLOCK = linux_raw_sys::general::IN_NONBLOCK;
17
18        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
19        const _ = !0;
20    }
21}
22
23bitflags! {
24    /// `IN*` for use with [`inotify::add_watch`].
25    ///
26    /// [`inotify::add_watch`]: crate::fs::inotify::add_watch
27    #[repr(transparent)]
28    #[derive(Default, Copy, Clone, Eq, PartialEq, Hash, Debug)]
29    pub struct WatchFlags: c::c_uint {
30        /// `IN_ACCESS`
31        const ACCESS = linux_raw_sys::general::IN_ACCESS;
32        /// `IN_ATTRIB`
33        const ATTRIB = linux_raw_sys::general::IN_ATTRIB;
34        /// `IN_CLOSE_NOWRITE`
35        const CLOSE_NOWRITE = linux_raw_sys::general::IN_CLOSE_NOWRITE;
36        /// `IN_CLOSE_WRITE`
37        const CLOSE_WRITE = linux_raw_sys::general::IN_CLOSE_WRITE;
38        /// `IN_CREATE`
39        const CREATE = linux_raw_sys::general::IN_CREATE;
40        /// `IN_DELETE`
41        const DELETE = linux_raw_sys::general::IN_DELETE;
42        /// `IN_DELETE_SELF`
43        const DELETE_SELF = linux_raw_sys::general::IN_DELETE_SELF;
44        /// `IN_MODIFY`
45        const MODIFY = linux_raw_sys::general::IN_MODIFY;
46        /// `IN_MOVE_SELF`
47        const MOVE_SELF = linux_raw_sys::general::IN_MOVE_SELF;
48        /// `IN_MOVED_FROM`
49        const MOVED_FROM = linux_raw_sys::general::IN_MOVED_FROM;
50        /// `IN_MOVED_TO`
51        const MOVED_TO = linux_raw_sys::general::IN_MOVED_TO;
52        /// `IN_OPEN`
53        const OPEN = linux_raw_sys::general::IN_OPEN;
54
55        /// `IN_CLOSE`
56        const CLOSE = linux_raw_sys::general::IN_CLOSE;
57        /// `IN_MOVE`
58        const MOVE = linux_raw_sys::general::IN_MOVE;
59        /// `IN_ALL_EVENTS`
60        const ALL_EVENTS = linux_raw_sys::general::IN_ALL_EVENTS;
61
62        /// `IN_DONT_FOLLOW`
63        const DONT_FOLLOW = linux_raw_sys::general::IN_DONT_FOLLOW;
64        /// `IN_EXCL_UNLINK`
65        const EXCL_UNLINK = linux_raw_sys::general::IN_EXCL_UNLINK;
66        /// `IN_MASK_ADD`
67        const MASK_ADD = linux_raw_sys::general::IN_MASK_ADD;
68        /// `IN_MASK_CREATE`
69        const MASK_CREATE = linux_raw_sys::general::IN_MASK_CREATE;
70        /// `IN_ONESHOT`
71        const ONESHOT = linux_raw_sys::general::IN_ONESHOT;
72        /// `IN_ONLYDIR`
73        const ONLYDIR = linux_raw_sys::general::IN_ONLYDIR;
74
75        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
76        const _ = !0;
77    }
78}
79
80bitflags! {
81    /// `IN*` for use with [`inotify::Reader`].
82    ///
83    /// [`inotify::Reader`]: crate::fs::inotify::InotifyReader
84    #[repr(transparent)]
85    #[derive(Default, Copy, Clone, Eq, PartialEq, Hash, Debug)]
86    pub struct ReadFlags: c::c_uint {
87        /// `IN_ACCESS`
88        const ACCESS = linux_raw_sys::general::IN_ACCESS;
89        /// `IN_ATTRIB`
90        const ATTRIB = linux_raw_sys::general::IN_ATTRIB;
91        /// `IN_CLOSE_NOWRITE`
92        const CLOSE_NOWRITE = linux_raw_sys::general::IN_CLOSE_NOWRITE;
93        /// `IN_CLOSE_WRITE`
94        const CLOSE_WRITE = linux_raw_sys::general::IN_CLOSE_WRITE;
95        /// `IN_CREATE`
96        const CREATE = linux_raw_sys::general::IN_CREATE;
97        /// `IN_DELETE`
98        const DELETE = linux_raw_sys::general::IN_DELETE;
99        /// `IN_DELETE_SELF`
100        const DELETE_SELF = linux_raw_sys::general::IN_DELETE_SELF;
101        /// `IN_MODIFY`
102        const MODIFY = linux_raw_sys::general::IN_MODIFY;
103        /// `IN_MOVE_SELF`
104        const MOVE_SELF = linux_raw_sys::general::IN_MOVE_SELF;
105        /// `IN_MOVED_FROM`
106        const MOVED_FROM = linux_raw_sys::general::IN_MOVED_FROM;
107        /// `IN_MOVED_TO`
108        const MOVED_TO = linux_raw_sys::general::IN_MOVED_TO;
109        /// `IN_OPEN`
110        const OPEN = linux_raw_sys::general::IN_OPEN;
111
112        /// `IN_IGNORED`
113        const IGNORED = linux_raw_sys::general::IN_IGNORED;
114        /// `IN_ISDIR`
115        const ISDIR = linux_raw_sys::general::IN_ISDIR;
116        /// `IN_Q_OVERFLOW`
117        const QUEUE_OVERFLOW = linux_raw_sys::general::IN_Q_OVERFLOW;
118        /// `IN_UNMOUNT`
119        const UNMOUNT = linux_raw_sys::general::IN_UNMOUNT;
120
121        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
122        const _ = !0;
123    }
124}