Skip to content

Commit ab78851

Browse files
committed
Auto merge of #634 - ndusart:master, r=alexcrichton
Update NDK to r15b and add some missing symbols Use the new unified headers of the NDK and add some missing symbols for Android. Fixes #632
2 parents 8ec65a1 + 4abc3ce commit ab78851

File tree

17 files changed

+48
-34
lines changed

17 files changed

+48
-34
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/docker/x86_64-linux-android/Dockerfile

+1-1
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

+16-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,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

+3
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

+3
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

+3
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

+4-3
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
174174

175175
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
176176
pub const EPOLLONESHOT: ::c_int = 0x40000000;
177+
pub const EPOLLRDHUP: ::c_int = 0x00002000;
178+
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
177179

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

@@ -471,7 +473,7 @@ pub const SOL_NETROM: ::c_int = 259;
471473
pub const SOL_ROSE: ::c_int = 260;
472474

473475
#[doc(hidden)]
474-
pub const AF_MAX: ::c_int = 39;
476+
pub const AF_MAX: ::c_int = 43;
475477
#[doc(hidden)]
476478
pub const PF_MAX: ::c_int = AF_MAX;
477479

@@ -504,6 +506,7 @@ pub const O_NONBLOCK: ::c_int = 2048;
504506
pub const O_SYNC: ::c_int = 0x101000;
505507
pub const O_ASYNC: ::c_int = 0x2000;
506508
pub const O_NDELAY: ::c_int = 0x800;
509+
pub const O_DSYNC: ::c_int = 4096;
507510

508511
pub const NI_MAXHOST: ::size_t = 1025;
509512

@@ -631,8 +634,6 @@ pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
631634
pub const MCL_CURRENT: ::c_int = 0x0001;
632635
pub const MCL_FUTURE: ::c_int = 0x0002;
633636

634-
pub const SIGSTKSZ: ::size_t = 8192;
635-
pub const MINSIGSTKSZ: ::size_t = 2048;
636637
pub const CBAUD: ::tcflag_t = 0o0010017;
637638
pub const TAB1: ::c_int = 0x00000800;
638639
pub const TAB2: ::c_int = 0x00001000;

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

-2
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

-12
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,6 @@ extern {
10921092
timeout: ::c_int,
10931093
sigmask: *const ::sigset_t) -> ::c_int;
10941094
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
1095-
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
10961095
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
10971096
pub fn mkostemps(template: *mut ::c_char,
10981097
suffixlen: ::c_int,
@@ -1102,15 +1101,6 @@ extern {
11021101
timeout: *const ::timespec) -> ::c_int;
11031102
pub fn sigwaitinfo(set: *const sigset_t,
11041103
info: *mut siginfo_t) -> ::c_int;
1105-
pub fn openpty(amaster: *mut ::c_int,
1106-
aslave: *mut ::c_int,
1107-
name: *mut ::c_char,
1108-
termp: *const termios,
1109-
winp: *const ::winsize) -> ::c_int;
1110-
pub fn forkpty(amaster: *mut ::c_int,
1111-
name: *mut ::c_char,
1112-
termp: *const termios,
1113-
winp: *const ::winsize) -> ::pid_t;
11141104
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
11151105
pub fn getnameinfo(sa: *const ::sockaddr,
11161106
salen: ::socklen_t,
@@ -1143,8 +1133,6 @@ extern {
11431133
pub fn reboot(how_to: ::c_int) -> ::c_int;
11441134
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
11451135
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
1146-
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1147-
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
11481136

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

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

-2
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

-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ pub const TIOCMBIS: ::c_ulong = 0x5416;
235235
pub const TIOCMBIC: ::c_ulong = 0x5417;
236236
pub const TIOCMSET: ::c_ulong = 0x5418;
237237
pub const TIOCCONS: ::c_ulong = 0x541D;
238-
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
239238

240239
pub const SFD_CLOEXEC: ::c_int = 0x080000;
241240

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

-2
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

-2
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

-2
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

-2
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

+13
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ pub const CLONE_NEWUSER: ::c_int = 0x10000000;
708708
pub const CLONE_NEWPID: ::c_int = 0x20000000;
709709
pub const CLONE_NEWNET: ::c_int = 0x40000000;
710710
pub const CLONE_IO: ::c_int = 0x80000000;
711+
pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
711712

712713
pub const WNOHANG: ::c_int = 0x00000001;
713714
pub const WUNTRACED: ::c_int = 0x00000002;
@@ -1016,8 +1017,20 @@ extern {
10161017
pub fn brk(addr: *mut ::c_void) -> ::c_int;
10171018
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
10181019
pub fn vfork() -> ::pid_t;
1020+
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
1021+
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
1022+
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
10191023
pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
10201024
rusage: *mut ::rusage) -> ::pid_t;
1025+
pub fn openpty(amaster: *mut ::c_int,
1026+
aslave: *mut ::c_int,
1027+
name: *mut ::c_char,
1028+
termp: *const termios,
1029+
winp: *const ::winsize) -> ::c_int;
1030+
pub fn forkpty(amaster: *mut ::c_int,
1031+
name: *mut ::c_char,
1032+
termp: *const termios,
1033+
winp: *const ::winsize) -> ::pid_t;
10211034
}
10221035

10231036
cfg_if! {

0 commit comments

Comments
 (0)