Skip to content

Commit ccdcee7

Browse files
committed
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`
2 parents ab5435e + c77d505 commit ccdcee7

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/fcntl.rs

+35-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ mod consts {
288288
);
289289
}
290290

291-
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
291+
#[cfg(target_os = "freebsd")]
292292
mod consts {
293293
use libc::{self, c_int};
294294

@@ -325,6 +325,40 @@ mod consts {
325325
);
326326
}
327327

328+
#[cfg(target_os = "openbsd")]
329+
mod consts {
330+
use libc::{self, c_int};
331+
332+
bitflags!(
333+
pub flags OFlag: c_int {
334+
const O_ACCMODE = libc::O_ACCMODE,
335+
const O_RDONLY = libc::O_RDONLY,
336+
const O_WRONLY = libc::O_WRONLY,
337+
const O_RDWR = libc::O_RDWR,
338+
const O_CREAT = libc::O_CREAT,
339+
const O_EXCL = libc::O_EXCL,
340+
const O_NOCTTY = libc::O_NOCTTY,
341+
const O_TRUNC = libc::O_TRUNC,
342+
const O_APPEND = libc::O_APPEND,
343+
const O_NONBLOCK = libc::O_NONBLOCK,
344+
const O_DIRECTORY = 0x0020000,
345+
const O_NOFOLLOW = libc::O_NOFOLLOW,
346+
const O_CLOEXEC = libc::O_CLOEXEC,
347+
const O_SYNC = libc::O_SYNC,
348+
const O_NDELAY = libc::O_NDELAY,
349+
const O_FSYNC = libc::O_FSYNC,
350+
const O_SHLOCK = 0x0000080,
351+
const O_EXLOCK = 0x0000020,
352+
}
353+
);
354+
355+
bitflags!(
356+
pub flags FdFlag: c_int {
357+
const FD_CLOEXEC = 1
358+
}
359+
);
360+
}
361+
328362
#[cfg(target_os = "netbsd")]
329363
mod consts {
330364
use libc::c_int;

0 commit comments

Comments
 (0)