Skip to content

Commit 4abc3ce

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

File tree

17 files changed

+48
-34
lines changed

17 files changed

+48
-34
lines changed

ci/android-install-ndk.sh

Lines changed: 5 additions & 4 deletions
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/docker/x86_64-linux-android/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
1717
# We do not run x86_64-linux-android tests on an android emulator.
1818
# See ci/android-sysimage.sh for informations about how tests are run.
1919
COPY android-sysimage.sh /android/
20-
RUN bash /android/android-sysimage.sh x86_64 x86_64-21_r04.zip
20+
RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
2121

2222
ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \
2323
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \

ci/run-docker.sh

100644100755
File mode changed.

libc-test/build.rs

Lines changed: 16 additions & 1 deletion
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,16 @@ 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+
// In Android 64 bits, these functions have been fixed since unified headers.
549+
// Ignore these until next major version.
550+
"bind" | "writev" | "readv" | "sendmsg" | "recvmsg" if android && (aarch64 || x86_64) => true,
551+
537552
_ => false,
538553
}
539554
});

src/unix/notbsd/android/b32/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ pub const UT_LINESIZE: usize = 8;
166166
pub const UT_NAMESIZE: usize = 8;
167167
pub const UT_HOSTSIZE: usize = 16;
168168

169+
pub const SIGSTKSZ: ::size_t = 8192;
170+
pub const MINSIGSTKSZ: ::size_t = 2048;
171+
169172
extern {
170173
pub fn bind(socket: ::c_int, address: *const ::sockaddr,
171174
address_len: socklen_t) -> ::c_int;

src/unix/notbsd/android/b64/aarch64.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ pub const O_DIRECTORY: ::c_int = 0x4000;
5454
pub const O_NOFOLLOW: ::c_int = 0x8000;
5555

5656
pub const SYS_gettid: ::c_long = 178;
57+
58+
pub const SIGSTKSZ: ::size_t = 16384;
59+
pub const MINSIGSTKSZ: ::size_t = 5120;

src/unix/notbsd/android/b64/x86_64.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ pub const O_DIRECTORY: ::c_int = 0x10000;
4848
pub const O_NOFOLLOW: ::c_int = 0x20000;
4949

5050
pub const SYS_gettid: ::c_long = 186;
51+
52+
pub const SIGSTKSZ: ::size_t = 8192;
53+
pub const MINSIGSTKSZ: ::size_t = 2048;

src/unix/notbsd/android/mod.rs

Lines changed: 4 additions & 3 deletions
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

@@ -585,8 +588,6 @@ pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
585588
pub const MCL_CURRENT: ::c_int = 0x0001;
586589
pub const MCL_FUTURE: ::c_int = 0x0002;
587590

588-
pub const SIGSTKSZ: ::size_t = 8192;
589-
pub const MINSIGSTKSZ: ::size_t = 2048;
590591
pub const CBAUD: ::tcflag_t = 0o0010017;
591592
pub const TAB1: ::c_int = 0x00000800;
592593
pub const TAB2: ::c_int = 0x00001000;

src/unix/notbsd/linux/mips/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ s! {
2727
}
2828
}
2929

30-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
31-
3230
pub const SFD_CLOEXEC: ::c_int = 0x080000;
3331

3432
pub const NCCS: usize = 32;

src/unix/notbsd/linux/mod.rs

Lines changed: 0 additions & 12 deletions
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/linux/musl/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ s! {
8787
}
8888
}
8989

90-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
91-
9290
pub const SFD_CLOEXEC: ::c_int = 0x080000;
9391

9492
pub const NCCS: usize = 32;

src/unix/notbsd/linux/other/b32/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ pub const TIOCMBIS: ::c_ulong = 0x5416;
225225
pub const TIOCMBIC: ::c_ulong = 0x5417;
226226
pub const TIOCMSET: ::c_ulong = 0x5418;
227227
pub const TIOCCONS: ::c_ulong = 0x541D;
228-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
229228

230229
pub const SFD_CLOEXEC: ::c_int = 0x080000;
231230

src/unix/notbsd/linux/other/b64/aarch64.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417;
288288
pub const TIOCMSET: ::c_ulong = 0x5418;
289289
pub const TIOCCONS: ::c_ulong = 0x541D;
290290

291-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
292-
293291
pub const SFD_CLOEXEC: ::c_int = 0x080000;
294292

295293
pub const NCCS: usize = 32;

src/unix/notbsd/linux/other/b64/powerpc64.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417;
286286
pub const TIOCMSET: ::c_ulong = 0x5418;
287287
pub const TIOCCONS: ::c_ulong = 0x541D;
288288

289-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
290-
291289
pub const SFD_CLOEXEC: ::c_int = 0x080000;
292290

293291
pub const NCCS: usize = 32;

src/unix/notbsd/linux/other/b64/x86_64.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417;
389389
pub const TIOCMSET: ::c_ulong = 0x5418;
390390
pub const TIOCCONS: ::c_ulong = 0x541D;
391391

392-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
393-
394392
pub const SFD_CLOEXEC: ::c_int = 0x080000;
395393

396394
pub const NCCS: usize = 32;

src/unix/notbsd/linux/s390x.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ s! {
273273
}
274274
}
275275

276-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
277-
278276
pub const SFD_CLOEXEC: ::c_int = 0x080000;
279277

280278
pub const NCCS: usize = 32;

src/unix/notbsd/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ pub const CLONE_NEWUSER: ::c_int = 0x10000000;
703703
pub const CLONE_NEWPID: ::c_int = 0x20000000;
704704
pub const CLONE_NEWNET: ::c_int = 0x40000000;
705705
pub const CLONE_IO: ::c_int = 0x80000000;
706+
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
706707

707708
pub const WNOHANG: ::c_int = 0x00000001;
708709
pub const WUNTRACED: ::c_int = 0x00000002;
@@ -1007,8 +1008,20 @@ extern {
10071008
pub fn brk(addr: *mut ::c_void) -> ::c_int;
10081009
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
10091010
pub fn vfork() -> ::pid_t;
1011+
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
1012+
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1013+
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
10101014
pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
10111015
rusage: *mut ::rusage) -> ::pid_t;
1016+
pub fn openpty(amaster: *mut ::c_int,
1017+
aslave: *mut ::c_int,
1018+
name: *mut ::c_char,
1019+
termp: *const termios,
1020+
winp: *const ::winsize) -> ::c_int;
1021+
pub fn forkpty(amaster: *mut ::c_int,
1022+
name: *mut ::c_char,
1023+
termp: *const termios,
1024+
winp: *const ::winsize) -> ::pid_t;
10121025
}
10131026

10141027
cfg_if! {

0 commit comments

Comments
 (0)