summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2017-06-20 01:01:21 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2017-06-20 01:01:21 +0000
commit96f26dbed61ce0a7c99a73e93fa06aea2d764727 (patch)
tree92bd49a1dd21cdf6a8f3a9ec73cb57963ca86475 /src
parentebfd5c0e7b8f1f163e2295b9ab0f5c1591702356 (diff)
parentc77d50573eb6ce318e6da649b892093e30d190c4 (diff)
downloadnix-96f26dbed61ce0a7c99a73e93fa06aea2d764727.zip
Merge #622
622: Separate OpenBSD and FreeBSD in fcntl.rs r=asomers Those two OSes cannot be together since the following FreeBSD flags aren't available on OpenBSD. - `O_DIRECT` - `O_EXEC` - `O_TTY_INIT`
Diffstat (limited to 'src')
-rw-r--r--src/fcntl.rs36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/fcntl.rs b/src/fcntl.rs
index 97eff072..ee441df8 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;