MCPcopy Create free account
hub / github.com/PLSysSec/wave / to_posix

Method to_posix

src/types/platform/linux.rs:35–53  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

33
34impl FdFlags {
35 pub fn to_posix(&self) -> i32 {
36 let mut flags = 0;
37 if nth_bit_set(self.0, 0) {
38 flags = bitwise_or(flags, libc::O_APPEND)
39 }
40 if nth_bit_set(self.0, 1) {
41 flags = bitwise_or(flags, libc::O_DSYNC)
42 }
43 if nth_bit_set(self.0, 2) {
44 flags = bitwise_or(flags, libc::O_NONBLOCK)
45 }
46 if nth_bit_set(self.0, 3) {
47 flags = bitwise_or(flags, libc::O_RSYNC)
48 }
49 if nth_bit_set(self.0, 4) {
50 flags = bitwise_or(flags, libc::O_SYNC)
51 }
52 flags
53 }
54
55 pub fn from_posix(flags: i32) -> Self {
56 // FdFlags(flags as u16)

Callers

nothing calls this directly

Calls 2

nth_bit_setFunction · 0.85
bitwise_orFunction · 0.85

Tested by

no test coverage detected