Skip to main content

relibc/header/bits_open-flags/
redox.rs

1use crate::platform::types::c_int;
2
3/// Open for reading only.
4pub const O_RDONLY: c_int = 0x0001_0000;
5/// Open for writing only.
6pub const O_WRONLY: c_int = 0x0002_0000;
7/// Open for reading and writing.
8pub const O_RDWR: c_int = 0x0003_0000;
9/// Mask for file access modes.
10pub const O_ACCMODE: c_int = 0x0003_0000;
11/// Non-blocking mode.
12pub const O_NONBLOCK: c_int = 0x0004_0000;
13/// Set append mode.
14pub const O_APPEND: c_int = 0x0008_0000;
15/// Non-POSIX, see <https://man.openbsd.org/open.2>.
16///
17/// Atomically obtain a shared lock.
18pub const O_SHLOCK: c_int = 0x0010_0000;
19/// Non-POSIX, see <https://man.openbsd.org/open.2>.
20///
21/// Atomically obtain an exclusive lock.
22pub const O_EXLOCK: c_int = 0x0020_0000;
23pub const O_ASYNC: c_int = 0x0040_0000;
24pub const O_FSYNC: c_int = 0x0080_0000;
25/// Write according to synchronized I/O file integrity completion.
26pub const O_SYNC: c_int = O_FSYNC;
27/// Atomically set the `FD_CLOEXEC` flag on the new file desciptor.
28pub const O_CLOEXEC: c_int = 0x0100_0000;
29/// Create file if it does not exist.
30pub const O_CREAT: c_int = 0x0200_0000;
31/// Truncate flag.
32pub const O_TRUNC: c_int = 0x0400_0000;
33/// Exclusive use flag.
34pub const O_EXCL: c_int = 0x0800_0000;
35/// Fail if file is a non-directory file.
36pub const O_DIRECTORY: c_int = 0x1000_0000;
37/// Non-POSIX, see <https://www.man7.org/linux/man-pages/man2/open.2.html>.
38///
39/// Get a file descriptor to indicate a location in the filesystem tree and
40/// to perform operations that act purely at the file descriptor level.
41pub const O_PATH: c_int = 0x2000_0000;
42pub const O_SYMLINK: c_int = 0x4000_0000;
43// Negative to allow it to be used as int
44/// Do not follow symbolic links.
45pub const O_NOFOLLOW: c_int = -0x8000_0000;
46
47/// Do not assign controlling terminal.
48pub const O_NOCTTY: c_int = 0x00000200;
49
50/// Non-POSIX, see <https://www.man7.org/linux/man-pages/man2/open.2.html>.
51///
52/// Alternative name for `O_NONBLOCK`.
53pub const O_NDELAY: c_int = O_NONBLOCK;