Skip to content

Commit

Permalink
Merge #622
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
bors[bot] committed Jun 20, 2017
2 parents ebfd5c0 + c77d505 commit 96f26db
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 96f26db

Please sign in to comment.