Browse Source

Stub out set_cloexec

pull/10/head
Fenrir 7 years ago committed by FenrirWolf
parent
commit
48ee173596
  1. 26
      ctr-std/src/sys/unix/fd.rs

26
ctr-std/src/sys/unix/fd.rs

@ -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 {

Loading…
Cancel
Save