rustix/backend/linux_raw/io/
types.rs

1use crate::backend::c;
2use bitflags::bitflags;
3
4bitflags! {
5    /// `FD_*` constants for use with [`fcntl_getfd`] and [`fcntl_setfd`].
6    ///
7    /// [`fcntl_getfd`]: crate::io::fcntl_getfd
8    /// [`fcntl_setfd`]: crate::io::fcntl_setfd
9    #[repr(transparent)]
10    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
11    pub struct FdFlags: c::c_uint {
12        /// `FD_CLOEXEC`
13        const CLOEXEC = linux_raw_sys::general::FD_CLOEXEC;
14
15        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
16        const _ = !0;
17    }
18}
19
20bitflags! {
21    /// `RWF_*` constants for use with [`preadv2`] and [`pwritev2`].
22    ///
23    /// [`preadv2`]: crate::io::preadv2
24    /// [`pwritev2`]: crate::io::pwritev
25    #[repr(transparent)]
26    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
27    pub struct ReadWriteFlags: c::c_uint {
28        /// `RWF_DSYNC` (since Linux 4.7)
29        const DSYNC = linux_raw_sys::general::RWF_DSYNC;
30        /// `RWF_HIPRI` (since Linux 4.6)
31        const HIPRI = linux_raw_sys::general::RWF_HIPRI;
32        /// `RWF_SYNC` (since Linux 4.7)
33        const SYNC = linux_raw_sys::general::RWF_SYNC;
34        /// `RWF_NOWAIT` (since Linux 4.14)
35        const NOWAIT = linux_raw_sys::general::RWF_NOWAIT;
36        /// `RWF_APPEND` (since Linux 4.16)
37        const APPEND = linux_raw_sys::general::RWF_APPEND;
38
39        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
40        const _ = !0;
41    }
42}
43
44bitflags! {
45    /// `O_*` constants for use with [`dup2`].
46    ///
47    /// [`dup2`]: crate::io::dup2
48    #[repr(transparent)]
49    #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
50    pub struct DupFlags: c::c_uint {
51        /// `O_CLOEXEC`
52        const CLOEXEC = linux_raw_sys::general::O_CLOEXEC;
53
54        /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
55        const _ = !0;
56    }
57}