From 709cbdf12cacb6ecf42cca9000d1d46380b6ba62 Mon Sep 17 00:00:00 2001 From: Michael Neumann Date: Fri, 17 Nov 2017 12:23:41 +0100 Subject: Fix support for DragonFly * DragonFly does not have a O_DSYNC flag * Fix type_of_cmsg_data on DragonFly * No fexecve() on DragonFly * Do not run aio test cases on DragonFly * Keep target lists in alphabetical order * Unscrable #[cfg] directives and use cfg_if! macro instead * Fix errno on DragonFly Below follows an explanation why we have to use a C extension to get errno working on DragonFly: DragonFly uses a thread-local errno variable, but #[thread_local] is feature-gated and not available in stable Rust as of this writing (Rust 1.21.0). We have to use a C extension (src/errno_dragonfly.c) to access it. Tracking issue for `thread_local` stabilization: https://github.com/rust-lang/rust/issues/29594 Once this becomes stable, we can remove build.rs, src/errno_dragonfly.c, remove the build-dependency from Cargo.toml, and use: extern { #[thread_local] static errno: c_int; } Now all targets will use the build.rs script, but only on DragonFly this will do something. Also, there are no additional dependencies for targets other than DragonFly (no gcc dep). --- src/unistd.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/unistd.rs') diff --git a/src/unistd.rs b/src/unistd.rs index c3c78414..81333b74 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -630,8 +630,11 @@ pub fn execvp(filename: &CString, args: &[CString]) -> Result { /// /// This function is similar to `execve`, except that the program to be executed /// is referenced as a file descriptor instead of a path. -#[cfg(any(target_os = "android", target_os = "dragonfly", target_os = "freebsd", - target_os = "netbsd", target_os = "openbsd", target_os = "linux"))] +#[cfg(any(target_os = "android", + target_os = "freebsd", + target_os = "linux", + target_os = "netbsd", + target_os = "openbsd"))] #[inline] pub fn fexecve(fd: RawFd, args: &[CString], env: &[CString]) -> Result { let args_p = to_exec_array(args); -- cgit v1.2.3