Update the android CI image

It's got a new toolchain which should hopefully support some more modern
definitions.
diff --git a/.travis.yml b/.travis.yml
index 46f7500..0608b66 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,7 +25,7 @@
 matrix:
   include:
     - os: linux
-      env: TARGET=arm-linux-androideabi DOCKER=alexcrichton/rust-slave-android:2015-10-21
+      env: TARGET=arm-linux-androideabi DOCKER=alexcrichton/rust-slave-android:2015-11-22
       rust: nightly
     - os: linux
       env: TARGET=x86_64-unknown-linux-musl
diff --git a/ci/run.sh b/ci/run.sh
index 4f3b84c..ee08bc3 100644
--- a/ci/run.sh
+++ b/ci/run.sh
@@ -19,7 +19,7 @@
 
 case "$TARGET" in
   arm-linux-androideabi)
-    emulator @arm-18 -no-window &
+    emulator @arm-21 -no-window &
     adb wait-for-device
     adb push /tmp/$TARGET/debug/libc-test /data/libc-test
     adb shell /data/libc-test 2>&1 | tee /tmp/out
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 344ac8b..f94f705 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -138,6 +138,7 @@
         cfg.header("sys/eventfd.h");
         cfg.header("sys/prctl.h");
         cfg.header("sys/vfs.h");
+        cfg.header("sys/syscall.h");
         if !musl {
             cfg.header("linux/netlink.h");
             cfg.header("linux/magic.h");
@@ -304,6 +305,9 @@
             // typed 2nd arg on linux and android
             "gettimeofday" if linux || android || freebsd => true,
 
+            // not declared in newer android toolchains
+            "getdtablesize" if android => true,
+
             "dlerror" if android => true, // const-ness is added
             "dladdr" if musl => true, // const-ness only added recently
 
@@ -333,8 +337,20 @@
         }
     });
 
-    // Windows dllimport oddness?
-    cfg.skip_fn_ptrcheck(move |_| windows);
+    cfg.skip_fn_ptrcheck(move |name| {
+        match name {
+            // This used to be called bsd_signal in rev 18 of the android
+            // platform and is now just called signal, the old `bsd_signal`
+            // symbol, however, still remains, just gives a different function
+            // pointer.
+            "signal" if android => true,
+
+            // dllimport weirdness?
+            _ if windows => true,
+
+            _ => false,
+        }
+    });
 
     cfg.skip_field_type(move |struct_, field| {
         // This is a weird union, don't check the type.
@@ -352,7 +368,7 @@
     });
 
     cfg.fn_cname(move |name, cname| {
-        if windows || android {
+        if windows {
             cname.unwrap_or(name).to_string()
         } else {
             name.to_string()
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 2bce70f..6fc2153 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -524,6 +524,27 @@
     pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
     pub fn chroot(name: *const ::c_char) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "usleep$UNIX2003")]
+    pub fn usleep(secs: ::c_uint) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "send$UNIX2003")]
+    pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
+                flags: ::c_int) -> ::ssize_t;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "recv$UNIX2003")]
+    pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
+                flags: ::c_int) -> ::ssize_t;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "putenv$UNIX2003")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
+    pub fn putenv(string: *mut c_char) -> ::c_int;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "sendmsg$UNIX2003")]
+    pub fn sendmsg(fd: ::c_int, msg: *const msghdr, flags: ::c_int) -> ::ssize_t;
+    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+               link_name = "recvmsg$UNIX2003")]
+    pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t;
 }
 
 // TODO: get rid of this #[cfg(not(...))]
@@ -561,10 +582,6 @@
     pub fn getsid(pid: pid_t) -> pid_t;
     pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
                    -> ::c_int;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "putenv$UNIX2003")]
-    #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
-    pub fn putenv(string: *mut c_char) -> ::c_int;
     pub fn readlink(path: *const c_char,
                     buf: *mut c_char,
                     bufsz: ::size_t)
@@ -576,21 +593,10 @@
     pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
     pub fn sysconf(name: ::c_int) -> c_long;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "usleep$UNIX2003")]
-    pub fn usleep(secs: ::c_uint) -> ::c_int;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "recvfrom$UNIX2003")]
     pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
                     flags: ::c_int, addr: *mut sockaddr,
                     addrlen: *mut socklen_t) -> ::ssize_t;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "send$UNIX2003")]
-    pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
-                flags: ::c_int) -> ::ssize_t;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "recv$UNIX2003")]
-    pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
-                flags: ::c_int) -> ::ssize_t;
     pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
 
     #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
@@ -642,12 +648,6 @@
     pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
     pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "sendmsg$UNIX2003")]
-    pub fn sendmsg(fd: ::c_int, msg: *const msghdr, flags: ::c_int) -> ::ssize_t;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
-               link_name = "recvmsg$UNIX2003")]
-    pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t;
-    #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
                link_name = "tcdrain$UNIX2003")]
     pub fn tcdrain(fd: ::c_int) -> ::c_int;
     pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 973b1a4..f00cebd 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -13,8 +13,8 @@
 pub type blksize_t = u32;
 pub type dev_t = u32;
 pub type mode_t = u16;
-pub type nlink_t = u16;
-pub type useconds_t = i32;
+pub type nlink_t = u32;
+pub type useconds_t = u32;
 pub type socklen_t = i32;
 pub type pthread_t = c_long;
 pub type pthread_mutexattr_t = ::c_long;
