userspace/target/operating_system/linux/syscall/open/
flags.rs1#[repr(isize)]
2#[derive(Clone, Copy)]
3pub enum Flag {
4 RDONLY = 0o0,
6 WRONLY = 0o1,
7 RDWR = 0o2,
8
9 CREAT = 0o100,
11 EXCL = 0o200,
12 NOCTTY = 0o400,
13 TRUNC = 0o1000,
14 APPEND = 0o2000,
15 NONBLOCK = 0o4000,
16 DSYNC = 0o10000,
17 SYNC = 0o4010000,
18 DIRECTORY = 0o200000,
19 NOFOLLOW = 0o400000,
20 CLOEXEC = 0o2000000,
21}
22
23impl Into<usize> for Flag {
24 fn into(self) -> usize {
25 self as usize
26 }
27}
28
29impl Into<i32> for Flag {
30 fn into(self) -> i32 {
31 self as i32
32 }
33}
34
35#[repr(isize)]
36#[derive(Clone, Copy)]
37pub enum AtFlag {
38 FDCWD = -100, REMOVEDIR = 0x200, SymlinkFollow = 0x400, SymlinkNoFollow = 0x100, }
44
45impl Into<usize> for AtFlag {
46 fn into(self) -> usize {
47 self as usize
48 }
49}
50
51impl Into<isize> for AtFlag {
52 fn into(self) -> isize {
53 self as isize
54 }
55}
56
57impl core::ops::BitOr<AtFlag> for Flag {
59 type Output = usize;
60 fn bitor(self, rhs: AtFlag) -> usize {
61 (self as usize) | (rhs as usize)
62 }
63}
64
65impl core::ops::BitOr<Flag> for AtFlag {
67 type Output = usize;
68 fn bitor(self, rhs: Flag) -> usize {
69 (self as usize) | (rhs as usize)
70 }
71}
72
73impl core::ops::BitOr for Flag {
75 type Output = usize;
76 fn bitor(self, rhs: Self) -> usize {
77 (self as usize) | (rhs as usize)
78 }
79}
80
81impl core::ops::BitOr for AtFlag {
83 type Output = usize;
84 fn bitor(self, rhs: Self) -> usize {
85 (self as usize) | (rhs as usize)
86 }
87}