Debian Codegraph @

debian/missing-sources/libc/src/new/qurt/fcntl.rs

raw
1 //! Header: `fcntl.h`
2
3 use super::*;
4 use crate::prelude::*;
5
6 // File access modes
7 pub const O_RDONLY: c_int = 0x0000;
8 pub const O_WRONLY: c_int = 0x0001;
9 pub const O_RDWR: c_int = 0x0002;
10 pub const O_ACCMODE: c_int = 0x0003;
11
12 // File creation flags
13 pub const O_CREAT: c_int = 0x0040;
14 pub const O_EXCL: c_int = 0x0080;
15 pub const O_NOCTTY: c_int = 0x0100;
16 pub const O_TRUNC: c_int = 0x0200;
17
18 // File status flags
19 pub const O_APPEND: c_int = 0x0400;
20 pub const O_NONBLOCK: c_int = 0x0800;
21 pub const O_SYNC: c_int = 0x1000;
22 pub const O_FSYNC: c_int = O_SYNC;
23 pub const O_DSYNC: c_int = 0x1000;
24
25 // fcntl() commands
26 pub const F_DUPFD: c_int = 0;
27 pub const F_GETFD: c_int = 1;
28 pub const F_SETFD: c_int = 2;
29 pub const F_GETFL: c_int = 3;
30 pub const F_SETFL: c_int = 4;
31 pub const F_GETLK: c_int = 5;
32 pub const F_SETLK: c_int = 6;
33 pub const F_SETLKW: c_int = 7;
34
35 // File descriptor flags
36 pub const FD_CLOEXEC: c_int = 1;
37
38 // Lock types for fcntl()
39 pub const F_RDLCK: c_int = 0;
40 pub const F_WRLCK: c_int = 1;
41 pub const F_UNLCK: c_int = 2;
42
43 // Functions
44 extern "C" {
45 pub fn open(pathname: *const c_char, flags: c_int, ...) -> c_int;
46 pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
47 pub fn creat(pathname: *const c_char, mode: mode_t) -> c_int;
48 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
49 }