@@ -30,8 +30,8 @@
         __st_ino: ::ino_t,
         pub st_mode: ::c_uint,
         pub st_nlink: ::c_uint,
-        pub st_uid: ::c_ulong,
-        pub st_gid: ::c_ulong,
+        pub st_uid: ::uid_t,
+        pub st_gid: ::gid_t,
         pub st_rdev: ::c_ulonglong,
         __pad3: [::c_uchar; 4],
         pub st_size: ::c_longlong,
@@ -125,7 +125,7 @@
         pub msg_iovlen: ::size_t,
         pub msg_control: *mut ::c_void,
         pub msg_controllen: ::size_t,
-        pub msg_flags: ::c_uint,
+        pub msg_flags: ::c_int,
     }
 
     pub struct termios {
@@ -385,7 +385,7 @@
 pub const O_EXCL: ::c_int = 128;
 pub const O_NOCTTY: ::c_int = 256;
 pub const O_NONBLOCK: ::c_int = 2048;
-pub const O_SYNC: ::c_int = 0x1000;
+pub const O_SYNC: ::c_int = 0x101000;
 pub const O_DIRECT: ::c_int = 0x10000;
 pub const O_DIRECTORY: ::c_int = 0x4000;
 pub const O_NOFOLLOW: ::c_int = 0x8000;
@@ -399,9 +399,9 @@
 pub const TCFLSH: ::c_int = 0x540B;
 pub const TCSBRKP: ::c_int = 0x5425;
 pub const TCGETS: ::c_int = 0x5401;
-pub const TCSANOW: ::c_int = 0x5402;
-pub const TCSADRAIN: ::c_int = 0x5403;
-pub const TCSAFLUSH: ::c_int = 0x5404;
+pub const TCSANOW: ::c_int = 0;
+pub const TCSADRAIN: ::c_int = 0x1;
+pub const TCSAFLUSH: ::c_int = 0x2;
 pub const IUTF8: ::tcflag_t = 0x00004000;
 pub const VEOF: usize = 4;
 pub const VEOL: usize = 11;
@@ -411,7 +411,7 @@
 pub const TOSTOP: ::tcflag_t = 0x00000100;
 pub const FLUSHO: ::tcflag_t = 0x00001000;
 
-pub const MS_RMT_MASK: ::c_ulong = 0x51;
+pub const MS_RMT_MASK: ::c_ulong = 0x800051;
 pub const MS_VERBOSE: ::c_ulong = 0x8000;
 
 pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
@@ -530,7 +530,6 @@
     pub fn madvise(addr: *const ::c_void, len: ::size_t, advice: ::c_int)
                    -> ::c_int;
     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
-    pub fn putenv(string: *const ::c_char) -> ::c_int;
     pub fn readlink(path: *const ::c_char,
                     buf: *mut ::c_char,
                     bufsz: ::size_t)
@@ -540,14 +539,9 @@
     pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
                     -> ::c_int;
     pub fn sysconf(name: ::c_int) -> ::c_long;
-    pub fn usleep(secs: ::c_ulong) -> ::c_int;
     pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
-                    flags: ::c_uint, addr: *const ::sockaddr,
+                    flags: ::c_int, addr: *const ::sockaddr,
                     addrlen: *mut ::socklen_t) -> ::ssize_t;
-    pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
-                flags: ::c_uint) -> ::ssize_t;
-    pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
-                flags: ::c_uint) -> ::ssize_t;
     pub fn getnameinfo(sa: *const ::sockaddr,
                        salen: ::socklen_t,
                        host: *mut ::c_char,
@@ -556,11 +550,8 @@
                        sevlen: ::size_t,
                        flags: ::c_int) -> ::c_int;
     pub fn timegm64(tm: *const ::tm) -> time64_t;
-    pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_uint) -> ::c_int;
-    pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_uint) -> ::c_int;
     pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
     pub fn ptrace(request: ::c_int, ...) -> ::c_long;
-    pub fn syscall(num: ::c_int, ...) -> ::c_int;
 }
 
 cfg_if! {
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index 7673cc6..355e2d2 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -13,6 +13,7 @@
 pub type fsfilcnt_t = ::c_ulong;
 pub type key_t = ::c_int;
 pub type shmatt_t = ::c_ulong;
+pub type mqd_t = ::c_int;
 
 pub enum fpos64_t {} // TODO: fill this out with a struct
 
@@ -506,7 +507,6 @@
                        sigmask: *const ::sigset_t) -> ::c_int;
     pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
     pub fn unshare(flags: ::c_int) -> ::c_int;
-    pub fn syscall(num: ::c_long, ...) -> ::c_long;
     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
 }
 
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index 046fbe3..1d132b2 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -3,7 +3,6 @@
 pub type rlim_t = c_ulong;
 pub type sa_family_t = u16;
 pub type pthread_key_t = ::c_uint;
-pub type mqd_t = ::c_int;
 pub type speed_t = ::c_uint;
 pub type tcflag_t = ::c_uint;
 
@@ -607,6 +606,7 @@
     pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
     pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
     pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
+    pub fn syscall(num: ::c_long, ...) -> ::c_long;
 }
 
 cfg_if! {