diff --git a/src/fcntl.rs b/src/fcntl.rs index a295de3aa9..5d37e50060 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -288,7 +288,7 @@ mod consts { ); } -#[cfg(any(target_os = "freebsd", target_os = "openbsd"))] +#[cfg(target_os = "freebsd")] mod consts { use libc::{self, c_int}; @@ -325,6 +325,40 @@ mod consts { ); } +#[cfg(target_os = "openbsd")] +mod consts { + use libc::{self, c_int}; + + bitflags!( + pub flags OFlag: c_int { + const O_ACCMODE = libc::O_ACCMODE, + const O_RDONLY = libc::O_RDONLY, + const O_WRONLY = libc::O_WRONLY, + const O_RDWR = libc::O_RDWR, + const O_CREAT = libc::O_CREAT, + const O_EXCL = libc::O_EXCL, + const O_NOCTTY = libc::O_NOCTTY, + const O_TRUNC = libc::O_TRUNC, + const O_APPEND = libc::O_APPEND, + const O_NONBLOCK = libc::O_NONBLOCK, + const O_DIRECTORY = 0x0020000, + const O_NOFOLLOW = libc::O_NOFOLLOW, + const O_CLOEXEC = libc::O_CLOEXEC, + const O_SYNC = libc::O_SYNC, + const O_NDELAY = libc::O_NDELAY, + const O_FSYNC = libc::O_FSYNC, + const O_SHLOCK = 0x0000080, + const O_EXLOCK = 0x0000020, + } + ); + + bitflags!( + pub flags FdFlag: c_int { + const FD_CLOEXEC = 1 + } + ); +} + #[cfg(target_os = "netbsd")] mod consts { use libc::c_int;