|
|
@ -110,34 +110,10 @@ impl FileDesc { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(any(target_env = "newlib",
|
|
|
|
// We don't have fork/exec on the 3DS, so this shouldn't need to do anything
|
|
|
|
target_os = "solaris", |
|
|
|
|
|
|
|
target_os = "emscripten", |
|
|
|
|
|
|
|
target_os = "fuchsia", |
|
|
|
|
|
|
|
target_os = "l4re", |
|
|
|
|
|
|
|
target_os = "haiku")))] |
|
|
|
|
|
|
|
pub fn set_cloexec(&self) -> io::Result<()> { |
|
|
|
pub fn set_cloexec(&self) -> io::Result<()> { |
|
|
|
unsafe { |
|
|
|
|
|
|
|
cvt(libc::ioctl(self.fd, libc::FIOCLEX))?; |
|
|
|
|
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#[cfg(any(target_env = "newlib",
|
|
|
|
|
|
|
|
target_os = "solaris", |
|
|
|
|
|
|
|
target_os = "emscripten", |
|
|
|
|
|
|
|
target_os = "fuchsia", |
|
|
|
|
|
|
|
target_os = "l4re", |
|
|
|
|
|
|
|
target_os = "haiku"))] |
|
|
|
|
|
|
|
pub fn set_cloexec(&self) -> io::Result<()> { |
|
|
|
|
|
|
|
unsafe { |
|
|
|
|
|
|
|
let previous = cvt(libc::fcntl(self.fd, libc::F_GETFD))?; |
|
|
|
|
|
|
|
let new = previous | libc::FD_CLOEXEC; |
|
|
|
|
|
|
|
if new != previous { |
|
|
|
|
|
|
|
cvt(libc::fcntl(self.fd, libc::F_SETFD, new))?; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Ok(()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { |
|
|
|
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|