Skip to content

Commit 0299161

Browse files
committed
Update to NDK r15b (with unified headers) and add missing symbols needed by nix crate
1 parent a38631f commit 0299161

File tree

6 files changed

+35
-18
lines changed

6 files changed

+35
-18
lines changed

ci/android-install-ndk.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
set -ex
1313

14-
curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
15-
unzip -q android-ndk-r13b-linux-x86_64.zip
14+
curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip
15+
unzip -q android-ndk-r15b-linux-x86_64.zip
1616

1717
case "$1" in
1818
aarch64)
@@ -28,9 +28,10 @@ case "$1" in
2828
;;
2929
esac;
3030

31-
android-ndk-r13b/build/tools/make_standalone_toolchain.py \
31+
android-ndk-r15b/build/tools/make_standalone_toolchain.py \
32+
--unified-headers \
3233
--install-dir /android/ndk-$1 \
3334
--arch $arch \
3435
--api 24
3536

36-
rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b
37+
rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b

ci/run-docker.sh

100644100755
File mode changed.

libc-test/build.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ fn main() {
179179
cfg.header("sys/shm.h");
180180
cfg.header("sys/user.h");
181181
cfg.header("sys/fsuid.h");
182-
cfg.header("pty.h");
183182
cfg.header("shadow.h");
184183
cfg.header("linux/input.h");
185184
if x86_64 {
@@ -200,6 +199,7 @@ fn main() {
200199
cfg.header("sys/syscall.h");
201200
cfg.header("sys/personality.h");
202201
cfg.header("sys/swap.h");
202+
cfg.header("pty.h");
203203
if !uclibc {
204204
cfg.header("sys/sysinfo.h");
205205
}
@@ -337,6 +337,11 @@ fn main() {
337337
// definition. Because it's tested on other Linux targets, skip it.
338338
"input_mask" if musl => true,
339339

340+
// These structs have changed since unified headers in NDK r14b.
341+
// `st_atime` and `st_atime_nsec` have changed sign.
342+
// FIXME: unskip it for next major release
343+
"stat" | "stat64" if android => true,
344+
340345
_ => false
341346
}
342347
});
@@ -534,6 +539,13 @@ fn main() {
534539
// On Mac we don't use the default `close()`, instead using their $NOCANCEL variants.
535540
"close" if apple => true,
536541

542+
// Definition of those functions as changed since unified headers from NDK r14b
543+
// These changes imply some API breaking changes but are still ABI compatible.
544+
// We can wait for the next major release to be compliant with the new API.
545+
// FIXME: unskip these for next major release
546+
"strerror_r" | "madvise" | "msync" | "mprotect" | "recvfrom" | "getpriority" |
547+
"setpriority" | "personality" if android => true,
548+
537549
_ => false,
538550
}
539551
});

src/unix/notbsd/android/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
173173

174174
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
175175
pub const EPOLLONESHOT: ::c_int = 0x40000000;
176+
pub const EPOLLRDHUP: ::c_int = 0x00002000;
177+
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
176178

177179
pub const EFD_CLOEXEC: ::c_int = 0x80000;
178180

@@ -428,7 +430,7 @@ pub const SOL_NETROM: ::c_int = 259;
428430
pub const SOL_ROSE: ::c_int = 260;
429431

430432
#[doc(hidden)]
431-
pub const AF_MAX: ::c_int = 39;
433+
pub const AF_MAX: ::c_int = 43;
432434
#[doc(hidden)]
433435
pub const PF_MAX: ::c_int = AF_MAX;
434436

@@ -458,6 +460,7 @@ pub const O_NONBLOCK: ::c_int = 2048;
458460
pub const O_SYNC: ::c_int = 0x101000;
459461
pub const O_ASYNC: ::c_int = 0x2000;
460462
pub const O_NDELAY: ::c_int = 0x800;
463+
pub const O_DSYNC: ::c_int = 4096;
461464

462465
pub const NI_MAXHOST: ::size_t = 1025;
463466

@@ -562,6 +565,7 @@ pub const TIOCMBIC: ::c_int = 0x5417;
562565
pub const TIOCMSET: ::c_int = 0x5418;
563566
pub const FIONREAD: ::c_int = 0x541B;
564567
pub const TIOCCONS: ::c_int = 0x541D;
568+
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
565569

566570
pub const RTLD_NOLOAD: ::c_int = 0x4;
567571

src/unix/notbsd/linux/mod.rs

-12
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,6 @@ extern {
10131013
timeout: ::c_int,
10141014
sigmask: *const ::sigset_t) -> ::c_int;
10151015
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
1016-
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
10171016
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
10181017
pub fn mkostemps(template: *mut ::c_char,
10191018
suffixlen: ::c_int,
@@ -1023,15 +1022,6 @@ extern {
10231022
timeout: *const ::timespec) -> ::c_int;
10241023
pub fn sigwaitinfo(set: *const sigset_t,
10251024
info: *mut siginfo_t) -> ::c_int;
1026-
pub fn openpty(amaster: *mut ::c_int,
1027-
aslave: *mut ::c_int,
1028-
name: *mut ::c_char,
1029-
termp: *const termios,
1030-
winp: *const ::winsize) -> ::c_int;
1031-
pub fn forkpty(amaster: *mut ::c_int,
1032-
name: *mut ::c_char,
1033-
termp: *const termios,
1034-
winp: *const ::winsize) -> ::pid_t;
10351025
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
10361026
pub fn getnameinfo(sa: *const ::sockaddr,
10371027
salen: ::socklen_t,
@@ -1064,8 +1054,6 @@ extern {
10641054
pub fn reboot(how_to: ::c_int) -> ::c_int;
10651055
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
10661056
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
1067-
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1068-
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
10691057

10701058
// Not available now on Android
10711059
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,

src/unix/notbsd/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,20 @@ extern {
10071007
pub fn brk(addr: *mut ::c_void) -> ::c_int;
10081008
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
10091009
pub fn vfork() -> ::pid_t;
1010+
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
1011+
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1012+
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
10101013
pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
10111014
rusage: *mut ::rusage) -> ::pid_t;
1015+
pub fn openpty(amaster: *mut ::c_int,
1016+
aslave: *mut ::c_int,
1017+
name: *mut ::c_char,
1018+
termp: *const termios,
1019+
winp: *const ::winsize) -> ::c_int;
1020+
pub fn forkpty(amaster: *mut ::c_int,
1021+
name: *mut ::c_char,
1022+
termp: *const termios,
1023+
winp: *const ::winsize) -> ::pid_t;
10121024
}
10131025

10141026
cfg_if! {

0 commit comments

Comments
 (0)