From db275132c57b3b9467af03056a0a4608f4807b90 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Mon, 9 Dec 2013 15:13:50 +0100 Subject: [PATCH] ndk: Fix wait4() declarations wait4() was incorrectly declared in , but only added to the C library in Android 4.3 (API level 18) [1] This patch: - Removes the wait4() declarations for any header before API level 19. - Brings the API level 19 which correctly declares wait4(). - Update the libc.so.functions.txt for API level 19 of all platforms to include the exported symbol. NOTE: This does not bring the static libc.a to API level 19, which means it is stuck at API level 9 for ARM. See [2] for the corresponding NDK tests. http://b.android.com/19854 [1] https://android.googlesource.com/platform/bionic/+/17a8b0db63d54e9d79bf11112ace0c4fe9606289 [2] https://android-review.googlesource.com/#/c/72000/ Change-Id: I7735473d177c44f43b09bb6738e9914945cd4d0a --- .../arch-arm/symbols/libc.so.functions.txt | 1 + .../arch-mips/symbols/libc.so.functions.txt | 1 + .../arch-x86/symbols/libc.so.functions.txt | 1 + ndk/platforms/android-19/include/sys/wait.h | 63 +++++++++++++++++++ ndk/platforms/android-3/include/sys/wait.h | 1 - ndk/platforms/android-9/include/sys/wait.h | 1 - 6 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 ndk/platforms/android-19/include/sys/wait.h diff --git a/ndk/platforms/android-19/arch-arm/symbols/libc.so.functions.txt b/ndk/platforms/android-19/arch-arm/symbols/libc.so.functions.txt index 771b4d66f..1b31038ca 100644 --- a/ndk/platforms/android-19/arch-arm/symbols/libc.so.functions.txt +++ b/ndk/platforms/android-19/arch-arm/symbols/libc.so.functions.txt @@ -1034,6 +1034,7 @@ vwarnx vwprintf wait wait3 +wait4 waitid waitpid warn diff --git a/ndk/platforms/android-19/arch-mips/symbols/libc.so.functions.txt b/ndk/platforms/android-19/arch-mips/symbols/libc.so.functions.txt index 3f3c4b315..7451547cd 100644 --- a/ndk/platforms/android-19/arch-mips/symbols/libc.so.functions.txt +++ b/ndk/platforms/android-19/arch-mips/symbols/libc.so.functions.txt @@ -900,6 +900,7 @@ vwarnx vwprintf wait wait3 +wait4 waitid waitpid warn diff --git a/ndk/platforms/android-19/arch-x86/symbols/libc.so.functions.txt b/ndk/platforms/android-19/arch-x86/symbols/libc.so.functions.txt index d2a06ff29..8fefa5f32 100644 --- a/ndk/platforms/android-19/arch-x86/symbols/libc.so.functions.txt +++ b/ndk/platforms/android-19/arch-x86/symbols/libc.so.functions.txt @@ -894,6 +894,7 @@ vwarnx vwprintf wait wait3 +wait4 waitid waitpid warn diff --git a/ndk/platforms/android-19/include/sys/wait.h b/ndk/platforms/android-19/include/sys/wait.h new file mode 100644 index 000000000..b30b7ec9e --- /dev/null +++ b/ndk/platforms/android-19/include/sys/wait.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _SYS_WAIT_H_ +#define _SYS_WAIT_H_ + +#include +#include +#include +#include +#include + +__BEGIN_DECLS + +#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) +#define WCOREDUMP(s) ((s) & 0x80) +#define WTERMSIG(s) ((s) & 0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) + +#define WIFEXITED(s) (WTERMSIG(s) == 0) +#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f) +#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2) + +extern pid_t wait(int *); +extern pid_t waitpid(pid_t, int *, int); +extern pid_t wait3(int *, int, struct rusage *); +extern pid_t wait4(pid_t, int *, int, struct rusage *); + +/* Posix states that idtype_t should be an enumeration type, but + * the kernel headers define P_ALL, P_PID and P_PGID as constant macros + * instead. + */ +typedef int idtype_t; + +extern int waitid(idtype_t which, id_t id, siginfo_t *info, int options); + +__END_DECLS + +#endif /* _SYS_WAIT_H_ */ diff --git a/ndk/platforms/android-3/include/sys/wait.h b/ndk/platforms/android-3/include/sys/wait.h index 8ba1837fe..a31b1cb37 100644 --- a/ndk/platforms/android-3/include/sys/wait.h +++ b/ndk/platforms/android-3/include/sys/wait.h @@ -47,7 +47,6 @@ __BEGIN_DECLS extern pid_t wait(int *); extern pid_t waitpid(pid_t, int *, int); extern pid_t wait3(int *, int, struct rusage *); -extern pid_t wait4(pid_t, int *, int, struct rusage *); __END_DECLS diff --git a/ndk/platforms/android-9/include/sys/wait.h b/ndk/platforms/android-9/include/sys/wait.h index b30b7ec9e..c3b89f5a1 100644 --- a/ndk/platforms/android-9/include/sys/wait.h +++ b/ndk/platforms/android-9/include/sys/wait.h @@ -48,7 +48,6 @@ __BEGIN_DECLS extern pid_t wait(int *); extern pid_t waitpid(pid_t, int *, int); extern pid_t wait3(int *, int, struct rusage *); -extern pid_t wait4(pid_t, int *, int, struct rusage *); /* Posix states that idtype_t should be an enumeration type, but * the kernel headers define P_ALL, P_PID and P_PGID as constant macros