]> git.lizzy.rs Git - rust.git/blobdiff - src/libnative/io/c_unix.rs
auto merge of #15999 : Kimundi/rust/fix_folder, r=nikomatsakis
[rust.git] / src / libnative / io / c_unix.rs
index e6cb5cb76f11e8cab23897f50b5d2b23c9b11e6a..af4d309dfe250d2853ed2d48909b2874449699b2 100644 (file)
 use libc;
 
 #[cfg(target_os = "macos")]
+#[cfg(target_os = "ios")]
 #[cfg(target_os = "freebsd")]
+#[cfg(target_os = "dragonfly")]
 pub static FIONBIO: libc::c_ulong = 0x8004667e;
-#[cfg(target_os = "linux", not(target_arch = "mips"))]
+#[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")]
 pub static FIONBIO: libc::c_ulong = 0x5421;
 #[cfg(target_os = "linux", target_arch = "mips")]
+#[cfg(target_os = "linux", 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")]
 pub static FIOCLEX: libc::c_ulong = 0x20006601;
-#[cfg(target_os = "linux", not(target_arch = "mips"))]
+#[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")]
 pub static FIOCLEX: libc::c_ulong = 0x5451;
 #[cfg(target_os = "linux", target_arch = "mips")]
+#[cfg(target_os = "linux", 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")]
 pub static MSG_DONTWAIT: libc::c_int = 0x80;
 #[cfg(target_os = "linux")]
 #[cfg(target_os = "android")]
 
 extern {
     pub fn gettimeofday(timeval: *mut libc::timeval,
-                        tzp: *libc::c_void) -> libc::c_int;
+                        tzp: *mut libc::c_void) -> libc::c_int;
     pub fn select(nfds: libc::c_int,
-                  readfds: *fd_set,
-                  writefds: *fd_set,
-                  errorfds: *fd_set,
-                  timeout: *libc::timeval) -> libc::c_int;
+                  readfds: *mut fd_set,
+                  writefds: *mut fd_set,
+                  errorfds: *mut fd_set,
+                  timeout: *mut libc::timeval) -> libc::c_int;
     pub fn getsockopt(sockfd: libc::c_int,
                       level: libc::c_int,
                       optname: libc::c_int,
@@ -66,7 +78,7 @@ pub fn waitpid(pid: libc::pid_t, status: *mut libc::c_int,
                    options: libc::c_int) -> libc::pid_t;
 
     pub fn sigaction(signum: libc::c_int,
-                     act: *sigaction,
+                     act: *const sigaction,
                      oldact: *mut sigaction) -> libc::c_int;
 
     pub fn sigaddset(set: *mut sigset_t, signum: libc::c_int) -> libc::c_int;
@@ -75,6 +87,7 @@ pub fn sigaction(signum: libc::c_int,
 }
 
 #[cfg(target_os = "macos")]
+#[cfg(target_os = "ios")]
 mod select {
     pub static FD_SETSIZE: uint = 1024;
 
@@ -83,12 +96,13 @@ pub struct fd_set {
     }
 
     pub fn fd_set(set: &mut fd_set, fd: i32) {
-        set.fds_bits[(fd / 32) as uint] |= 1 << (fd % 32);
+        set.fds_bits[(fd / 32) as uint] |= 1 << ((fd % 32) as uint);
     }
 }
 
 #[cfg(target_os = "android")]
 #[cfg(target_os = "freebsd")]
+#[cfg(target_os = "dragonfly")]
 #[cfg(target_os = "linux")]
 mod select {
     use std::uint;
@@ -96,6 +110,7 @@ mod select {
     pub static FD_SETSIZE: uint = 1024;
 
     pub struct fd_set {
+        // FIXME: shouldn't this be a c_ulong?
         fds_bits: [uint, ..(FD_SETSIZE / uint::BITS)]
     }
 
@@ -105,7 +120,9 @@ pub fn fd_set(set: &mut fd_set, fd: i32) {
     }
 }
 
-#[cfg(target_os = "linux", not(target_arch = "mips"))]
+#[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")]
 mod signal {
     use libc;
@@ -149,6 +166,7 @@ pub struct sigset_t {
 }
 
 #[cfg(target_os = "linux", target_arch = "mips")]
+#[cfg(target_os = "linux", target_arch = "mipsel")]
 mod signal {
     use libc;
 
@@ -187,7 +205,9 @@ pub struct sigset_t {
 }
 
 #[cfg(target_os = "macos")]
+#[cfg(target_os = "ios")]
 #[cfg(target_os = "freebsd")]
+#[cfg(target_os = "dragonfly")]
 mod signal {
     use libc;
 
@@ -201,8 +221,10 @@ mod signal {
     pub static SIGCHLD: libc::c_int = 20;
 
     #[cfg(target_os = "macos")]
+    #[cfg(target_os = "ios")]
     pub type sigset_t = u32;
     #[cfg(target_os = "freebsd")]
+    #[cfg(target_os = "dragonfly")]
     pub struct sigset_t {
         bits: [u32, ..4],
     }
@@ -219,6 +241,7 @@ pub struct siginfo {
     }
 
     #[cfg(target_os = "macos")]
+    #[cfg(target_os = "ios")]
     pub struct sigaction {
         pub sa_handler: extern fn(libc::c_int),
         sa_tramp: *mut libc::c_void,
@@ -227,6 +250,7 @@ pub struct sigaction {
     }
 
     #[cfg(target_os = "freebsd")]
+    #[cfg(target_os = "dragonfly")]
     pub struct sigaction {
         pub sa_handler: extern fn(libc::c_int),
         pub sa_flags: libc::c_int,