]> git.lizzy.rs Git - rust.git/commitdiff
Fix libnative
authorSteven Fackler <sfackler@gmail.com>
Mon, 29 Sep 2014 07:28:50 +0000 (00:28 -0700)
committerSteven Fackler <sfackler@palantir.com>
Tue, 30 Sep 2014 19:52:47 +0000 (12:52 -0700)
src/libnative/io/c_unix.rs
src/libnative/io/file_unix.rs
src/libnative/io/mod.rs
src/libnative/io/net.rs
src/libnative/io/process.rs
src/libnative/lib.rs

index fa7da1de914b4489a380faac44e0e6c08386221c..2601d493443a17099ab64da5652a23a39029aa08 100644 (file)
 
 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;
@@ -86,8 +87,7 @@ pub fn sigaction(signum: libc::c_int,
     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;
 
@@ -101,10 +101,10 @@ pub fn fd_set(set: &mut fd_set, fd: i32) {
     }
 }
 
-#[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;
@@ -123,10 +123,11 @@ pub fn fd_set(set: &mut fd_set, fd: i32) {
     }
 }
 
-#[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;
 
@@ -173,8 +174,8 @@ pub struct sigset_t {
     }
 }
 
-#[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;
 
@@ -215,10 +216,10 @@ pub struct sigset_t {
     }
 }
 
-#[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;
 
index 1688b009ad7fb3b063951840af8c22facb44de0f..67aad1904b96f86971a45ac429b34d4a5625f8c9 100644 (file)
@@ -130,8 +130,7 @@ fn fsync(&mut self) -> IoResult<()> {
     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) }
         }
@@ -139,7 +138,7 @@ fn os_datasync(fd: c_int) -> c_int {
         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) })
         }
@@ -445,14 +444,14 @@ fn mkstat(stat: &libc::stat) -> rtio::FileStat {
     // 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 {
index 86f72bf65ddd399ca8d23fce1d5891bc10202995..954f7bbc59adcd0dd48b8b4039d99d5e1419c26a 100644 (file)
 #[path = "file_windows.rs"]
 pub mod file;
 
-#[cfg(target_os = "macos")]
-#[cfg(target_os = "ios")]
-#[cfg(target_os = "freebsd")]
-#[cfg(target_os = "dragonfly")]
-#[cfg(target_os = "android")]
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "macos",
+          target_os = "ios",
+          target_os = "freebsd",
+          target_os = "dragonfly",
+          target_os = "android",
+          target_os = "linux"))]
 #[path = "timer_unix.rs"]
 pub mod timer;
 
index 335a52b0bbed6ce63ed5f030b79ffeb52ef40a90..419748b75c324c56f47a736ce2942ca035f8a4d4 100644 (file)
@@ -282,20 +282,20 @@ fn set_keepalive(&mut self, seconds: Option<uint>) -> IoResult<()> {
         }
     }
 
-    #[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(())
     }
index cb392e1675feb2dc2ab6f2630a93fd773380c576..3a6ae42f9468dfe6da214182b4873c07308f091b 100644 (file)
@@ -840,18 +840,17 @@ fn free_handle(_handle: *mut ()) {
 #[cfg(unix)]
 fn translate_status(status: c_int) -> rtio::ProcessExit {
     #![allow(non_snake_case)]
-    #[cfg(target_os = "linux")]
-    #[cfg(target_os = "android")]
+    #[cfg(any(target_os = "linux", target_os = "android"))]
     mod imp {
         pub fn WIFEXITED(status: i32) -> bool { (status & 0xff) == 0 }
         pub fn WEXITSTATUS(status: i32) -> i32 { (status >> 8) & 0xff }
         pub fn WTERMSIG(status: i32) -> i32 { status & 0x7f }
     }
 
-    #[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 imp {
         pub fn WIFEXITED(status: i32) -> bool { (status & 0x7f) == 0 }
         pub fn WEXITSTATUS(status: i32) -> i32 { status >> 8 }
index 06f89d38ca0a183da8e7b9a8795a53ade841ec39..267ff3d2a81742542cd3ee61c5538d6635042b35 100644 (file)
 pub mod io;
 pub mod task;
 
-#[cfg(windows)]
-#[cfg(android)]
+#[cfg(any(windows, android))]
 static OS_DEFAULT_STACK_ESTIMATE: uint = 1 << 20;
-#[cfg(unix, not(android))]
+#[cfg(all(unix, not(android)))]
 static OS_DEFAULT_STACK_ESTIMATE: uint = 2 * (1 << 20);
 
 #[lang = "start"]