diff options
author | Carl Lerche <me@carllerche.com> | 2014-10-02 15:42:03 -0700 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2014-10-02 15:42:03 -0700 |
commit | 67e6410805279cb46ddf69c2ddd3454b9f847c92 (patch) | |
tree | cd8685069b3f964a4b80dc490a029c0f23389204 | |
parent | 05b3bb1e77b8d5c7a0a3321801782fad5edf80c4 (diff) | |
download | nix-67e6410805279cb46ddf69c2ddd3454b9f847c92.zip |
Track Rust master
-rw-r--r-- | src/errno.rs | 114 | ||||
-rw-r--r-- | src/fcntl.rs | 6 | ||||
-rw-r--r-- | src/features.rs | 3 | ||||
-rw-r--r-- | src/lib.rs | 22 | ||||
-rw-r--r-- | src/sched.rs | 2 | ||||
-rw-r--r-- | src/sys/mod.rs | 6 | ||||
-rw-r--r-- | src/sys/socket.rs | 6 | ||||
-rw-r--r-- | src/syscall.rs | 2 | ||||
-rw-r--r-- | src/unistd.rs | 3 |
9 files changed, 52 insertions, 112 deletions
diff --git a/src/errno.rs b/src/errno.rs index ebc1852a..e49adfe5 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -287,152 +287,115 @@ impl SysError { #[cfg(target_os = "linux")] EHWPOISON => "Memory page has hardware error", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENOTSUP => "Operation not supported", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EPROCLIM => "Too many processes", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EUSERS => "Too many users", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EDQUOT => "Disc quota exceeded", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ESTALE => "Stale NFS file handle", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EREMOTE => "Stale NFS file handle", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EBADRPC => "RPC struct is bad", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ERPCMISMATCH => "RPC version wrong", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EPROGUNAVAIL => "RPC prog. not avail", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EPROGMISMATCH => "Program version wrong", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EPROCUNAVAIL => "Bad procedure for program", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EFTYPE => "Inappropriate file type or format", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EAUTH => "Authentication error", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENEEDAUTH => "Need authenticator", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EPWROFF => "Device power is off", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EDEVERR => "Device error, e.g. paper out", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EOVERFLOW => "Value too large to be stored in data type", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EBADEXEC => "Bad executable", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EBADARCH => "Bad CPU type in executable", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ESHLIBVERS => "Shared library version mismatch", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EBADMACHO => "Malformed Macho file", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ECANCELED => "Operation canceled", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EILSEQ => "Illegal byte sequence", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENOATTR => "Attribute not found", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EBADMSG => "Bad message", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EMULTIHOP => "Reserved", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENODATA => "No message available on STREAM", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENOLINK => "Reserved", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENOSR => "No STREAM resources", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENOSTR => "Not a STREAM", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EPROTO => "Protocol error", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ETIME => "STREAM ioctl timeout", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EOPNOTSUPP => "Operation not supported on socket", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENOPOLICY => "No such policy registered", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] ENOTRECOVERABLE => "State not recoverable", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EOWNERDEAD => "Previous owner died", - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] EQFULL => "Interface output queue is full", } } @@ -596,8 +559,7 @@ mod consts { pub static EDEADLOCK: Errno = EDEADLK; } -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] mod consts { #[deriving(Show, Clone, PartialEq, FromPrimitive)] pub enum Errno { diff --git a/src/fcntl.rs b/src/fcntl.rs index de1b84c7..68cc610b 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -40,8 +40,7 @@ mod ffi { pub static F_GETLK: c_int = 5; } - #[cfg(target_os = "macos")] - #[cfg(target_os = "ios")] + #[cfg(any(target_os = "macos", target_os = "ios"))] mod os { use libc::{c_int, c_short, off_t, pid_t}; @@ -153,8 +152,7 @@ mod consts { ) } -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] mod consts { use libc::c_int; diff --git a/src/features.rs b/src/features.rs index db8bddf0..bfe3dc4a 100644 --- a/src/features.rs +++ b/src/features.rs @@ -7,8 +7,7 @@ mod os { } } -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] mod os { pub fn atomic_cloexec() -> bool { false @@ -1,4 +1,5 @@ #![crate_name = "nix"] + #![feature(globs)] #![feature(linkage)] #![allow(non_camel_case_types)] @@ -8,21 +9,16 @@ extern crate libc; // Re-export some libc constants pub use libc::{c_int, c_void}; +#[cfg(unix)] pub use errno::{SysResult, SysError}; -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(unix)] pub mod errno; -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(unix)] pub mod features; -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(unix)] pub mod fcntl; #[cfg(target_os = "linux")] @@ -31,15 +27,11 @@ pub mod mount; #[cfg(target_os = "linux")] pub mod sched; -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(unix)] pub mod sys; #[cfg(target_os = "linux")] pub mod syscall; -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(unix)] pub mod unistd; diff --git a/src/sched.rs b/src/sched.rs index d1caaf96..debe72e6 100644 --- a/src/sched.rs +++ b/src/sched.rs @@ -1,5 +1,3 @@ -#![cfg(target_os = "linux")] - use std::mem; use libc::{c_int, c_uint, c_void}; use super::{SysResult, SysError}; diff --git a/src/sys/mod.rs b/src/sys/mod.rs index 6052b2fd..8c588ea1 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -2,16 +2,12 @@ #[cfg(target_os = "linux")] pub mod epoll; -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] pub mod event; #[cfg(target_os = "linux")] pub mod eventfd; -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] pub mod socket; #[cfg(target_os = "linux")] diff --git a/src/sys/socket.rs b/src/sys/socket.rs index 4956b59b..edbbad97 100644 --- a/src/sys/socket.rs +++ b/src/sys/socket.rs @@ -97,8 +97,7 @@ mod consts { pub static SO_BUSY_POLL: SockOpt = 46; } -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] mod consts { use libc::{c_int}; @@ -255,8 +254,7 @@ pub fn accept4(sockfd: Fd, flags: SockFlag) -> SysResult<Fd> { Ok(res) } -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] pub fn accept4(sockfd: Fd, flags: SockFlag) -> SysResult<Fd> { let res = unsafe { ffi::accept(sockfd, ptr::null_mut(), ptr::null_mut()) }; diff --git a/src/syscall.rs b/src/syscall.rs index eb192dc2..85f6e730 100644 --- a/src/syscall.rs +++ b/src/syscall.rs @@ -1,5 +1,3 @@ -#![cfg(target_os = "linux")] - use libc::c_int; pub use self::arch::*; diff --git a/src/unistd.rs b/src/unistd.rs index 506bceaf..c793bf4c 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -238,8 +238,7 @@ pub fn pipe2(flags: OFlag) -> SysResult<(Fd, Fd)> { } } -#[cfg(target_os = "macos")] -#[cfg(target_os = "ios")] +#[cfg(any(target_os = "macos", target_os = "ios"))] pub fn pipe2(flags: OFlag) -> SysResult<(Fd, Fd)> { unsafe { let mut res; |