diff options
author | Carl Lerche <me@carllerche.com> | 2015-04-03 16:54:12 -0700 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2015-04-06 17:33:17 -0700 |
commit | 9e935330dd252d4ec640197a6040df2aaeb583c9 (patch) | |
tree | 51b528bf8e36972c69ae004ea04ef8bc65456534 /src/unistd.rs | |
parent | e5ae756203a036aafed472a3e83af6941f546887 (diff) | |
download | nix-9e935330dd252d4ec640197a6040df2aaeb583c9.zip |
Get compiling on Rust 1.0 beta
Initially support this by assuming the lowest common denominator. The long
term solution is to improve the build system to allow pulling in more specific
features that are available on the target system.
Diffstat (limited to 'src/unistd.rs')
-rw-r--r-- | src/unistd.rs | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/unistd.rs b/src/unistd.rs index 64203f02..6d7e2982 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -102,32 +102,6 @@ pub fn dup2(oldfd: Fd, newfd: Fd) -> Result<Fd> { Ok(res) } -#[cfg(not(any(target_os = "macos", target_os = "ios")))] -pub fn dup3(oldfd: Fd, newfd: Fd, flags: OFlag) -> Result<Fd> { - type F = unsafe extern "C" fn(c_int, c_int, c_int) -> c_int; - - extern { - #[linkage = "extern_weak"] - static dup3: *const (); - } - - if !dup3.is_null() { - let res = unsafe { - mem::transmute::<*const (), F>(dup3)( - oldfd, newfd, flags.bits()) - }; - - if res < 0 { - return Err(Error::Sys(Errno::last())); - } - - Ok(res) - } else { - dup3_polyfill(oldfd, newfd, flags) - } -} - -#[cfg(any(target_os = "macos", target_os = "ios"))] pub fn dup3(oldfd: Fd, newfd: Fd, flags: OFlag) -> Result<Fd> { dup3_polyfill(oldfd, newfd, flags) } @@ -245,41 +219,6 @@ pub fn pipe() -> Result<(Fd, Fd)> { } } -#[cfg(any(target_os = "linux", target_os = "android"))] -pub fn pipe2(flags: OFlag) -> Result<(Fd, Fd)> { - type F = unsafe extern "C" fn(fds: *mut c_int, flags: c_int) -> c_int; - - extern { - #[linkage = "extern_weak"] - static pipe2: *const (); - } - - let feat_atomic = !pipe2.is_null(); - - unsafe { - let mut res; - let mut fds: [c_int; 2] = mem::uninitialized(); - - if feat_atomic { - res = mem::transmute::<*const (), F>(pipe2)( - fds.as_mut_ptr(), flags.bits()); - } else { - res = ffi::pipe(fds.as_mut_ptr()); - } - - if res < 0 { - return Err(Error::Sys(Errno::last())); - } - - if !feat_atomic { - try!(pipe2_setflags(fds[0], fds[1], flags)); - } - - Ok((fds[0], fds[1])) - } -} - -#[cfg(any(target_os = "macos", target_os = "ios"))] pub fn pipe2(flags: OFlag) -> Result<(Fd, Fd)> { unsafe { let mut res; |