Skip to content

Commit 4b9b07c

Browse files
committed
Merge pull request rust-lang#88 from alexcrichton/update-android
Update the android CI image
2 parents 2c7e08c + 881ef9b commit 4b9b07c

File tree

7 files changed

+55
-48
lines changed

7 files changed

+55
-48
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525
matrix:
2626
include:
2727
- os: linux
28-
env: TARGET=arm-linux-androideabi DOCKER=alexcrichton/rust-slave-android:2015-10-21
28+
env: TARGET=arm-linux-androideabi DOCKER=alexcrichton/rust-slave-android:2015-11-22
2929
rust: nightly
3030
- os: linux
3131
env: TARGET=x86_64-unknown-linux-musl

ci/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ esac
1919

2020
case "$TARGET" in
2121
arm-linux-androideabi)
22-
emulator @arm-18 -no-window &
22+
emulator @arm-21 -no-window &
2323
adb wait-for-device
2424
adb push /tmp/$TARGET/debug/libc-test /data/libc-test
2525
adb shell /data/libc-test 2>&1 | tee /tmp/out

libc-test/build.rs

+19-3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ fn main() {
138138
cfg.header("sys/eventfd.h");
139139
cfg.header("sys/prctl.h");
140140
cfg.header("sys/vfs.h");
141+
cfg.header("sys/syscall.h");
141142
if !musl {
142143
cfg.header("linux/netlink.h");
143144
cfg.header("linux/magic.h");
@@ -304,6 +305,9 @@ fn main() {
304305
// typed 2nd arg on linux and android
305306
"gettimeofday" if linux || android || freebsd => true,
306307

308+
// not declared in newer android toolchains
309+
"getdtablesize" if android => true,
310+
307311
"dlerror" if android => true, // const-ness is added
308312
"dladdr" if musl => true, // const-ness only added recently
309313

@@ -333,8 +337,20 @@ fn main() {
333337
}
334338
});
335339

336-
// Windows dllimport oddness?
337-
cfg.skip_fn_ptrcheck(move |_| windows);
340+
cfg.skip_fn_ptrcheck(move |name| {
341+
match name {
342+
// This used to be called bsd_signal in rev 18 of the android
343+
// platform and is now just called signal, the old `bsd_signal`
344+
// symbol, however, still remains, just gives a different function
345+
// pointer.
346+
"signal" if android => true,
347+
348+
// dllimport weirdness?
349+
_ if windows => true,
350+
351+
_ => false,
352+
}
353+
});
338354

339355
cfg.skip_field_type(move |struct_, field| {
340356
// This is a weird union, don't check the type.
@@ -352,7 +368,7 @@ fn main() {
352368
});
353369

354370
cfg.fn_cname(move |name, cname| {
355-
if windows || android {
371+
if windows {
356372
cname.unwrap_or(name).to_string()
357373
} else {
358374
name.to_string()

src/unix/mod.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,27 @@ extern {
524524
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
525525
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
526526
pub fn chroot(name: *const ::c_char) -> ::c_int;
527+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
528+
link_name = "usleep$UNIX2003")]
529+
pub fn usleep(secs: ::c_uint) -> ::c_int;
530+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
531+
link_name = "send$UNIX2003")]
532+
pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
533+
flags: ::c_int) -> ::ssize_t;
534+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
535+
link_name = "recv$UNIX2003")]
536+
pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
537+
flags: ::c_int) -> ::ssize_t;
538+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
539+
link_name = "putenv$UNIX2003")]
540+
#[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
541+
pub fn putenv(string: *mut c_char) -> ::c_int;
542+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
543+
link_name = "sendmsg$UNIX2003")]
544+
pub fn sendmsg(fd: ::c_int, msg: *const msghdr, flags: ::c_int) -> ::ssize_t;
545+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
546+
link_name = "recvmsg$UNIX2003")]
547+
pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t;
527548
}
528549

