Skip to content

Commit

Permalink
Haiku: Work around the lack of the FIOCLEX ioctl
Browse files Browse the repository at this point in the history
* Hand rebased from Niels original work on 1.9.0
  • Loading branch information
nielx authored and kallisti5 committed Sep 25, 2016
1 parent 1a6fc8b commit 783ab77
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libstd/sys/unix/fd.rs
Expand Up @@ -59,14 +59,20 @@ impl FileDesc {
Ok(ret as usize)
}

#[cfg(not(any(target_env = "newlib", target_os = "solaris", target_os = "emscripten")))]
#[cfg(not(any(target_env = "newlib",
target_os = "solaris",
target_os = "emscripten",
target_os = "haiku")))]
pub fn set_cloexec(&self) -> io::Result<()> {
unsafe {
cvt(libc::ioctl(self.fd, libc::FIOCLEX))?;
Ok(())
}
}
#[cfg(any(target_env = "newlib", target_os = "solaris", target_os = "emscripten"))]
#[cfg(any(target_env = "newlib",
target_os = "solaris",
target_os = "emscripten",
target_os = "haiku"))]
pub fn set_cloexec(&self) -> io::Result<()> {
unsafe {
let previous = cvt(libc::fcntl(self.fd, libc::F_GETFD))?;
Expand Down

0 comments on commit 783ab77

Please sign in to comment.