use libc;
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
-#[cfg(target_os = "freebsd")]
-#[cfg(target_os = "dragonfly")]
+#[cfg(any(target_os = "macos",
+ target_os = "ios",
+ target_os = "freebsd",
+ target_os = "dragonfly"))]
pub static FIONBIO: libc::c_ulong = 0x8004667e;
-#[cfg(target_os = "linux", target_arch = "x86")]
-#[cfg(target_os = "linux", target_arch = "x86_64")]
-#[cfg(target_os = "linux", target_arch = "arm")]
-#[cfg(target_os = "android")]
+#[cfg(any(all(target_os = "linux",
+ any(target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "arm")),
+ target_os = "android"))]
pub static FIONBIO: libc::c_ulong = 0x5421;
-#[cfg(target_os = "linux", target_arch = "mips")]
-#[cfg(target_os = "linux", target_arch = "mipsel")]
+#[cfg(all(target_os = "linux",
+ any(target_arch = "mips", target_arch = "mipsel")))]
pub static FIONBIO: libc::c_ulong = 0x667e;
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
-#[cfg(target_os = "freebsd")]
-#[cfg(target_os = "dragonfly")]
+#[cfg(any(target_os = "macos",
+ target_os = "ios",
+ target_os = "freebsd",
+ target_os = "dragonfly"))]
pub static FIOCLEX: libc::c_ulong = 0x20006601;
-#[cfg(target_os = "linux", target_arch = "x86")]
-#[cfg(target_os = "linux", target_arch = "x86_64")]
-#[cfg(target_os = "linux", target_arch = "arm")]
-#[cfg(target_os = "android")]
+#[cfg(any(all(target_os = "linux",
+ any(target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "arm")),
+ target_os = "android"))]
pub static FIOCLEX: libc::c_ulong = 0x5451;
-#[cfg(target_os = "linux", target_arch = "mips")]
-#[cfg(target_os = "linux", target_arch = "mipsel")]
+#[cfg(all(target_os = "linux",
+ any(target_arch = "mips", target_arch = "mipsel")))]
pub static FIOCLEX: libc::c_ulong = 0x6601;
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
-#[cfg(target_os = "freebsd")]
-#[cfg(target_os = "dragonfly")]
+#[cfg(any(target_os = "macos",
+ target_os = "ios",
+ target_os = "freebsd",
+ target_os = "dragonfly"))]
pub static MSG_DONTWAIT: libc::c_int = 0x80;
-#[cfg(target_os = "linux")]
-#[cfg(target_os = "android")]
+#[cfg(any(target_os = "linux", target_os = "android"))]
pub static MSG_DONTWAIT: libc::c_int = 0x40;
pub static WNOHANG: libc::c_int = 1;
pub fn sigemptyset(set: *mut sigset_t) -> libc::c_int;
}
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
+#[cfg(any(target_os = "macos", target_os = "ios"))]
mod select {
pub static FD_SETSIZE: uint = 1024;
}
}
-#[cfg(target_os = "android")]
-#[cfg(target_os = "freebsd")]
-#[cfg(target_os = "dragonfly")]
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android",
+ target_os = "freebsd",
+ target_os = "dragonfly",
+ target_os = "linux"))]
mod select {
use std::uint;
use libc;
}
}
-#[cfg(target_os = "linux", target_arch = "x86")]
-#[cfg(target_os = "linux", target_arch = "x86_64")]
-#[cfg(target_os = "linux", target_arch = "arm")]
-#[cfg(target_os = "android")]
+#[cfg(any(all(target_os = "linux",
+ any(target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "arm")),
+ target_os = "android"))]
mod signal {
use libc;
}
}
-#[cfg(target_os = "linux", target_arch = "mips")]
-#[cfg(target_os = "linux", target_arch = "mipsel")]
+#[cfg(all(target_os = "linux",
+ any(target_arch = "mips", target_arch = "mipsel")))]
mod signal {
use libc;
}
}
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
-#[cfg(target_os = "freebsd")]
-#[cfg(target_os = "dragonfly")]
+#[cfg(any(target_os = "macos",
+ target_os = "ios",
+ target_os = "freebsd",
+ target_os = "dragonfly"))]
mod signal {
use libc;
fn datasync(&mut self) -> IoResult<()> {
return super::mkerr_libc(os_datasync(self.fd()));
- #[cfg(target_os = "macos")]
- #[cfg(target_os = "ios")]
+ #[cfg(any(target_os = "macos", target_os = "ios"))]
fn os_datasync(fd: c_int) -> c_int {
unsafe { libc::fcntl(fd, libc::F_FULLFSYNC) }
}
fn os_datasync(fd: c_int) -> c_int {
retry(|| unsafe { libc::fdatasync(fd) })
}
- #[cfg(not(target_os = "macos"), not(target_os = "ios"), not(target_os = "linux"))]
+ #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "linux")))]
fn os_datasync(fd: c_int) -> c_int {
retry(|| unsafe { libc::fsync(fd) })
}
// FileStat times are in milliseconds
fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 }
- #[cfg(not(target_os = "linux"), not(target_os = "android"))]
+ #[cfg(not(any(target_os = "linux", target_os = "android")))]
fn flags(stat: &libc::stat) -> u64 { stat.st_flags as u64 }
- #[cfg(target_os = "linux")] #[cfg(target_os = "android")]
+ #[cfg(any(target_os = "linux", target_os = "android"))]
fn flags(_stat: &libc::stat) -> u64 { 0 }
- #[cfg(not(target_os = "linux"), not(target_os = "android"))]
+ #[cfg(not(any(target_os = "linux", target_os = "android")))]
fn gen(stat: &libc::stat) -> u64 { stat.st_gen as u64 }
- #[cfg(target_os = "linux")] #[cfg(target_os = "android")]
+ #[cfg(any(target_os = "linux", target_os = "android"))]
fn gen(_stat: &libc::stat) -> u64 { 0 }
rtio::FileStat {
}
}
- #[cfg(target_os = "macos")]
- #[cfg(target_os = "ios")]
+ #[cfg(any(target_os = "macos", target_os = "ios"))]
fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPALIVE,
seconds as libc::c_int)
}
- #[cfg(target_os = "freebsd")]
- #[cfg(target_os = "dragonfly")]
+ #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
seconds as libc::c_int)
}
- #[cfg(not(target_os = "macos"), not(target_os = "ios"), not(target_os = "freebsd"),
- not(target_os = "dragonfly"))]
+ #[cfg(not(any(target_os = "macos",
+ target_os = "ios",
+ target_os = "freebsd",
+ target_os = "dragonfly")))]
fn set_tcp_keepalive(&mut self, _seconds: uint) -> IoResult<()> {
Ok(())
}