529550
// TODO: get rid of this #[cfg(not(...))]
@@ -561,10 +582,6 @@ extern {
561582
pub fn getsid(pid: pid_t) -> pid_t;
562583
pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
563584
-> ::c_int;
564-
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
565-
link_name = "putenv$UNIX2003")]
566-
#[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
567-
pub fn putenv(string: *mut c_char) -> ::c_int;
568585
pub fn readlink(path: *const c_char,
569586
buf: *mut c_char,
570587
bufsz: ::size_t)
@@ -575,22 +592,11 @@ extern {
575592
#[cfg_attr(target_os = "netbsd", link_name = "__msync13")]
576593
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
577594
pub fn sysconf(name: ::c_int) -> c_long;
578-
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
579-
link_name = "usleep$UNIX2003")]
580-
pub fn usleep(secs: ::c_uint) -> ::c_int;
581595
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
582596
link_name = "recvfrom$UNIX2003")]
583597
pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
584598
flags: ::c_int, addr: *mut sockaddr,
585599
addrlen: *mut socklen_t) -> ::ssize_t;
586-
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
587-
link_name = "send$UNIX2003")]
588-
pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
589-
flags: ::c_int) -> ::ssize_t;
590-
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
591-
link_name = "recv$UNIX2003")]
592-
pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
593-
flags: ::c_int) -> ::ssize_t;
594600
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
595601

596602
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
@@ -641,12 +647,6 @@ extern {
641647
pub fn timegm(tm: *mut ::tm) -> time_t;
642648
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
643649
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
644-
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
645-
link_name = "sendmsg$UNIX2003")]
646-
pub fn sendmsg(fd: ::c_int, msg: *const msghdr, flags: ::c_int) -> ::ssize_t;
647-
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
648-
link_name = "recvmsg$UNIX2003")]
649-
pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t;
650650
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
651651
link_name = "tcdrain$UNIX2003")]
652652
pub fn tcdrain(fd: ::c_int) -> ::c_int;

src/unix/notbsd/android/mod.rs

