Haiku: Work around the lack of the FIOCLEX ioctl

* Hand rebased from Niels original work on 1.9.0
This commit is contained in:
Niels Sascha Reedijk 2016-09-24 23:41:29 -05:00 committed by Alexander von Gluck IV
parent 1a6fc8b7b8
commit 783ab7766f

View File

@ -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))?;