+11-20
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub type blkcnt_t = u32;
1313
pub type blksize_t = u32;
1414
pub type dev_t = u32;
1515
pub type mode_t = u16;
16-
pub type nlink_t = u16;
17-
pub type useconds_t = i32;
16+
pub type nlink_t = u32;
17+
pub type useconds_t = u32;
1818
pub type socklen_t = i32;
1919
pub type pthread_t = c_long;
2020
pub type pthread_mutexattr_t = ::c_long;
@@ -30,8 +30,8 @@ s! {
3030
__st_ino: ::ino_t,
3131
pub st_mode: ::c_uint,
3232
pub st_nlink: ::c_uint,
33-
pub st_uid: ::c_ulong,
34-
pub st_gid: ::c_ulong,
33+
pub st_uid: ::uid_t,
34+
pub st_gid: ::gid_t,
3535
pub st_rdev: ::c_ulonglong,
3636
__pad3: [::c_uchar; 4],
3737
pub st_size: ::c_longlong,
@@ -125,7 +125,7 @@ s! {
125125
pub msg_iovlen: ::size_t,
126126
pub msg_control: *mut ::c_void,
127127
pub msg_controllen: ::size_t,
128-
pub msg_flags: ::c_uint,
128+
pub msg_flags: ::c_int,
129129
}
130130

131131
pub struct termios {
@@ -385,7 +385,7 @@ pub const O_CREAT: ::c_int = 64;
385385
pub const O_EXCL: ::c_int = 128;
386386
pub const O_NOCTTY: ::c_int = 256;
387387
pub const O_NONBLOCK: ::c_int = 2048;
388-
pub const O_SYNC: ::c_int = 0x1000;
388+
pub const O_SYNC: ::c_int = 0x101000;
389389
pub const O_DIRECT: ::c_int = 0x10000;
390390
pub const O_DIRECTORY: ::c_int = 0x4000;
391391
pub const O_NOFOLLOW: ::c_int = 0x8000;
@@ -399,9 +399,9 @@ pub const TCXONC: ::c_int = 0x540A;
399399
pub const TCFLSH: ::c_int = 0x540B;
400400
pub const TCSBRKP: ::c_int = 0x5425;
401401
pub const TCGETS: ::c_int = 0x5401;
402-
pub const TCSANOW: ::c_int = 0x5402;
403-
pub const TCSADRAIN: ::c_int = 0x5403;
404-
pub const TCSAFLUSH: ::c_int = 0x5404;
402+
pub const TCSANOW: ::c_int = 0;
403+
pub const TCSADRAIN: ::c_int = 0x1;
404+
pub const TCSAFLUSH: ::c_int = 0x2;
405405
pub const IUTF8: ::tcflag_t = 0x00004000;
406406
pub const VEOF: usize = 4;
407407
pub const VEOL: usize = 11;
@@ -411,7 +411,7 @@ pub const IEXTEN: ::tcflag_t = 0x00008000;
411411
pub const TOSTOP: ::tcflag_t = 0x00000100;
412412
pub const FLUSHO: ::tcflag_t = 0x00001000;
413413

414-
pub const MS_RMT_MASK: ::c_ulong = 0x51;
414+
pub const MS_RMT_MASK: ::c_ulong = 0x800051;
415415
pub const MS_VERBOSE: ::c_ulong = 0x8000;
416416

417417
pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
@@ -530,7 +530,6 @@ extern {
530530
pub fn madvise(addr: *const ::c_void, len: ::size_t, advice: ::c_int)
531531
-> ::c_int;
532532
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
533-
pub fn putenv(string: *const ::c_char) -> ::c_int;
534533
pub fn readlink(path: *const ::c_char,
535534
buf: *mut ::c_char,
536535
bufsz: ::size_t)
@@ -540,14 +539,9 @@ extern {
540539
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
541540
-> ::c_int;
542541
pub fn sysconf(name: ::c_int) -> ::c_long;
543-
pub fn usleep(secs: ::c_ulong) -> ::c_int;
544542
pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
545-
flags: ::c_uint, addr: *const ::sockaddr,
543+
flags: ::c_int, addr: *const ::sockaddr,
546544
addrlen: *mut ::socklen_t) -> ::ssize_t;
547-
pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
548-
flags: ::c_uint) -> ::ssize_t;
549-
pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
550-
flags: ::c_uint) -> ::ssize_t;
551545
pub fn getnameinfo(sa: *const ::sockaddr,
552546
salen: ::socklen_t,
553547
host: *mut ::c_char,
@@ -556,11 +550,8 @@ extern {
556550
sevlen: ::size_t,
557551
flags: ::c_int) -> ::c_int;
558552
pub fn timegm64(tm: *const ::tm) -> time64_t;
559-
pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_uint) -> ::c_int;
560-
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_uint) -> ::c_int;
561553
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
562554
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
563-
pub fn syscall(num: ::c_int, ...) -> ::c_int;
564555
}
565556

566557
cfg_if! {

src/unix/notbsd/linux/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub type fsblkcnt_t = ::c_ulong;
1313
pub type fsfilcnt_t = ::c_ulong;
1414
pub type key_t = ::c_int;
1515
pub type shmatt_t = ::c_ulong;
16+
pub type mqd_t = ::c_int;
1617

1718
pub enum fpos64_t {} // TODO: fill this out with a struct
1819

@@ -506,7 +507,6 @@ extern {
506507
sigmask: *const ::sigset_t) -> ::c_int;
507508
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
508509
pub fn unshare(flags: ::c_int) -> ::c_int;
509-
pub fn syscall(num: ::c_long, ...) -> ::c_long;
510510
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
511511
}
512512

src/unix/notbsd/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use dox::mem;
33
pub type rlim_t = c_ulong;
44
pub type sa_family_t = u16;
55
pub type pthread_key_t = ::c_uint;
6-
pub type mqd_t = ::c_int;
76
pub type speed_t = ::c_uint;
87
pub type tcflag_t = ::c_uint;
98

@@ -607,6 +606,7 @@ extern {
607606
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
608607
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
609608
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
609+
pub fn syscall(num: ::c_long, ...) -> ::c_long;
610610
}
611611

612612
cfg_if! {

0 commit comments

Comments
 (0)