Test POSIX 1003.1 2016 chapter 13 "Headers".
And fix one thing that this found: apparently <stdlib.h> should also
make the various *WAIT* macros available.
Bug: N/A
Test: builds
Change-Id: Id879bf3c1bddd1170261a809e7280150a74d6b3d
diff --git a/tests/Android.bp b/tests/Android.bp
index 28df084..7f69cb1 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -645,4 +645,4 @@
},
}
-subdirs = ["libs"]
+subdirs = ["*"]
diff --git a/tests/headers/Android.bp b/tests/headers/Android.bp
new file mode 100644
index 0000000..b44c296
--- /dev/null
+++ b/tests/headers/Android.bp
@@ -0,0 +1 @@
+subdirs = ["*"]
diff --git a/tests/headers/posix/Android.bp b/tests/headers/posix/Android.bp
new file mode 100644
index 0000000..624d981
--- /dev/null
+++ b/tests/headers/posix/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "libbionic_tests_headers_posix",
+ srcs: ["*.c"],
+ cflags: [
+ "-Wno-absolute-value", // broken clang diagnostic that doesn't understand <tgmath.h>
+ "-Wno-deprecated",
+ "-Werror",
+ "-D_POSIX_C_SOURCE=200809L",
+ "-D_XOPEN_SOURCE=700",
+ ],
+ host_supported: true,
+}
diff --git a/tests/headers/posix/arpa_inet_h.c b/tests/headers/posix/arpa_inet_h.c
new file mode 100644
index 0000000..51df1c7
--- /dev/null
+++ b/tests/headers/posix/arpa_inet_h.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <arpa/inet.h>
+
+#include "header_checks.h"
+
+static void arpa_inet_h() {
+ TYPE(in_port_t);
+ TYPE(in_addr_t);
+ TYPE(struct in_addr);
+
+ MACRO(INET_ADDRSTRLEN);
+ MACRO(INET6_ADDRSTRLEN);
+
+ FUNCTION(htonl, uint32_t (*f)(uint32_t));
+ FUNCTION(htons, uint16_t (*f)(uint16_t));
+ FUNCTION(ntohl, uint32_t (*f)(uint32_t));
+ FUNCTION(ntohs, uint16_t (*f)(uint16_t));
+
+ TYPE(uint32_t);
+ TYPE(uint16_t);
+
+ FUNCTION(inet_addr, in_addr_t (*f)(const char*));
+}
diff --git a/tests/headers/posix/assert_h.c b/tests/headers/posix/assert_h.c
new file mode 100644
index 0000000..81c577a
--- /dev/null
+++ b/tests/headers/posix/assert_h.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#undef NDEBUG
+
+#define NDEBUG
+#include <assert.h>
+#if !defined(assert)
+#error
+#endif
+
+#undef NDEBUG
+#include <assert.h>
+#if !defined(assert)
+#error
+#endif
diff --git a/tests/headers/posix/complex_h.c b/tests/headers/posix/complex_h.c
new file mode 100644
index 0000000..5003139
--- /dev/null
+++ b/tests/headers/posix/complex_h.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <complex.h>
+
+#include "header_checks.h"
+
+#if !defined(complex)
+#error complex
+#endif
+#if !defined(_Complex_I)
+#error _Complex_I
+#endif
+
+#if 0 // No libc actually implements this.
+#if !defined(imaginary)
+#error imaginary
+#endif
+#if !defined(_Imaginary_I)
+#error _Imaginary_I
+#endif
+#endif
+
+#if !defined(I)
+#error I
+#endif
+
+static void complex_h() {
+ FUNCTION(cabs, double (*f)(double complex));
+ FUNCTION(cabsf, float (*f)(float complex));
+ FUNCTION(cabsl, long double (*f)(long double complex));
+
+ FUNCTION(cacos, double complex (*f)(double complex));
+ FUNCTION(cacosf, float complex (*f)(float complex));
+ FUNCTION(cacosl, long double complex (*f)(long double complex));
+
+ FUNCTION(cacosh, double complex (*f)(double complex));
+ FUNCTION(cacoshf, float complex (*f)(float complex));
+ FUNCTION(cacoshl, long double complex (*f)(long double complex));
+
+ FUNCTION(carg, double (*f)(double complex));
+ FUNCTION(cargf, float (*f)(float complex));
+ FUNCTION(cargl, long double (*f)(long double complex));
+
+ FUNCTION(casin, double complex (*f)(double complex));
+ FUNCTION(casinf, float complex (*f)(float complex));
+ FUNCTION(casinl, long double complex (*f)(long double complex));
+
+ FUNCTION(casinh, double complex (*f)(double complex));
+ FUNCTION(casinhf, float complex (*f)(float complex));
+ FUNCTION(casinhl, long double complex (*f)(long double complex));
+
+ FUNCTION(catan, double complex (*f)(double complex));
+ FUNCTION(catanf, float complex (*f)(float complex));
+ FUNCTION(catanl, long double complex (*f)(long double complex));
+
+ FUNCTION(catanh, double complex (*f)(double complex));
+ FUNCTION(catanhf, float complex (*f)(float complex));
+ FUNCTION(catanhl, long double complex (*f)(long double complex));
+
+ FUNCTION(ccos, double complex (*f)(double complex));
+ FUNCTION(ccosf, float complex (*f)(float complex));
+ FUNCTION(ccosl, long double complex (*f)(long double complex));
+
+ FUNCTION(ccosh, double complex (*f)(double complex));
+ FUNCTION(ccoshf, float complex (*f)(float complex));
+ FUNCTION(ccoshl, long double complex (*f)(long double complex));
+
+ FUNCTION(cexp, double complex (*f)(double complex));
+ FUNCTION(cexpf, float complex (*f)(float complex));
+ FUNCTION(cexpl, long double complex (*f)(long double complex));
+
+ FUNCTION(cimag, double (*f)(double complex));
+ FUNCTION(cimagf, float (*f)(float complex));
+ FUNCTION(cimagl, long double (*f)(long double complex));
+
+ FUNCTION(clog, double complex (*f)(double complex));
+ FUNCTION(clogf, float complex (*f)(float complex));
+ FUNCTION(clogl, long double complex (*f)(long double complex));
+
+ FUNCTION(conj, double complex (*f)(double complex));
+ FUNCTION(conjf, float complex (*f)(float complex));
+ FUNCTION(conjl, long double complex (*f)(long double complex));
+
+ FUNCTION(cpow, double complex (*f)(double complex, double complex));
+ FUNCTION(cpowf, float complex (*f)(float complex, float complex));
+ FUNCTION(cpowl, long double complex (*f)(long double complex, long double complex));
+
+ FUNCTION(cproj, double complex (*f)(double complex));
+ FUNCTION(cprojf, float complex (*f)(float complex));
+ FUNCTION(cprojl, long double complex (*f)(long double complex));
+
+ FUNCTION(creal, double (*f)(double complex));
+ FUNCTION(crealf, float (*f)(float complex));
+ FUNCTION(creall, long double (*f)(long double complex));
+
+ FUNCTION(csin, double complex (*f)(double complex));
+ FUNCTION(csinf, float complex (*f)(float complex));
+ FUNCTION(csinl, long double complex (*f)(long double complex));
+
+ FUNCTION(csinh, double complex (*f)(double complex));
+ FUNCTION(csinhf, float complex (*f)(float complex));
+ FUNCTION(csinhl, long double complex (*f)(long double complex));
+
+ FUNCTION(csqrt, double complex (*f)(double complex));
+ FUNCTION(csqrtf, float complex (*f)(float complex));
+ FUNCTION(csqrtl, long double complex (*f)(long double complex));
+
+ FUNCTION(ctan, double complex (*f)(double complex));
+ FUNCTION(ctanf, float complex (*f)(float complex));
+ FUNCTION(ctanl, long double complex (*f)(long double complex));
+
+ FUNCTION(ctanh, double complex (*f)(double complex));
+ FUNCTION(ctanhf, float complex (*f)(float complex));
+ FUNCTION(ctanhl, long double complex (*f)(long double complex));
+}
diff --git a/tests/headers/posix/cpio_h.c b/tests/headers/posix/cpio_h.c
new file mode 100644
index 0000000..0dd2407
--- /dev/null
+++ b/tests/headers/posix/cpio_h.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <cpio.h>
+
+#include "header_checks.h"
+
+static void cpio_h() {
+ MACRO_VALUE(C_IRUSR, 0400);
+ MACRO_VALUE(C_IWUSR, 0200);
+ MACRO_VALUE(C_IXUSR, 0100);
+
+ MACRO_VALUE(C_IRGRP, 040);
+ MACRO_VALUE(C_IWGRP, 020);
+ MACRO_VALUE(C_IXGRP, 010);
+
+ MACRO_VALUE(C_IROTH, 04);
+ MACRO_VALUE(C_IWOTH, 02);
+ MACRO_VALUE(C_IXOTH, 01);
+
+ MACRO_VALUE(C_ISUID, 04000);
+ MACRO_VALUE(C_ISGID, 02000);
+ MACRO_VALUE(C_ISVTX, 01000);
+
+ MACRO_VALUE(C_ISDIR, 040000);
+ MACRO_VALUE(C_ISFIFO, 010000);
+ MACRO_VALUE(C_ISREG, 0100000);
+ MACRO_VALUE(C_ISBLK, 060000);
+ MACRO_VALUE(C_ISCHR, 020000);
+
+ MACRO_VALUE(C_ISCTG, 0110000);
+ MACRO_VALUE(C_ISLNK, 0120000);
+ MACRO_VALUE(C_ISSOCK, 0140000);
+
+#if !defined(MAGIC)
+#error MAGIC
+#endif
+}
diff --git a/tests/headers/posix/ctype_h.c b/tests/headers/posix/ctype_h.c
new file mode 100644
index 0000000..c901284
--- /dev/null
+++ b/tests/headers/posix/ctype_h.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <ctype.h>
+
+#include "header_checks.h"
+
+static void ctype_h() {
+ FUNCTION(isalnum, int (*f)(int));
+ FUNCTION(isalnum_l, int (*f)(int, locale_t));
+ FUNCTION(isalpha, int (*f)(int));
+ FUNCTION(isalpha_l, int (*f)(int, locale_t));
+ FUNCTION(isascii, int (*f)(int));
+ FUNCTION(isblank, int (*f)(int));
+ FUNCTION(isblank_l, int (*f)(int, locale_t));
+ FUNCTION(iscntrl, int (*f)(int));
+ FUNCTION(iscntrl_l, int (*f)(int, locale_t));
+ FUNCTION(isdigit, int (*f)(int));
+ FUNCTION(isdigit_l, int (*f)(int, locale_t));
+ FUNCTION(isgraph, int (*f)(int));
+ FUNCTION(isgraph_l, int (*f)(int, locale_t));
+ FUNCTION(islower, int (*f)(int));
+ FUNCTION(islower_l, int (*f)(int, locale_t));
+ FUNCTION(isprint, int (*f)(int));
+ FUNCTION(isprint_l, int (*f)(int, locale_t));
+ FUNCTION(ispunct, int (*f)(int));
+ FUNCTION(ispunct_l, int (*f)(int, locale_t));
+ FUNCTION(isspace, int (*f)(int));
+ FUNCTION(isspace_l, int (*f)(int, locale_t));
+ FUNCTION(isupper, int (*f)(int));
+ FUNCTION(isupper_l, int (*f)(int, locale_t));
+ FUNCTION(isxdigit, int (*f)(int));
+ FUNCTION(isxdigit_l, int (*f)(int, locale_t));
+
+ FUNCTION(toascii, int (*f)(int));
+ FUNCTION(tolower, int (*f)(int));
+ FUNCTION(tolower_l, int (*f)(int, locale_t));
+ FUNCTION(toupper, int (*f)(int));
+ FUNCTION(toupper_l, int (*f)(int, locale_t));
+
+#if !defined(__BIONIC__) // These are marked obsolescent.
+ #if !defined(_toupper)
+ #error _toupper
+ #endif
+ #if !defined(_tolower)
+ #error _tolower
+ #endif
+#endif
+}
diff --git a/tests/headers/posix/dirent_h.c b/tests/headers/posix/dirent_h.c
new file mode 100644
index 0000000..6c61c8d
--- /dev/null
+++ b/tests/headers/posix/dirent_h.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <dirent.h>
+
+#include "header_checks.h"
+
+static void dirent_h() {
+ INCOMPLETE_TYPE(DIR);
+
+ TYPE(struct dirent);
+#if defined(__BIONIC__) && !defined(__LP64__)
+ STRUCT_MEMBER(struct dirent, uint64_t, d_ino); // Historical ABI accident.
+#else
+ STRUCT_MEMBER(struct dirent, ino_t, d_ino);
+#endif
+ STRUCT_MEMBER_ARRAY(struct dirent, char/*[]*/, d_name);
+
+ TYPE(ino_t);
+
+ FUNCTION(alphasort, int (*f)(const struct dirent**, const struct dirent**));
+ FUNCTION(closedir, int (*f)(DIR*));
+ FUNCTION(dirfd, int (*f)(DIR*));
+ FUNCTION(fdopendir, DIR* (*f)(int));
+ FUNCTION(opendir, DIR* (*f)(const char*));
+ FUNCTION(readdir, struct dirent* (*f)(DIR*));
+ FUNCTION(readdir_r, int (*f)(DIR*, struct dirent*, struct dirent**));
+ FUNCTION(rewinddir, void (*f)(DIR*));
+ FUNCTION(scandir, int (*f)(const char*, struct dirent***,
+ int (*)(const struct dirent*),
+ int (*)(const struct dirent**, const struct dirent**)));
+ FUNCTION(seekdir, void (*f)(DIR*, long));
+ FUNCTION(telldir, long (*f)(DIR*));
+}
diff --git a/tests/headers/posix/dlfcn_h.c b/tests/headers/posix/dlfcn_h.c
new file mode 100644
index 0000000..4800075
--- /dev/null
+++ b/tests/headers/posix/dlfcn_h.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <dlfcn.h>
+
+#include "header_checks.h"
+
+static void dlfcn_h() {
+ MACRO(RTLD_LAZY);
+ MACRO(RTLD_NOW);
+ MACRO(RTLD_GLOBAL);
+ MACRO(RTLD_LOCAL);
+
+ FUNCTION(dlclose, int (*f)(void*));
+ FUNCTION(dlerror, char* (*f)(void));
+ FUNCTION(dlopen, void* (*f)(const char*, int));
+ FUNCTION(dlsym, void* (*f)(void*, const char*));
+}
diff --git a/tests/headers/posix/errno_h.c b/tests/headers/posix/errno_h.c
new file mode 100644
index 0000000..9eabfd5
--- /dev/null
+++ b/tests/headers/posix/errno_h.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <errno.h>
+
+#include "header_checks.h"
+
+static void errno_h() {
+ int error = errno;
+
+ MACRO(E2BIG);
+ MACRO(EACCES);
+ MACRO(EADDRINUSE);
+ MACRO(EADDRNOTAVAIL);
+ MACRO(EAFNOSUPPORT);
+ MACRO(EAGAIN);
+ MACRO(EALREADY);
+ MACRO(EBADF);
+ MACRO(EBADMSG);
+ MACRO(EBUSY);
+ MACRO(ECANCELED);
+ MACRO(ECHILD);
+ MACRO(ECONNABORTED);
+ MACRO(ECONNRESET);
+ MACRO(EDEADLK);
+ MACRO(EDESTADDRREQ);
+ MACRO(EDOM);
+ MACRO(EDQUOT);
+ MACRO(EEXIST);
+ MACRO(EFAULT);
+ MACRO(EFBIG);
+ MACRO(EHOSTUNREACH);
+ MACRO(EIDRM);
+ MACRO(EILSEQ);
+ MACRO(EINPROGRESS);
+ MACRO(EINTR);
+ MACRO(EINVAL);
+ MACRO(EIO);
+ MACRO(EISCONN);
+ MACRO(EISDIR);
+ MACRO(ELOOP);
+ MACRO(EMFILE);
+ MACRO(EMLINK);
+ MACRO(EMSGSIZE);
+ MACRO(EMULTIHOP);
+ MACRO(ENAMETOOLONG);
+ MACRO(ENETDOWN);
+ MACRO(ENETRESET);
+ MACRO(ENETUNREACH);
+ MACRO(ENFILE);
+ MACRO(ENOBUFS);
+ MACRO(ENODATA);
+ MACRO(ENODEV);
+ MACRO(ENOENT);
+ MACRO(ENOEXEC);
+ MACRO(ENOLCK);
+ MACRO(ENOLINK);
+ MACRO(ENOMEM);
+ MACRO(ENOMSG);
+ MACRO(ENOPROTOOPT);
+ MACRO(ENOSPC);
+ MACRO(ENOSR);
+ MACRO(ENOSTR);
+ MACRO(ENOSYS);
+ MACRO(ENOTCONN);
+ MACRO(ENOTDIR);
+ MACRO(ENOTEMPTY);
+ MACRO(ENOTRECOVERABLE);
+ MACRO(ENOTSOCK);
+ MACRO(ENOTSUP);
+ MACRO(ENOTTY);
+ MACRO(ENXIO);
+ MACRO(EOPNOTSUPP);
+ MACRO(EOVERFLOW);
+ MACRO(EOWNERDEAD);
+ MACRO(EPERM);
+ MACRO(EPIPE);
+ MACRO(EPROTO);
+ MACRO(EPROTONOSUPPORT);
+ MACRO(EPROTOTYPE);
+ MACRO(ERANGE);
+ MACRO(EROFS);
+ MACRO(ESPIPE);
+ MACRO(ESRCH);
+ MACRO(ESTALE);
+ MACRO(ETIME);
+ MACRO(ETIMEDOUT);
+ MACRO(ETXTBSY);
+ MACRO(EWOULDBLOCK);
+ MACRO(EXDEV);
+}
diff --git a/tests/headers/posix/fcntl_h.c b/tests/headers/posix/fcntl_h.c
new file mode 100644
index 0000000..a55fe89
--- /dev/null
+++ b/tests/headers/posix/fcntl_h.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <fcntl.h>
+
+#include "header_checks.h"
+
+static void fcntl_h() {
+ MACRO(F_DUPFD);
+ MACRO(F_DUPFD_CLOEXEC);
+ MACRO(F_GETFD);
+ MACRO(F_SETFD);
+ MACRO(F_GETFL);
+ MACRO(F_SETFL);
+ MACRO(F_GETLK);
+ MACRO(F_SETLK);
+ MACRO(F_SETLKW);
+ MACRO(F_GETOWN);
+ MACRO(F_SETOWN);
+
+ MACRO(FD_CLOEXEC);
+
+ MACRO(F_RDLCK);
+ MACRO(F_UNLCK);
+ MACRO(F_WRLCK);
+
+ MACRO(SEEK_SET);
+ MACRO(SEEK_CUR);
+ MACRO(SEEK_END);
+
+ MACRO(O_CLOEXEC);
+ MACRO(O_CREAT);
+ MACRO(O_DIRECTORY);
+ MACRO(O_EXCL);
+ MACRO(O_NOCTTY);
+ MACRO(O_NOFOLLOW);
+ MACRO(O_TRUNC);
+#if !defined(__linux__)
+ MACRO(O_TTY_INIT);
+#endif
+
+ MACRO(O_APPEND);
+ MACRO(O_DSYNC);
+ MACRO(O_NONBLOCK);
+ MACRO(O_RSYNC);
+ MACRO(O_SYNC);
+
+ MACRO(O_ACCMODE);
+
+#if !defined(__linux__)
+ MACRO(O_EXEC);
+#endif
+ MACRO(O_RDONLY);
+ MACRO(O_RDWR);
+#if !defined(__linux__)
+ MACRO(O_SEARCH);
+#endif
+ MACRO(O_WRONLY);
+
+ // POSIX: "The <fcntl.h> header shall define the symbolic constants for
+ // file modes for use as values of mode_t as described in <sys/stat.h>."
+#include "sys_stat_h_mode_constants.h"
+
+ MACRO(AT_FDCWD);
+#if !defined(__BIONIC__) // See comment in "faccessat.cpp".
+ MACRO(AT_EACCESS);
+#endif
+ MACRO(AT_SYMLINK_NOFOLLOW);
+ MACRO(AT_REMOVEDIR);
+
+ MACRO(POSIX_FADV_DONTNEED);
+ MACRO(POSIX_FADV_NOREUSE);
+ MACRO(POSIX_FADV_NORMAL);
+ MACRO(POSIX_FADV_RANDOM);
+ MACRO(POSIX_FADV_SEQUENTIAL);
+ MACRO(POSIX_FADV_WILLNEED);
+
+ TYPE(struct flock);
+ STRUCT_MEMBER(struct flock, short, l_type);
+ STRUCT_MEMBER(struct flock, short, l_whence);
+ STRUCT_MEMBER(struct flock, off_t, l_start);
+ STRUCT_MEMBER(struct flock, off_t, l_len);
+ STRUCT_MEMBER(struct flock, pid_t, l_pid);
+
+ TYPE(mode_t);
+ TYPE(off_t);
+ TYPE(pid_t);
+
+ FUNCTION(creat, int (*f)(const char*, mode_t));
+ FUNCTION(fcntl, int (*f)(int, int, ...));
+ FUNCTION(open, int (*f)(const char*, int, ...));
+ FUNCTION(openat, int (*f)(int, const char*, int, ...));
+ FUNCTION(posix_fadvise, int (*f)(int, off_t, off_t, int));
+ FUNCTION(posix_fallocate, int (*f)(int, off_t, off_t));
+}
diff --git a/tests/headers/posix/fenv_h.c b/tests/headers/posix/fenv_h.c
new file mode 100644
index 0000000..cabe4ae
--- /dev/null
+++ b/tests/headers/posix/fenv_h.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <fenv.h>
+
+#include "header_checks.h"
+
+static void fenv_h() {
+ TYPE(fenv_t);
+ TYPE(fexcept_t);
+
+ MACRO(FE_DIVBYZERO);
+ MACRO(FE_INEXACT);
+ MACRO(FE_INVALID);
+ MACRO(FE_OVERFLOW);
+ MACRO(FE_UNDERFLOW);
+
+ MACRO(FE_ALL_EXCEPT);
+
+ MACRO(FE_DOWNWARD);
+ MACRO(FE_TONEAREST);
+ MACRO(FE_TOWARDZERO);
+ MACRO(FE_UPWARD);
+
+ const fenv_t* fe_dfl_env = FE_DFL_ENV;
+
+ FUNCTION(feclearexcept, int (*f)(int));
+ FUNCTION(fegetenv, int (*f)(fenv_t*));
+ FUNCTION(fegetexceptflag, int (*f)(fexcept_t*, int));
+ FUNCTION(fegetround, int (*f)(void));
+ FUNCTION(feholdexcept, int (*f)(fenv_t*));
+ FUNCTION(feraiseexcept, int (*f)(int));
+ FUNCTION(fesetenv, int (*f)(const fenv_t*));
+ FUNCTION(fesetexceptflag, int (*f)(const fexcept_t*, int));
+ FUNCTION(fesetround, int (*f)(int));
+ FUNCTION(fetestexcept, int (*f)(int));
+ FUNCTION(feupdateenv, int (*f)(const fenv_t*));
+}
diff --git a/tests/headers/posix/float_h.c b/tests/headers/posix/float_h.c
new file mode 100644
index 0000000..5f12fa2
--- /dev/null
+++ b/tests/headers/posix/float_h.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <float.h>
+
+#include "header_checks.h"
+
+static void float_h() {
+ int flt_rounds = FLT_ROUNDS;
+
+ MACRO(FLT_EVAL_METHOD);
+
+ MACRO(FLT_RADIX);
+ MACRO(FLT_MANT_DIG);
+ MACRO(DBL_MANT_DIG);
+ MACRO(LDBL_MANT_DIG);
+ MACRO(DECIMAL_DIG);
+ MACRO(FLT_DIG);
+ MACRO(DBL_DIG);
+ MACRO(LDBL_DIG);
+ MACRO(FLT_MIN_EXP);
+ MACRO(DBL_MIN_EXP);
+ MACRO(LDBL_MIN_EXP);
+ MACRO(FLT_MIN_10_EXP);
+ MACRO(DBL_MIN_10_EXP);
+ MACRO(LDBL_MIN_10_EXP);
+ MACRO(FLT_MAX_EXP);
+ MACRO(DBL_MAX_EXP);
+ MACRO(LDBL_MAX_EXP);
+ MACRO(FLT_MAX_10_EXP);
+ MACRO(DBL_MAX_10_EXP);
+ MACRO(LDBL_MAX_10_EXP);
+ MACRO(FLT_MAX);
+ MACRO(DBL_MAX);
+ MACRO(LDBL_MAX);
+ MACRO(FLT_EPSILON);
+ MACRO(DBL_EPSILON);
+ MACRO(LDBL_EPSILON);
+ MACRO(FLT_MIN);
+ MACRO(DBL_MIN);
+ MACRO(LDBL_MIN);
+}
diff --git a/tests/headers/posix/fnmatch_h.c b/tests/headers/posix/fnmatch_h.c
new file mode 100644
index 0000000..3dd41d7
--- /dev/null
+++ b/tests/headers/posix/fnmatch_h.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <fnmatch.h>
+
+#include "header_checks.h"
+
+static void fnmatch_h() {
+ MACRO(FNM_NOMATCH);
+ MACRO(FNM_PATHNAME);
+ MACRO(FNM_PERIOD);
+ MACRO(FNM_NOESCAPE);
+
+ FUNCTION(fnmatch, int (*f)(const char*, const char*, int));
+}
diff --git a/tests/headers/posix/ftw_h.c b/tests/headers/posix/ftw_h.c
new file mode 100644
index 0000000..0a78d94
--- /dev/null
+++ b/tests/headers/posix/ftw_h.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <ftw.h>
+
+#include "header_checks.h"
+
+static void ftw_h() {
+ TYPE(struct FTW);
+ STRUCT_MEMBER(struct FTW, int, base);
+ STRUCT_MEMBER(struct FTW, int, level);
+
+ MACRO(FTW_F);
+ MACRO(FTW_D);
+ MACRO(FTW_DNR);
+ MACRO(FTW_DP);
+ MACRO(FTW_NS);
+ MACRO(FTW_SL);
+ MACRO(FTW_SLN);
+
+ MACRO(FTW_PHYS);
+ MACRO(FTW_MOUNT);
+ MACRO(FTW_DEPTH);
+ MACRO(FTW_CHDIR);
+
+ FUNCTION(ftw, int (*f)(const char*, int (*)(const char*, const struct stat*, int), int));
+
+ TYPE(struct stat);
+
+ // POSIX: "The <ftw.h> header shall define the ... the symbolic names for
+ // st_mode and the file type test macros as described in <sys/stat.h>."
+#include "sys_stat_h_mode_constants.h"
+#include "sys_stat_h_file_type_test_macros.h"
+}
diff --git a/tests/headers/posix/glob_h.c b/tests/headers/posix/glob_h.c
new file mode 100644
index 0000000..b399e52
--- /dev/null
+++ b/tests/headers/posix/glob_h.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <glob.h>
+
+#include "header_checks.h"
+
+static void glob_h() {
+ TYPE(glob_t);
+ STRUCT_MEMBER(glob_t, size_t, gl_pathc);
+ STRUCT_MEMBER(glob_t, char**, gl_pathv);
+ STRUCT_MEMBER(glob_t, size_t, gl_offs);
+ TYPE(size_t);
+
+ MACRO(GLOB_APPEND);
+ MACRO(GLOB_DOOFFS);
+ MACRO(GLOB_ERR);
+ MACRO(GLOB_MARK);
+ MACRO(GLOB_NOCHECK);
+ MACRO(GLOB_NOESCAPE);
+ MACRO(GLOB_NOSORT);
+
+ MACRO(GLOB_ABORTED);
+ MACRO(GLOB_NOMATCH);
+ MACRO(GLOB_NOSPACE);
+
+ FUNCTION(glob, int (*f)(const char*, int, int (*)(const char*, int), glob_t*));
+ FUNCTION(globfree, void (*f)(glob_t*));
+}
diff --git a/tests/headers/posix/grp_h.c b/tests/headers/posix/grp_h.c
new file mode 100644
index 0000000..7042e83
--- /dev/null
+++ b/tests/headers/posix/grp_h.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <grp.h>
+
+#include "header_checks.h"
+
+static void grp_h() {
+ TYPE(struct group);
+ STRUCT_MEMBER(struct group, char*, gr_name);
+ STRUCT_MEMBER(struct group, gid_t, gr_gid);
+ STRUCT_MEMBER(struct group, char**, gr_mem);
+
+ TYPE(gid_t);
+ TYPE(size_t);
+
+ FUNCTION(endgrent, void (*f)(void));
+ FUNCTION(getgrent, struct group* (*f)(void));
+ FUNCTION(getgrgid, struct group* (*f)(gid_t));
+ FUNCTION(getgrgid_r, int (*f)(gid_t, struct group*, char*, size_t, struct group**));
+ FUNCTION(getgrnam, struct group* (*f)(const char*));
+ FUNCTION(getgrnam_r, int (*f)(const char*, struct group*, char*, size_t, struct group**));
+ FUNCTION(setgrent, void (*f)(void));
+}
diff --git a/tests/headers/posix/header_checks.h b/tests/headers/posix/header_checks.h
new file mode 100644
index 0000000..2ce6da9
--- /dev/null
+++ b/tests/headers/posix/header_checks.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define FUNCTION(f_, t_) { t_ = f_; }
+#define MACRO(m_) { typeof(m_) v = m_; }
+#define MACRO_VALUE(m_, v_) _Static_assert((m_)==(v_),#m_)
+#define MACRO_TYPE(t_, m_) { t_ v = m_; }
+#define TYPE(t_) { t_ value; }
+#define INCOMPLETE_TYPE(t_) { t_* value; }
+#define STRUCT_MEMBER(s_, t_, n_) { s_ s; t_* ptr = &(s.n_); }
+#define STRUCT_MEMBER_ARRAY(s_, t_, n_) { s_ s; t_* ptr = &(s.n_[0]); }
+#define STRUCT_MEMBER_FUNCTION_POINTER(s_, t_, n_) { s_ s; t_ = (s.n_); }
diff --git a/tests/headers/posix/iconv_h.c b/tests/headers/posix/iconv_h.c
new file mode 100644
index 0000000..d92d873
--- /dev/null
+++ b/tests/headers/posix/iconv_h.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <iconv.h>
+
+#include "header_checks.h"
+
+static void iconv_h() {
+ TYPE(iconv_t);
+ TYPE(size_t);
+
+ FUNCTION(iconv, size_t (*f)(iconv_t, char**, size_t*, char**, size_t*));
+ FUNCTION(iconv_close, int (*f)(iconv_t));
+ FUNCTION(iconv_open, iconv_t (*f)(const char*, const char*));
+}
diff --git a/tests/headers/posix/inttypes_h.c b/tests/headers/posix/inttypes_h.c
new file mode 100644
index 0000000..1eba4b8
--- /dev/null
+++ b/tests/headers/posix/inttypes_h.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <inttypes.h>
+
+#include "header_checks.h"
+
+static void inttypes_h() {
+ TYPE(imaxdiv_t);
+#if defined(__GLIBC__)
+ // Despite POSIX, glibc goes out of its way to avoid defining wchar_t. Fix that.
+ typedef __WCHAR_TYPE__ wchar_t;
+#endif
+ TYPE(wchar_t);
+
+ // TODO: PRI macros
+ // TODO: SCN macros
+
+ FUNCTION(imaxabs, intmax_t (*f)(intmax_t));
+ FUNCTION(imaxdiv, imaxdiv_t (*f)(intmax_t, intmax_t));
+ FUNCTION(strtoimax, intmax_t (*f)(const char*, char**, int));
+ FUNCTION(strtoumax, uintmax_t (*f)(const char*, char**, int));
+ FUNCTION(wcstoimax, intmax_t (*f)(const wchar_t*, wchar_t**, int));
+ FUNCTION(wcstoumax, uintmax_t (*f)(const wchar_t*, wchar_t**, int));
+}
diff --git a/tests/headers/posix/iso646_h.c b/tests/headers/posix/iso646_h.c
new file mode 100644
index 0000000..be2a189
--- /dev/null
+++ b/tests/headers/posix/iso646_h.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <iso646.h>
+
+#include "header_checks.h"
+
+static void iso646_h() {
+#if !defined(and)
+#error and
+#endif
+#if !defined(and_eq)
+#error and_eq
+#endif
+#if !defined(bitand)
+#error bitand
+#endif
+#if !defined(bitor)
+#error bitor
+#endif
+#if !defined(compl)
+#error compl
+#endif
+#if !defined(not)
+#error not
+#endif
+#if !defined(not_eq)
+#error not_eq
+#endif
+#if !defined(or)
+#error or
+#endif
+#if !defined(or_eq)
+#error or_eq
+#endif
+#if !defined(xor)
+#error xor
+#endif
+#if !defined(xor_eq)
+#error xor_eq
+#endif
+}
diff --git a/tests/headers/posix/langinfo_h.c b/tests/headers/posix/langinfo_h.c
new file mode 100644
index 0000000..d38d41b
--- /dev/null
+++ b/tests/headers/posix/langinfo_h.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <langinfo.h>
+
+#include "header_checks.h"
+
+static void langinfo_h() {
+ TYPE(locale_t);
+ TYPE(nl_item);
+
+ MACRO_TYPE(nl_item, CODESET);
+ MACRO_TYPE(nl_item, D_T_FMT);
+ MACRO_TYPE(nl_item, D_FMT);
+ MACRO_TYPE(nl_item, T_FMT);
+ MACRO_TYPE(nl_item, T_FMT_AMPM);
+ MACRO_TYPE(nl_item, AM_STR);
+ MACRO_TYPE(nl_item, PM_STR);
+ MACRO_TYPE(nl_item, DAY_1);
+ MACRO_TYPE(nl_item, DAY_2);
+ MACRO_TYPE(nl_item, DAY_3);
+ MACRO_TYPE(nl_item, DAY_4);
+ MACRO_TYPE(nl_item, DAY_5);
+ MACRO_TYPE(nl_item, DAY_6);
+ MACRO_TYPE(nl_item, DAY_7);
+ MACRO_TYPE(nl_item, ABDAY_1);
+ MACRO_TYPE(nl_item, ABDAY_2);
+ MACRO_TYPE(nl_item, ABDAY_3);
+ MACRO_TYPE(nl_item, ABDAY_4);
+ MACRO_TYPE(nl_item, ABDAY_5);
+ MACRO_TYPE(nl_item, ABDAY_6);
+ MACRO_TYPE(nl_item, ABDAY_7);
+ MACRO_TYPE(nl_item, MON_1);
+ MACRO_TYPE(nl_item, MON_2);
+ MACRO_TYPE(nl_item, MON_3);
+ MACRO_TYPE(nl_item, MON_4);
+ MACRO_TYPE(nl_item, MON_5);
+ MACRO_TYPE(nl_item, MON_6);
+ MACRO_TYPE(nl_item, MON_7);
+ MACRO_TYPE(nl_item, MON_8);
+ MACRO_TYPE(nl_item, MON_9);
+ MACRO_TYPE(nl_item, MON_10);
+ MACRO_TYPE(nl_item, MON_11);
+ MACRO_TYPE(nl_item, MON_12);
+ MACRO_TYPE(nl_item, ABMON_1);
+ MACRO_TYPE(nl_item, ABMON_2);
+ MACRO_TYPE(nl_item, ABMON_3);
+ MACRO_TYPE(nl_item, ABMON_4);
+ MACRO_TYPE(nl_item, ABMON_5);
+ MACRO_TYPE(nl_item, ABMON_6);
+ MACRO_TYPE(nl_item, ABMON_7);
+ MACRO_TYPE(nl_item, ABMON_8);
+ MACRO_TYPE(nl_item, ABMON_9);
+ MACRO_TYPE(nl_item, ABMON_10);
+ MACRO_TYPE(nl_item, ABMON_11);
+ MACRO_TYPE(nl_item, ABMON_12);
+ MACRO_TYPE(nl_item, ERA);
+ MACRO_TYPE(nl_item, ERA_D_FMT);
+ MACRO_TYPE(nl_item, ERA_D_T_FMT);
+ MACRO_TYPE(nl_item, ERA_T_FMT);
+ MACRO_TYPE(nl_item, ALT_DIGITS);
+ MACRO_TYPE(nl_item, RADIXCHAR);
+ MACRO_TYPE(nl_item, THOUSEP);
+ MACRO_TYPE(nl_item, YESEXPR);
+ MACRO_TYPE(nl_item, NOEXPR);
+ MACRO_TYPE(nl_item, CRNCYSTR);
+
+ FUNCTION(nl_langinfo, char* (*f)(nl_item));
+ FUNCTION(nl_langinfo_l, char* (*f)(nl_item, locale_t));
+}
diff --git a/tests/headers/posix/libgen_h.c b/tests/headers/posix/libgen_h.c
new file mode 100644
index 0000000..d839a06
--- /dev/null
+++ b/tests/headers/posix/libgen_h.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <libgen.h>
+
+#include "header_checks.h"
+
+static void libgen_h() {
+#if defined(__BIONIC__) // bionic doesn't modify its argument, and admits as much.
+ FUNCTION(basename, char* (*f)(const char*));
+ FUNCTION(dirname, char* (*f)(const char*));
+#else
+ FUNCTION(basename, char* (*f)(char*));
+ FUNCTION(dirname, char* (*f)(char*));
+#endif
+}
diff --git a/tests/headers/posix/limits_h.c b/tests/headers/posix/limits_h.c
new file mode 100644
index 0000000..143f717
--- /dev/null
+++ b/tests/headers/posix/limits_h.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <limits.h>
+
+#include "header_checks.h"
+
+static void limits_h() {
+ // These are only defined if they're constants.
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(AIO_LISTIO_MAX);
+ MACRO(AIO_MAX);
+#endif
+#if !defined(__BIONIC__)
+ MACRO(AIO_PRIO_DELTA_MAX);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(ARG_MAX);
+ MACRO(ATEXIT_MAX);
+ MACRO(CHILD_MAX);
+#endif
+#if !defined(__BIONIC__)
+ MACRO(DELAYTIMER_MAX);
+#endif
+ MACRO(HOST_NAME_MAX);
+ MACRO(IOV_MAX);
+ MACRO(LOGIN_NAME_MAX);
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(MQ_OPEN_MAX);
+#endif
+#if !defined(__BIONIC__)
+ MACRO(MQ_PRIO_MAX);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(OPEN_MAX);
+ MACRO(PAGESIZE);
+ MACRO(PAGE_SIZE);
+#endif
+ MACRO(PTHREAD_DESTRUCTOR_ITERATIONS);
+ MACRO(PTHREAD_KEYS_MAX);
+#if !defined(__BIONIC__)
+ MACRO(PTHREAD_STACK_MIN);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(PTHREAD_THREADS_MAX);
+#endif
+ MACRO(RTSIG_MAX);
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(SEM_NSEMS_MAX);
+#endif
+ MACRO(SEM_VALUE_MAX);
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(SIGQUEUE_MAX);
+ MACRO(SS_REPL_MAX);
+ MACRO(STREAM_MAX);
+ MACRO(SYMLOOP_MAX);
+ MACRO(TIMER_MAX);
+#endif
+#if !defined(__BIONIC__)
+ MACRO(TTY_NAME_MAX);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(TZNAME_MAX);
+#endif
+
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(FILESIZEBITS);
+ MACRO(LINK_MAX);
+#endif
+ MACRO(MAX_CANON);
+ MACRO(MAX_INPUT);
+ MACRO(NAME_MAX);
+ MACRO(PATH_MAX);
+ MACRO(PIPE_BUF);
+#if 0 // No libc has these.
+ MACRO(POSIX_ALLOC_SIZE_MIN);
+ MACRO(POSIX_REC_INCR_XFER_SIZE);
+ MACRO(POSIX_REC_MAX_XFER_SIZE);
+ MACRO(POSIX_REC_MIN_XFER_SIZE);
+ MACRO(POSIX_REC_XFER_ALIGN);
+#endif
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(SYMLINK_MAX);
+#endif
+
+#if !defined(__BIONIC__)
+ MACRO(BC_BASE_MAX);
+ MACRO(BC_DIM_MAX);
+ MACRO(BC_SCALE_MAX);
+ MACRO(BC_STRING_MAX);
+ MACRO(CHARCLASS_NAME_MAX);
+ MACRO(COLL_WEIGHTS_MAX);
+ MACRO(EXPR_NEST_MAX);
+ MACRO(LINE_MAX);
+ MACRO(NGROUPS_MAX);
+ MACRO(RE_DUP_MAX);
+#endif
+
+ MACRO_VALUE(_POSIX_CLOCKRES_MIN, 20000000);
+
+ MACRO_VALUE(_POSIX_AIO_LISTIO_MAX, 2);
+ MACRO_VALUE(_POSIX_AIO_MAX, 1);
+ MACRO_VALUE(_POSIX_ARG_MAX, 4096);
+ MACRO_VALUE(_POSIX_CHILD_MAX, 25);
+ MACRO_VALUE(_POSIX_DELAYTIMER_MAX, 32);
+ MACRO_VALUE(_POSIX_HOST_NAME_MAX, 255);
+ MACRO_VALUE(_POSIX_LINK_MAX, 8);
+ MACRO_VALUE(_POSIX_LOGIN_NAME_MAX, 9);
+ MACRO_VALUE(_POSIX_MAX_CANON, 255);
+ MACRO_VALUE(_POSIX_MAX_INPUT, 255);
+ MACRO_VALUE(_POSIX_MQ_OPEN_MAX, 8);
+ MACRO_VALUE(_POSIX_MQ_PRIO_MAX, 32);
+ MACRO_VALUE(_POSIX_NAME_MAX, 14);
+ MACRO_VALUE(_POSIX_NGROUPS_MAX, 8);
+ MACRO_VALUE(_POSIX_OPEN_MAX, 20);
+ MACRO_VALUE(_POSIX_PATH_MAX, 256);
+ MACRO_VALUE(_POSIX_PIPE_BUF, 512);
+ MACRO_VALUE(_POSIX_RE_DUP_MAX, 255);
+ MACRO_VALUE(_POSIX_RTSIG_MAX, 8);
+ MACRO_VALUE(_POSIX_SEM_NSEMS_MAX, 256);
+ MACRO_VALUE(_POSIX_SEM_VALUE_MAX, 32767);
+ MACRO_VALUE(_POSIX_SIGQUEUE_MAX, 32);
+ MACRO_VALUE(_POSIX_SSIZE_MAX, 32767);
+#if !defined(__GLIBC__)
+ MACRO_VALUE(_POSIX_SS_REPL_MAX, 4);
+#endif
+ MACRO_VALUE(_POSIX_STREAM_MAX, 8);
+ MACRO_VALUE(_POSIX_SYMLINK_MAX, 255);
+ MACRO_VALUE(_POSIX_SYMLOOP_MAX, 8);
+ MACRO_VALUE(_POSIX_THREAD_DESTRUCTOR_ITERATIONS, 4);
+ MACRO_VALUE(_POSIX_THREAD_KEYS_MAX, 128);
+ MACRO_VALUE(_POSIX_THREAD_THREADS_MAX, 64);
+ MACRO_VALUE(_POSIX_TIMER_MAX, 32);
+#if !defined(__GLIBC__)
+ MACRO_VALUE(_POSIX_TRACE_EVENT_NAME_MAX, 30);
+ MACRO_VALUE(_POSIX_TRACE_NAME_MAX, 8);
+ MACRO_VALUE(_POSIX_TRACE_SYS_MAX, 8);
+ MACRO_VALUE(_POSIX_TRACE_USER_EVENT_MAX, 32);
+#endif
+ MACRO_VALUE(_POSIX_TTY_NAME_MAX, 9);
+ MACRO_VALUE(_POSIX_TZNAME_MAX, 6);
+ MACRO_VALUE(_POSIX2_BC_BASE_MAX, 99);
+ MACRO_VALUE(_POSIX2_BC_DIM_MAX, 2048);
+ MACRO_VALUE(_POSIX2_BC_SCALE_MAX, 99);
+ MACRO_VALUE(_POSIX2_BC_STRING_MAX, 1000);
+ MACRO_VALUE(_POSIX2_CHARCLASS_NAME_MAX, 14);
+ MACRO_VALUE(_POSIX2_COLL_WEIGHTS_MAX, 2);
+ MACRO_VALUE(_POSIX2_EXPR_NEST_MAX, 32);
+ MACRO_VALUE(_POSIX2_LINE_MAX, 2048);
+ MACRO_VALUE(_POSIX2_RE_DUP_MAX, 255);
+#if !defined(__GLIBC__)
+ MACRO_VALUE(_XOPEN_IOV_MAX, 16);
+ MACRO_VALUE(_XOPEN_NAME_MAX, 255);
+ MACRO_VALUE(_XOPEN_PATH_MAX, 1024);
+#endif
+
+ MACRO_VALUE(CHAR_BIT, 8);
+ MACRO(CHAR_MAX);
+ MACRO(CHAR_MIN);
+ MACRO(INT_MAX);
+ MACRO(INT_MIN);
+ MACRO(LLONG_MAX);
+ MACRO(LLONG_MIN);
+ MACRO(LONG_BIT);
+ MACRO(LONG_MAX);
+ MACRO(LONG_MIN);
+ MACRO(MB_LEN_MAX);
+ MACRO_VALUE(SCHAR_MAX, 127);
+ MACRO_VALUE(SCHAR_MIN, -128);
+ MACRO(SHRT_MAX);
+ MACRO(SHRT_MIN);
+ MACRO(SSIZE_MAX);
+ MACRO_VALUE(UCHAR_MAX, 255);
+ MACRO(UINT_MAX);
+ MACRO(ULLONG_MAX);
+ MACRO(ULONG_MAX);
+ MACRO(USHRT_MAX);
+ MACRO(WORD_BIT);
+
+ MACRO(NL_ARGMAX);
+ MACRO(NL_LANGMAX);
+ MACRO(NL_MSGMAX);
+ MACRO(NL_SETMAX);
+ MACRO(NL_TEXTMAX);
+ MACRO(NZERO);
+}
diff --git a/tests/headers/posix/locale_h.c b/tests/headers/posix/locale_h.c
new file mode 100644
index 0000000..68051c8
--- /dev/null
+++ b/tests/headers/posix/locale_h.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <locale.h>
+
+#include "header_checks.h"
+
+static void locale_h() {
+ TYPE(struct lconv);
+ STRUCT_MEMBER(struct lconv, char*, currency_symbol);
+ STRUCT_MEMBER(struct lconv, char*, decimal_point);
+ STRUCT_MEMBER(struct lconv, char, frac_digits);
+ STRUCT_MEMBER(struct lconv, char*, grouping);
+ STRUCT_MEMBER(struct lconv, char*, int_curr_symbol);
+ STRUCT_MEMBER(struct lconv, char, int_frac_digits);
+ STRUCT_MEMBER(struct lconv, char, int_n_cs_precedes);
+ STRUCT_MEMBER(struct lconv, char, int_n_sep_by_space);
+ STRUCT_MEMBER(struct lconv, char, int_n_sign_posn);
+ STRUCT_MEMBER(struct lconv, char, int_p_cs_precedes);
+ STRUCT_MEMBER(struct lconv, char, int_p_sep_by_space);
+ STRUCT_MEMBER(struct lconv, char, int_p_sign_posn);
+ STRUCT_MEMBER(struct lconv, char*, mon_decimal_point);
+ STRUCT_MEMBER(struct lconv, char*, mon_grouping);
+ STRUCT_MEMBER(struct lconv, char*, mon_thousands_sep);
+ STRUCT_MEMBER(struct lconv, char*, negative_sign);
+ STRUCT_MEMBER(struct lconv, char, n_cs_precedes);
+ STRUCT_MEMBER(struct lconv, char, n_sep_by_space);
+ STRUCT_MEMBER(struct lconv, char, n_sign_posn);
+ STRUCT_MEMBER(struct lconv, char*, positive_sign);
+ STRUCT_MEMBER(struct lconv, char, p_cs_precedes);
+ STRUCT_MEMBER(struct lconv, char, p_sep_by_space);
+ STRUCT_MEMBER(struct lconv, char, p_sign_posn);
+ STRUCT_MEMBER(struct lconv, char*, thousands_sep);
+
+ MACRO(NULL);
+
+ MACRO(LC_ALL);
+ MACRO(LC_COLLATE);
+ MACRO(LC_CTYPE);
+ MACRO(LC_MONETARY);
+ MACRO(LC_NUMERIC);
+ MACRO(LC_TIME);
+
+ MACRO(LC_COLLATE_MASK);
+ MACRO(LC_CTYPE_MASK);
+ MACRO(LC_MESSAGES_MASK);
+ MACRO(LC_MONETARY_MASK);
+ MACRO(LC_NUMERIC_MASK);
+ MACRO(LC_TIME_MASK);
+ MACRO(LC_ALL_MASK);
+
+ MACRO_TYPE(locale_t, LC_GLOBAL_LOCALE);
+ TYPE(locale_t);
+
+ FUNCTION(duplocale, locale_t (*f)(locale_t));
+ FUNCTION(freelocale, void (*f)(locale_t));
+ FUNCTION(localeconv, struct lconv* (*f)(void));
+ FUNCTION(newlocale, locale_t (*f)(int, const char*, locale_t));
+ FUNCTION(setlocale, char* (*f)(int, const char*));
+ FUNCTION(uselocale, locale_t (*f)(locale_t));
+}
diff --git a/tests/headers/posix/math_h.c b/tests/headers/posix/math_h.c
new file mode 100644
index 0000000..0f8ad2b
--- /dev/null
+++ b/tests/headers/posix/math_h.c
@@ -0,0 +1,346 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <math.h>
+
+#include "header_checks.h"
+
+static void math_h() {
+ TYPE(float_t);
+ TYPE(double_t);
+
+#if !defined(fpclassify)
+#error fpclassify
+#endif
+#if !defined(isfinite)
+#error isfinite
+#endif
+#if !defined(isgreater)
+#error isgreater
+#endif
+#if !defined(isgreaterequal)
+#error isgreaterequal
+#endif
+#if !defined(isinf)
+#error isinf
+#endif
+#if !defined(isless)
+#error isless
+#endif
+#if !defined(islessequal)
+#error islessequal
+#endif
+#if !defined(islessgreater)
+#error islessgreater
+#endif
+#if !defined(isnan)
+#error isnan
+#endif
+#if !defined(isnormal)
+#error isnormal
+#endif
+#if !defined(isunordered)
+#error isunordered
+#endif
+#if !defined(signbit)
+#error signbit
+#endif
+
+ MACRO(M_E);
+ MACRO(M_LOG2E);
+ MACRO(M_LOG10E);
+ MACRO(M_LN2);
+ MACRO(M_LN10);
+ MACRO(M_PI);
+ MACRO(M_PI_2);
+ MACRO(M_PI_4);
+ MACRO(M_1_PI);
+ MACRO(M_2_PI);
+ MACRO(M_2_SQRTPI);
+ MACRO(M_SQRT2);
+ MACRO(M_SQRT1_2);
+
+ MACRO(MAXFLOAT);
+
+ MACRO(HUGE_VAL);
+ MACRO(HUGE_VALF);
+ MACRO(HUGE_VALL);
+ MACRO(INFINITY);
+ MACRO(NAN);
+
+ MACRO(FP_INFINITE);
+ MACRO(FP_NAN);
+ MACRO(FP_NORMAL);
+ MACRO(FP_SUBNORMAL);
+ MACRO(FP_ZERO);
+
+#if defined(FP_FAST_FMA) && FP_FAST_FMA != 1
+#error FP_FAST_FMA
+#endif
+#if defined(FP_FAST_FMAF) && FP_FAST_FMAF != 1
+#error FP_FAST_FMAF
+#endif
+#if defined(FP_FAST_FMAL) && FP_FAST_FMAL != 1
+#error FP_FAST_FMAL
+#endif
+
+ MACRO(FP_ILOGB0);
+ MACRO(FP_ILOGBNAN);
+
+ MACRO_VALUE(MATH_ERRNO, 1);
+ MACRO_VALUE(MATH_ERREXCEPT, 2);
+
+#if !defined(math_errhandling)
+#error math_errhandling
+#endif
+ MACRO_TYPE(int, math_errhandling);
+
+ FUNCTION(acos, double (*f)(double));
+ FUNCTION(acosf, float (*f)(float));
+ FUNCTION(acosh, double (*f)(double));
+ FUNCTION(acoshf, float (*f)(float));
+ FUNCTION(acoshl, long double (*f)(long double));
+ FUNCTION(acosl, long double (*f)(long double));
+
+ FUNCTION(asin, double (*f)(double));
+ FUNCTION(asinf, float (*f)(float));
+ FUNCTION(asinh, double (*f)(double));
+ FUNCTION(asinhf, float (*f)(float));
+ FUNCTION(asinhl, long double (*f)(long double));
+ FUNCTION(asinl, long double (*f)(long double));
+
+ FUNCTION(atan, double (*f)(double));
+ FUNCTION(atan2, double (*f)(double, double));
+ FUNCTION(atan2f, float (*f)(float, float));
+ FUNCTION(atan2l, long double (*f)(long double, long double));
+ FUNCTION(atanf, float (*f)(float));
+ FUNCTION(atanh, double (*f)(double));
+ FUNCTION(atanhf, float (*f)(float));
+ FUNCTION(atanhl, long double (*f)(long double));
+ FUNCTION(atanl, long double (*f)(long double));
+
+ FUNCTION(cbrt, double (*f)(double));
+ FUNCTION(cbrtf, float (*f)(float));
+ FUNCTION(cbrtl, long double (*f)(long double));
+
+ FUNCTION(ceil, double (*f)(double));
+ FUNCTION(ceilf, float (*f)(float));
+ FUNCTION(ceill, long double (*f)(long double));
+
+ FUNCTION(copysign, double (*f)(double, double));
+ FUNCTION(copysignf, float (*f)(float, float));
+ FUNCTION(copysignl, long double (*f)(long double, long double));
+
+ FUNCTION(cos, double (*f)(double));
+ FUNCTION(cosf, float (*f)(float));
+ FUNCTION(cosh, double (*f)(double));
+ FUNCTION(coshf, float (*f)(float));
+ FUNCTION(coshl, long double (*f)(long double));
+ FUNCTION(cosl, long double (*f)(long double));
+
+ FUNCTION(erf, double (*f)(double));
+ FUNCTION(erfc, double (*f)(double));
+ FUNCTION(erfcf, float (*f)(float));
+ FUNCTION(erfcl, long double (*f)(long double));
+ FUNCTION(erff, float (*f)(float));
+ FUNCTION(erfl, long double (*f)(long double));
+
+ FUNCTION(exp, double (*f)(double));
+ FUNCTION(exp2, double (*f)(double));
+ FUNCTION(exp2f, float (*f)(float));
+ FUNCTION(exp2l, long double (*f)(long double));
+ FUNCTION(expf, float (*f)(float));
+ FUNCTION(expl, long double (*f)(long double));
+ FUNCTION(expm1, double (*f)(double));
+ FUNCTION(expm1f, float (*f)(float));
+ FUNCTION(expm1l, long double (*f)(long double));
+
+ FUNCTION(fabs, double (*f)(double));
+ FUNCTION(fabsf, float (*f)(float));
+ FUNCTION(fabsl, long double (*f)(long double));
+
+ FUNCTION(fdim, double (*f)(double, double));
+ FUNCTION(fdimf, float (*f)(float, float));
+ FUNCTION(fdiml, long double (*f)(long double, long double));
+
+ FUNCTION(floor, double (*f)(double));
+ FUNCTION(floorf, float (*f)(float));
+ FUNCTION(floorl, long double (*f)(long double));
+
+ FUNCTION(fma, double (*f)(double, double, double));
+ FUNCTION(fmaf, float (*f)(float, float, float));
+ FUNCTION(fmal, long double (*f)(long double, long double, long double));
+
+ FUNCTION(fmax, double (*f)(double, double));
+ FUNCTION(fmaxf, float (*f)(float, float));
+ FUNCTION(fmaxl, long double (*f)(long double, long double));
+
+ FUNCTION(fmin, double (*f)(double, double));
+ FUNCTION(fminf, float (*f)(float, float));
+ FUNCTION(fminl, long double (*f)(long double, long double));
+
+ FUNCTION(fmod, double (*f)(double, double));
+ FUNCTION(fmodf, float (*f)(float, float));
+ FUNCTION(fmodl, long double (*f)(long double, long double));
+
+ FUNCTION(frexp, double (*f)(double, int*));
+ FUNCTION(frexpf, float (*f)(float, int*));
+ FUNCTION(frexpl, long double (*f)(long double, int*));
+
+ FUNCTION(hypot, double (*f)(double, double));
+ FUNCTION(hypotf, float (*f)(float, float));
+ FUNCTION(hypotl, long double (*f)(long double, long double));
+
+ FUNCTION(ilogb, int (*f)(double));
+ FUNCTION(ilogbf, int (*f)(float));
+ FUNCTION(ilogbl, int (*f)(long double));
+
+ FUNCTION(j0, double (*f)(double));
+ FUNCTION(j1, double (*f)(double));
+ FUNCTION(jn, double (*f)(int, double));
+
+ FUNCTION(ldexp, double (*f)(double, int));
+ FUNCTION(ldexpf, float (*f)(float, int));
+ FUNCTION(ldexpl, long double (*f)(long double, int));
+
+ FUNCTION(lgamma, double (*f)(double));
+ FUNCTION(lgammaf, float (*f)(float));
+ FUNCTION(lgammal, long double (*f)(long double));
+
+ FUNCTION(llrint, long long (*f)(double));
+ FUNCTION(llrintf, long long (*f)(float));
+ FUNCTION(llrintl, long long (*f)(long double));
+
+ FUNCTION(llround, long long (*f)(double));
+ FUNCTION(llroundf, long long (*f)(float));
+ FUNCTION(llroundl, long long (*f)(long double));
+
+ FUNCTION(log, double (*f)(double));
+ FUNCTION(log10, double (*f)(double));
+ FUNCTION(log10f, float (*f)(float));
+ FUNCTION(log10l, long double (*f)(long double));
+ FUNCTION(log1p, double (*f)(double));
+ FUNCTION(log1pf, float (*f)(float));
+ FUNCTION(log1pl, long double (*f)(long double));
+ FUNCTION(log2, double (*f)(double));
+ FUNCTION(log2f, float (*f)(float));
+ FUNCTION(log2l, long double (*f)(long double));
+ FUNCTION(logb, double (*f)(double));
+ FUNCTION(logbf, float (*f)(float));
+ FUNCTION(logbl, long double (*f)(long double));
+ FUNCTION(logf, float (*f)(float));
+ FUNCTION(logl, long double (*f)(long double));
+
+ FUNCTION(lrint, long (*f)(double));
+ FUNCTION(lrintf, long (*f)(float));
+ FUNCTION(lrintl, long (*f)(long double));
+
+ FUNCTION(lround, long (*f)(double));
+ FUNCTION(lroundf, long (*f)(float));
+ FUNCTION(lroundl, long (*f)(long double));
+
+ FUNCTION(modf, double (*f)(double, double*));
+ FUNCTION(modff, float (*f)(float, float*));
+ FUNCTION(modfl, long double (*f)(long double, long double*));
+
+ FUNCTION(nan, double (*f)(const char*));
+ FUNCTION(nanf, float (*f)(const char*));
+ FUNCTION(nanl, long double (*f)(const char*));
+
+ FUNCTION(nearbyint, double (*f)(double));
+ FUNCTION(nearbyintf, float (*f)(float));
+ FUNCTION(nearbyintl, long double (*f)(long double));
+
+ FUNCTION(nextafter, double (*f)(double, double));
+ FUNCTION(nextafterf, float (*f)(float, float));
+ FUNCTION(nextafterl, long double (*f)(long double, long double));
+
+ FUNCTION(nexttoward, double (*f)(double, long double));
+ FUNCTION(nexttowardf, float (*f)(float, long double));
+ FUNCTION(nexttowardl, long double (*f)(long double, long double));
+
+ FUNCTION(pow, double (*f)(double, double));
+ FUNCTION(powf, float (*f)(float, float));
+ FUNCTION(powl, long double (*f)(long double, long double));
+
+ FUNCTION(remainder, double (*f)(double, double));
+ FUNCTION(remainderf, float (*f)(float, float));
+ FUNCTION(remainderl, long double (*f)(long double, long double));
+
+ FUNCTION(remquo, double (*f)(double, double, int*));
+ FUNCTION(remquof, float (*f)(float, float, int*));
+ FUNCTION(remquol, long double (*f)(long double, long double, int*));
+
+ FUNCTION(rint, double (*f)(double));
+ FUNCTION(rintf, float (*f)(float));
+ FUNCTION(rintl, long double (*f)(long double));
+
+ FUNCTION(round, double (*f)(double));
+ FUNCTION(roundf, float (*f)(float));
+ FUNCTION(roundl, long double (*f)(long double));
+
+ FUNCTION(scalbln, double (*f)(double, long));
+ FUNCTION(scalblnf, float (*f)(float, long));
+ FUNCTION(scalblnl, long double (*f)(long double, long));
+
+ FUNCTION(scalbn, double (*f)(double, int));
+ FUNCTION(scalbnf, float (*f)(float, int));
+ FUNCTION(scalbnl, long double (*f)(long double, int));
+
+ FUNCTION(sin, double (*f)(double));
+ FUNCTION(sinf, float (*f)(float));
+ FUNCTION(sinh, double (*f)(double));
+ FUNCTION(sinhf, float (*f)(float));
+ FUNCTION(sinhl, long double (*f)(long double));
+ FUNCTION(sinl, long double (*f)(long double));
+
+ FUNCTION(sqrt, double (*f)(double));
+ FUNCTION(sqrtf, float (*f)(float));
+ FUNCTION(sqrtl, long double (*f)(long double));
+
+ FUNCTION(tan, double (*f)(double));
+ FUNCTION(tanf, float (*f)(float));
+ FUNCTION(tanh, double (*f)(double));
+ FUNCTION(tanhf, float (*f)(float));
+ FUNCTION(tanhl, long double (*f)(long double));
+ FUNCTION(tanl, long double (*f)(long double));
+
+ FUNCTION(tgamma, double (*f)(double));
+ FUNCTION(tgammaf, float (*f)(float));
+ FUNCTION(tgammal, long double (*f)(long double));
+
+ FUNCTION(trunc, double (*f)(double));
+ FUNCTION(truncf, float (*f)(float));
+ FUNCTION(truncl, long double (*f)(long double));
+
+ FUNCTION(y0, double (*f)(double));
+ FUNCTION(y1, double (*f)(double));
+ FUNCTION(yn, double (*f)(int, double));
+
+ int s = signgam;
+}
diff --git a/tests/headers/posix/net_if_h.c b/tests/headers/posix/net_if_h.c
new file mode 100644
index 0000000..4b3df18
--- /dev/null
+++ b/tests/headers/posix/net_if_h.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <net/if.h>
+
+#include "header_checks.h"
+
+static void net_if_h() {
+ TYPE(struct if_nameindex);
+ STRUCT_MEMBER(struct if_nameindex, unsigned, if_index);
+ STRUCT_MEMBER(struct if_nameindex, char*, if_name);
+
+ MACRO(IF_NAMESIZE);
+
+ FUNCTION(if_freenameindex, void (*f)(struct if_nameindex*));
+ FUNCTION(if_indextoname, char* (*f)(unsigned, char*));
+ FUNCTION(if_nameindex, struct if_nameindex* (*f)(void));
+ FUNCTION(if_nametoindex, unsigned (*f)(const char*));
+}
diff --git a/tests/headers/posix/netdb_h.c b/tests/headers/posix/netdb_h.c
new file mode 100644
index 0000000..62fd083
--- /dev/null
+++ b/tests/headers/posix/netdb_h.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <netdb.h>
+
+#include "header_checks.h"
+
+static void netdb_h() {
+ TYPE(struct hostent);
+ STRUCT_MEMBER(struct hostent, char*, h_name);
+ STRUCT_MEMBER(struct hostent, char**, h_aliases);
+ STRUCT_MEMBER(struct hostent, int, h_addrtype);
+ STRUCT_MEMBER(struct hostent, int, h_length);
+ STRUCT_MEMBER(struct hostent, char**, h_addr_list);
+
+ TYPE(struct netent);
+ STRUCT_MEMBER(struct netent, char*, n_name);
+ STRUCT_MEMBER(struct netent, char**, n_aliases);
+ STRUCT_MEMBER(struct netent, int, n_addrtype);
+ STRUCT_MEMBER(struct netent, uint32_t, n_net);
+
+ TYPE(uint32_t);
+
+ TYPE(struct protoent);
+ STRUCT_MEMBER(struct protoent, char*, p_name);
+ STRUCT_MEMBER(struct protoent, char**, p_aliases);
+ STRUCT_MEMBER(struct protoent, int, p_proto);
+
+
+ TYPE(struct servent);
+ STRUCT_MEMBER(struct servent, char*, s_name);
+ STRUCT_MEMBER(struct servent, char**, s_aliases);
+ STRUCT_MEMBER(struct servent, int, s_port);
+ STRUCT_MEMBER(struct servent, char*, s_proto);
+
+ MACRO(IPPORT_RESERVED);
+
+ TYPE(struct addrinfo);
+ STRUCT_MEMBER(struct addrinfo, int, ai_flags);
+ STRUCT_MEMBER(struct addrinfo, int, ai_family);
+ STRUCT_MEMBER(struct addrinfo, int, ai_socktype);
+ STRUCT_MEMBER(struct addrinfo, int, ai_protocol);
+ STRUCT_MEMBER(struct addrinfo, socklen_t, ai_addrlen);
+ STRUCT_MEMBER(struct addrinfo, struct sockaddr*, ai_addr);
+ STRUCT_MEMBER(struct addrinfo, char*, ai_canonname);
+ STRUCT_MEMBER(struct addrinfo, struct addrinfo*, ai_next);
+
+ MACRO(AI_PASSIVE);
+ MACRO(AI_CANONNAME);
+ MACRO(AI_NUMERICHOST);
+ MACRO(AI_NUMERICSERV);
+ MACRO(AI_V4MAPPED);
+ MACRO(AI_ALL);
+ MACRO(AI_ADDRCONFIG);
+
+ MACRO(NI_NOFQDN);
+ MACRO(NI_NUMERICHOST);
+ MACRO(NI_NAMEREQD);
+ MACRO(NI_NUMERICSERV);
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+ MACRO(NI_NUMERICSCOPE);
+#endif
+ MACRO(NI_DGRAM);
+
+ MACRO(EAI_AGAIN);
+ MACRO(EAI_BADFLAGS);
+ MACRO(EAI_FAIL);
+ MACRO(EAI_FAMILY);
+ MACRO(EAI_MEMORY);
+ MACRO(EAI_NONAME);
+ MACRO(EAI_SERVICE);
+ MACRO(EAI_SOCKTYPE);
+ MACRO(EAI_SYSTEM);
+ MACRO(EAI_OVERFLOW);
+
+ FUNCTION(endhostent, void (*f)(void));
+ FUNCTION(endnetent, void (*f)(void));
+ FUNCTION(endprotoent, void (*f)(void));
+ FUNCTION(endservent, void (*f)(void));
+ FUNCTION(freeaddrinfo, void (*f)(struct addrinfo*));
+ FUNCTION(gai_strerror, const char* (*f)(int));
+ FUNCTION(getaddrinfo, int (*f)(const char*, const char*, const struct addrinfo*, struct addrinfo**));
+ FUNCTION(gethostent, struct hostent* (*f)(void));
+#if defined(__BIONIC__) // Historical ABI accident.
+ FUNCTION(getnameinfo, int (*f)(const struct sockaddr*, socklen_t, char*, size_t, char*, size_t, int));
+#else
+ FUNCTION(getnameinfo, int (*f)(const struct sockaddr*, socklen_t, char*, socklen_t, char*, socklen_t, int));
+#endif
+ FUNCTION(getnetbyaddr, struct netent* (*f)(uint32_t, int));
+ FUNCTION(getnetbyname, struct netent* (*f)(const char*));
+ FUNCTION(getnetent, struct netent* (*f)(void));
+ FUNCTION(getprotobyname, struct protoent* (*f)(const char*));
+ FUNCTION(getprotobynumber, struct protoent* (*f)(int));
+ FUNCTION(getprotoent, struct protoent* (*f)(void));
+ FUNCTION(getservbyname, struct servent* (*f)(const char*, const char*));
+ FUNCTION(getservbyport, struct servent* (*f)(int, const char*));
+ FUNCTION(getservent, struct servent* (*f)(void));
+ FUNCTION(sethostent, void (*f)(int));
+ FUNCTION(setnetent, void (*f)(int));
+ FUNCTION(setprotoent, void (*f)(int));
+ FUNCTION(setservent, void (*f)(int));
+
+ TYPE(socklen_t);
+}
diff --git a/tests/headers/posix/netinet_in_h.c b/tests/headers/posix/netinet_in_h.c
new file mode 100644
index 0000000..6e0be1c
--- /dev/null
+++ b/tests/headers/posix/netinet_in_h.c
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <netinet/in.h>
+
+#include "header_checks.h"
+
+static void netinet_in_h() {
+ TYPE(in_port_t);
+ TYPE(in_addr_t);
+ TYPE(sa_family_t);
+ TYPE(uint8_t);
+ TYPE(uint32_t);
+
+ TYPE(struct in_addr);
+ STRUCT_MEMBER(struct in_addr, in_addr_t, s_addr);
+
+ TYPE(struct sockaddr_in);
+ STRUCT_MEMBER(struct sockaddr_in, sa_family_t, sin_family);
+ STRUCT_MEMBER(struct sockaddr_in, in_port_t, sin_port);
+ STRUCT_MEMBER(struct sockaddr_in, struct in_addr, sin_addr);
+
+ TYPE(struct in6_addr);
+ STRUCT_MEMBER_ARRAY(struct in6_addr, uint8_t/*[]*/, s6_addr);
+
+ TYPE(struct sockaddr_in6);
+ STRUCT_MEMBER(struct sockaddr_in6, sa_family_t, sin6_family);
+ STRUCT_MEMBER(struct sockaddr_in6, in_port_t, sin6_port);
+ STRUCT_MEMBER(struct sockaddr_in6, uint32_t, sin6_flowinfo);
+ STRUCT_MEMBER(struct sockaddr_in6, struct in6_addr, sin6_addr);
+ STRUCT_MEMBER(struct sockaddr_in6, uint32_t, sin6_scope_id);
+
+ struct in6_addr any_global = in6addr_any;
+ struct in6_addr any_macro = IN6ADDR_ANY_INIT;
+ struct in6_addr loop_global = in6addr_loopback;
+ struct in6_addr loop_macro = IN6ADDR_LOOPBACK_INIT;
+
+ TYPE(struct ipv6_mreq);
+ STRUCT_MEMBER(struct ipv6_mreq, struct in6_addr, ipv6mr_multiaddr);
+#if defined(__BIONIC__)
+ STRUCT_MEMBER(struct ipv6_mreq, int, ipv6mr_interface);
+#else
+ STRUCT_MEMBER(struct ipv6_mreq, unsigned, ipv6mr_interface);
+#endif
+
+ MACRO(IPPROTO_IP);
+ MACRO(IPPROTO_IPV6);
+ MACRO(IPPROTO_ICMP);
+ MACRO(IPPROTO_RAW);
+ MACRO(IPPROTO_TCP);
+ MACRO(IPPROTO_UDP);
+
+ MACRO(INADDR_ANY);
+ MACRO(INADDR_BROADCAST);
+
+ MACRO_VALUE(INET_ADDRSTRLEN, 16);
+
+ FUNCTION(htonl, uint32_t (*f)(uint32_t));
+ FUNCTION(htons, uint16_t (*f)(uint16_t));
+ FUNCTION(ntohl, uint32_t (*f)(uint32_t));
+ FUNCTION(ntohs, uint16_t (*f)(uint16_t));
+
+ MACRO_VALUE(INET6_ADDRSTRLEN, 46);
+
+ MACRO(IPV6_JOIN_GROUP);
+ MACRO(IPV6_LEAVE_GROUP);
+ MACRO(IPV6_MULTICAST_HOPS);
+ MACRO(IPV6_MULTICAST_IF);
+ MACRO(IPV6_MULTICAST_LOOP);
+ MACRO(IPV6_UNICAST_HOPS);
+ MACRO(IPV6_V6ONLY);
+
+#if !defined(IN6_IS_ADDR_UNSPECIFIED)
+#error IN6_IS_ADDR_UNSPECIFIED
+#endif
+#if !defined(IN6_IS_ADDR_LOOPBACK)
+#error IN6_IS_ADDR_LOOPBACK
+#endif
+#if !defined(IN6_IS_ADDR_MULTICAST)
+#error IN6_IS_ADDR_MULTICAST
+#endif
+#if !defined(IN6_IS_ADDR_LINKLOCAL)
+#error IN6_IS_ADDR_LINKLOCAL
+#endif
+#if !defined(IN6_IS_ADDR_SITELOCAL)
+#error IN6_IS_ADDR_SITELOCAL
+#endif
+#if !defined(IN6_IS_ADDR_V4MAPPED)
+#error IN6_IS_ADDR_V4MAPPED
+#endif
+#if !defined(IN6_IS_ADDR_V4COMPAT)
+#error IN6_IS_ADDR_V4COMPAT
+#endif
+#if !defined(IN6_IS_ADDR_MC_NODELOCAL)
+#error IN6_IS_ADDR_MC_NODELOCAL
+#endif
+#if !defined(IN6_IS_ADDR_MC_LINKLOCAL)
+#error IN6_IS_ADDR_MC_LINKLOCAL
+#endif
+#if !defined(IN6_IS_ADDR_MC_SITELOCAL)
+#error IN6_IS_ADDR_MC_SITELOCAL
+#endif
+#if !defined(IN6_IS_ADDR_MC_ORGLOCAL)
+#error IN6_IS_ADDR_MC_ORGLOCAL
+#endif
+#if !defined(IN6_IS_ADDR_MC_GLOBAL)
+#error IN6_IS_ADDR_MC_GLOBAL
+#endif
+}
diff --git a/tests/headers/posix/netinet_tcp_h.c b/tests/headers/posix/netinet_tcp_h.c
new file mode 100644
index 0000000..afb6418
--- /dev/null
+++ b/tests/headers/posix/netinet_tcp_h.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <netinet/tcp.h>
+
+#include "header_checks.h"
+
+static void netinet_tcp_h() {
+ MACRO(TCP_NODELAY);
+}
diff --git a/tests/headers/posix/nl_types_h.c b/tests/headers/posix/nl_types_h.c
new file mode 100644
index 0000000..5a3c817
--- /dev/null
+++ b/tests/headers/posix/nl_types_h.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <nl_types.h>
+
+#include "header_checks.h"
+
+static void nl_types_h() {
+ TYPE(nl_catd);
+ TYPE(nl_item);
+
+ MACRO(NL_SETD);
+ MACRO(NL_CAT_LOCALE);
+
+ FUNCTION(catclose, int (*f)(nl_catd));
+ FUNCTION(catgets, char* (*f)(nl_catd, int, int, const char*));
+ FUNCTION(catopen, nl_catd (*f)(const char*, int));
+}
diff --git a/tests/headers/posix/poll_h.c b/tests/headers/posix/poll_h.c
new file mode 100644
index 0000000..4fce5e5
--- /dev/null
+++ b/tests/headers/posix/poll_h.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <poll.h>
+
+#include "header_checks.h"
+
+static void poll_h() {
+ TYPE(struct pollfd);
+ STRUCT_MEMBER(struct pollfd, int, fd);
+ STRUCT_MEMBER(struct pollfd, short, events);
+ STRUCT_MEMBER(struct pollfd, short, revents);
+
+ TYPE(nfds_t);
+
+ MACRO(POLLIN);
+ MACRO(POLLRDNORM);
+ MACRO(POLLRDBAND);
+ MACRO(POLLPRI);
+ MACRO(POLLOUT);
+ MACRO(POLLWRNORM);
+ MACRO(POLLWRBAND);
+ MACRO(POLLERR);
+ MACRO(POLLHUP);
+ MACRO(POLLNVAL);
+
+ FUNCTION(poll, int (*f)(struct pollfd[], nfds_t, int));
+}
diff --git a/tests/headers/posix/pthread_h.c b/tests/headers/posix/pthread_h.c
new file mode 100644
index 0000000..4fa5b9d
--- /dev/null
+++ b/tests/headers/posix/pthread_h.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <pthread.h>
+
+#include "header_checks.h"
+
+static void pthread_h() {
+ MACRO(PTHREAD_BARRIER_SERIAL_THREAD);
+
+#if !defined(__BIONIC__) // No thread cancellation on Android.
+ MACRO(PTHREAD_CANCEL_ASYNCHRONOUS);
+ MACRO(PTHREAD_CANCEL_ENABLE);
+ MACRO(PTHREAD_CANCEL_DEFERRED);
+ MACRO(PTHREAD_CANCEL_DISABLE);
+ MACRO(PTHREAD_CANCELED);
+#endif
+
+ MACRO(PTHREAD_CREATE_DETACHED);
+ MACRO(PTHREAD_CREATE_JOINABLE);
+ MACRO(PTHREAD_EXPLICIT_SCHED);
+ MACRO(PTHREAD_INHERIT_SCHED);
+ MACRO(PTHREAD_MUTEX_DEFAULT);
+ MACRO(PTHREAD_MUTEX_ERRORCHECK);
+ MACRO(PTHREAD_MUTEX_NORMAL);
+ MACRO(PTHREAD_MUTEX_RECURSIVE);
+
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ MACRO(PTHREAD_MUTEX_ROBUST);
+ MACRO(PTHREAD_MUTEX_STALLED);
+#endif
+
+ MACRO(PTHREAD_ONCE_INIT);
+
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ MACRO(PTHREAD_PRIO_INHERIT);
+ MACRO(PTHREAD_PRIO_NONE);
+ MACRO(PTHREAD_PRIO_PROTECT);
+#endif
+
+ MACRO(PTHREAD_PROCESS_SHARED);
+ MACRO(PTHREAD_PROCESS_PRIVATE);
+ MACRO(PTHREAD_SCOPE_PROCESS);
+ MACRO(PTHREAD_SCOPE_SYSTEM);
+
+ pthread_cond_t c0 = PTHREAD_COND_INITIALIZER;
+ pthread_mutex_t m0 = PTHREAD_MUTEX_INITIALIZER;
+ pthread_rwlock_t rw0 = PTHREAD_RWLOCK_INITIALIZER;
+
+ TYPE(pthread_attr_t);
+ TYPE(pthread_barrier_t);
+ TYPE(pthread_barrierattr_t);
+ TYPE(pthread_cond_t);
+ TYPE(pthread_condattr_t);
+ TYPE(pthread_key_t);
+ TYPE(pthread_mutex_t);
+ TYPE(pthread_mutexattr_t);
+ TYPE(pthread_once_t);
+ TYPE(pthread_rwlock_t);
+ TYPE(pthread_rwlockattr_t);
+ TYPE(pthread_spinlock_t);
+ TYPE(pthread_t);
+
+ FUNCTION(pthread_atfork, int (*f)(void (*)(void), void (*)(void), void (*)(void)));
+ FUNCTION(pthread_attr_destroy, int (*f)(pthread_attr_t*));
+ FUNCTION(pthread_attr_getdetachstate, int (*f)(const pthread_attr_t*, int*));
+ FUNCTION(pthread_attr_getguardsize, int (*f)(const pthread_attr_t*, size_t*));
+ FUNCTION(pthread_attr_getinheritsched, int (*f)(const pthread_attr_t*, int*));
+ FUNCTION(pthread_attr_getschedparam, int (*f)(const pthread_attr_t*, struct sched_param*));
+ FUNCTION(pthread_attr_getschedpolicy, int (*f)(const pthread_attr_t*, int*));
+ FUNCTION(pthread_attr_getscope, int (*f)(const pthread_attr_t*, int*));
+ FUNCTION(pthread_attr_getstack, int (*f)(const pthread_attr_t*, void**, size_t*));
+ FUNCTION(pthread_attr_getstacksize, int (*f)(const pthread_attr_t*, size_t*));
+ FUNCTION(pthread_attr_init, int (*f)(pthread_attr_t*));
+ FUNCTION(pthread_attr_setdetachstate, int (*f)(pthread_attr_t*, int));
+ FUNCTION(pthread_attr_setguardsize, int (*f)(pthread_attr_t*, size_t));
+ FUNCTION(pthread_attr_setinheritsched, int (*f)(pthread_attr_t*, int));
+ FUNCTION(pthread_attr_setschedparam, int (*f)(pthread_attr_t*, const struct sched_param*));
+ FUNCTION(pthread_attr_setschedpolicy, int (*f)(pthread_attr_t*, int));
+ FUNCTION(pthread_attr_setscope, int (*f)(pthread_attr_t*, int));
+ FUNCTION(pthread_attr_setstack, int (*f)(pthread_attr_t*, void*, size_t));
+ FUNCTION(pthread_attr_setstacksize, int (*f)(pthread_attr_t*, size_t));
+ FUNCTION(pthread_barrier_destroy, int (*f)(pthread_barrier_t*));
+ FUNCTION(pthread_barrier_init, int (*f)(pthread_barrier_t*, const pthread_barrierattr_t*, unsigned));
+ FUNCTION(pthread_barrier_wait, int (*f)(pthread_barrier_t*));
+ FUNCTION(pthread_barrierattr_destroy, int (*f)(pthread_barrierattr_t*));
+ FUNCTION(pthread_barrierattr_getpshared, int (*f)(const pthread_barrierattr_t*, int*));
+ FUNCTION(pthread_barrierattr_init, int (*f)(pthread_barrierattr_t*));
+ FUNCTION(pthread_barrierattr_setpshared, int (*f)(pthread_barrierattr_t*, int));
+#if !defined(__BIONIC__) // No thread cancellation on Android.
+ FUNCTION(pthread_cancel, int (*f)(pthread_t));
+#endif
+ FUNCTION(pthread_cond_broadcast, int (*f)(pthread_cond_t*));
+ FUNCTION(pthread_cond_destroy, int (*f)(pthread_cond_t*));
+ FUNCTION(pthread_cond_init, int (*f)(pthread_cond_t*, const pthread_condattr_t*));
+ FUNCTION(pthread_cond_signal, int (*f)(pthread_cond_t*));
+ FUNCTION(pthread_cond_timedwait, int (*f)(pthread_cond_t*, pthread_mutex_t*, const struct timespec*));
+ FUNCTION(pthread_cond_wait, int (*f)(pthread_cond_t*, pthread_mutex_t*));
+ FUNCTION(pthread_condattr_destroy, int (*f)(pthread_condattr_t*));
+ FUNCTION(pthread_condattr_getclock, int (*f)(const pthread_condattr_t*, clockid_t*));
+ FUNCTION(pthread_condattr_getpshared, int (*f)(const pthread_condattr_t*, int*));
+ FUNCTION(pthread_condattr_init, int (*f)(pthread_condattr_t*));
+ FUNCTION(pthread_condattr_setclock, int (*f)(pthread_condattr_t*, clockid_t));
+ FUNCTION(pthread_condattr_setpshared, int (*f)(pthread_condattr_t*, int));
+ FUNCTION(pthread_create, int (*f)(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*));
+ FUNCTION(pthread_detach, int (*f)(pthread_t));
+ FUNCTION(pthread_equal, int (*f)(pthread_t, pthread_t));
+ FUNCTION(pthread_exit, void (*f)(void*));
+#if !defined(__BIONIC__) // Marked obsolescent.
+ FUNCTION(pthread_getconcurrency, int (*f)(void));
+#endif
+ FUNCTION(pthread_getcpuclockid, int (*f)(pthread_t, clockid_t*));
+ FUNCTION(pthread_getschedparam, int (*f)(pthread_t, int*, struct sched_param*));
+ FUNCTION(pthread_getspecific, void* (*f)(pthread_key_t));
+ FUNCTION(pthread_join, int (*f)(pthread_t, void**));
+ FUNCTION(pthread_key_create, int (*f)(pthread_key_t*, void (*)(void*)));
+ FUNCTION(pthread_key_delete, int (*f)(pthread_key_t));
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ FUNCTION(pthread_mutex_consistent, int (*f)(pthread_mutex_t*));
+#endif
+ FUNCTION(pthread_mutex_destroy, int (*f)(pthread_mutex_t*));
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ FUNCTION(pthread_mutex_getprioceiling, int (*f)(const pthread_mutex_t*, int*));
+#endif
+ FUNCTION(pthread_mutex_init, int (*f)(pthread_mutex_t*, const pthread_mutexattr_t*));
+ FUNCTION(pthread_mutex_lock, int (*f)(pthread_mutex_t*));
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ FUNCTION(pthread_mutex_setprioceiling, int (*f)(pthread_mutex_t*, int, int*));
+#endif
+ FUNCTION(pthread_mutex_timedlock, int (*f)(pthread_mutex_t*, const struct timespec*));
+ FUNCTION(pthread_mutex_trylock, int (*f)(pthread_mutex_t*));
+ FUNCTION(pthread_mutex_unlock, int (*f)(pthread_mutex_t*));
+ FUNCTION(pthread_mutexattr_destroy, int (*f)(pthread_mutexattr_t*));
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ FUNCTION(pthread_mutexattr_getprioceiling, int (*f)(const pthread_mutexattr_t*, int*));
+ FUNCTION(pthread_mutexattr_getprotocol, int (*f)(const pthread_mutexattr_t*, int*));
+#endif
+ FUNCTION(pthread_mutexattr_getpshared, int (*f)(const pthread_mutexattr_t*, int*));
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ FUNCTION(pthread_mutexattr_getrobust, int (*f)(const pthread_mutexattr_t*, int*));
+#endif
+ FUNCTION(pthread_mutexattr_gettype, int (*f)(const pthread_mutexattr_t*, int*));
+ FUNCTION(pthread_mutexattr_init, int (*f)(pthread_mutexattr_t*));
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ FUNCTION(pthread_mutexattr_setprioceiling, int (*f)(pthread_mutexattr_t*, int));
+ FUNCTION(pthread_mutexattr_setprotocol, int (*f)(pthread_mutexattr_t*, int));
+#endif
+ FUNCTION(pthread_mutexattr_setpshared, int (*f)(pthread_mutexattr_t*, int));
+#if !defined(__BIONIC__) // No robust mutexes on Android.
+ FUNCTION(pthread_mutexattr_setrobust, int (*f)(pthread_mutexattr_t*, int));
+#endif
+ FUNCTION(pthread_mutexattr_settype, int (*f)(pthread_mutexattr_t*, int));
+ FUNCTION(pthread_once, int (*f)(pthread_once_t*, void (*)(void)));
+ FUNCTION(pthread_rwlock_destroy, int (*f)(pthread_rwlock_t*));
+ FUNCTION(pthread_rwlock_init, int (*f)(pthread_rwlock_t*, const pthread_rwlockattr_t*));
+ FUNCTION(pthread_rwlock_rdlock, int (*f)(pthread_rwlock_t*));
+ FUNCTION(pthread_rwlock_timedrdlock, int (*f)(pthread_rwlock_t*, const struct timespec*));
+ FUNCTION(pthread_rwlock_timedwrlock, int (*f)(pthread_rwlock_t*, const struct timespec*));
+ FUNCTION(pthread_rwlock_tryrdlock, int (*f)(pthread_rwlock_t*));
+ FUNCTION(pthread_rwlock_trywrlock, int (*f)(pthread_rwlock_t*));
+ FUNCTION(pthread_rwlock_unlock, int (*f)(pthread_rwlock_t*));
+ FUNCTION(pthread_rwlock_wrlock, int (*f)(pthread_rwlock_t*));
+ FUNCTION(pthread_rwlockattr_destroy, int (*f)(pthread_rwlockattr_t*));
+ FUNCTION(pthread_rwlockattr_getpshared, int (*f)(const pthread_rwlockattr_t*, int*));
+ FUNCTION(pthread_rwlockattr_init, int (*f)(pthread_rwlockattr_t*));
+ FUNCTION(pthread_rwlockattr_setpshared, int (*f)(pthread_rwlockattr_t*, int));
+ FUNCTION(pthread_self, pthread_t (*f)(void));
+#if !defined(__BIONIC__) // No thread cancellation on Android.
+ FUNCTION(pthread_setcancelstate, int (*f)(int, int*));
+ FUNCTION(pthread_setcanceltype, int (*f)(int, int*));
+#endif
+#if !defined(__BIONIC__) // Marked obsolescent.
+ FUNCTION(pthread_setconcurrency, int (*f)(int));
+#endif
+ FUNCTION(pthread_setschedparam, int (*f)(pthread_t, int, const struct sched_param*));
+ FUNCTION(pthread_setschedprio, int (*f)(pthread_t, int));
+ FUNCTION(pthread_setspecific, int (*f)(pthread_key_t, const void*));
+ FUNCTION(pthread_spin_destroy, int (*f)(pthread_spinlock_t*));
+ FUNCTION(pthread_spin_init, int (*f)(pthread_spinlock_t*, int));
+ FUNCTION(pthread_spin_lock, int (*f)(pthread_spinlock_t*));
+ FUNCTION(pthread_spin_trylock, int (*f)(pthread_spinlock_t*));
+ FUNCTION(pthread_spin_unlock, int (*f)(pthread_spinlock_t*));
+#if !defined(__BIONIC__) // No thread cancellation on Android.
+ FUNCTION(pthread_testcancel, void (*f)(void));
+#endif
+
+#if !defined(pthread_cleanup_pop)
+#error pthread_cleanup_pop
+#endif
+#if !defined(pthread_cleanup_push)
+#error pthread_cleanup_push
+#endif
+}
+
+// POSIX: "Inclusion of the <pthread.h> header shall make symbols defined in the
+// headers <sched.h> and <time.h> visible."
+
+#define DO_NOT_INCLUDE_SCHED_H
+#include "sched_h.c"
+#define DO_NOT_INCLUDE_TIME_H
+#include "time_h.c"
diff --git a/tests/headers/posix/pwd_h.c b/tests/headers/posix/pwd_h.c
new file mode 100644
index 0000000..3d20865
--- /dev/null
+++ b/tests/headers/posix/pwd_h.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <pwd.h>
+
+#include "header_checks.h"
+
+static void pwd_h() {
+ TYPE(struct passwd);
+ STRUCT_MEMBER(struct passwd, char*, pw_name);
+ STRUCT_MEMBER(struct passwd, uid_t, pw_uid);
+ STRUCT_MEMBER(struct passwd, gid_t, pw_gid);
+ STRUCT_MEMBER(struct passwd, char*, pw_dir);
+ STRUCT_MEMBER(struct passwd, char*, pw_shell);
+
+ TYPE(gid_t);
+ TYPE(uid_t);
+ TYPE(size_t);
+
+ FUNCTION(endpwent, void (*f)(void));
+ FUNCTION(getpwent, struct passwd* (*f)(void));
+ FUNCTION(getpwnam, struct passwd* (*f)(const char*));
+ FUNCTION(getpwnam_r, int (*f)(const char*, struct passwd*, char*, size_t, struct passwd**));
+ FUNCTION(getpwuid, struct passwd* (*f)(uid_t));
+ FUNCTION(getpwuid_r, int (*f)(uid_t, struct passwd*, char*, size_t, struct passwd**));
+ FUNCTION(setpwent, void (*f)(void));
+}
diff --git a/tests/headers/posix/regex_h.c b/tests/headers/posix/regex_h.c
new file mode 100644
index 0000000..381004c
--- /dev/null
+++ b/tests/headers/posix/regex_h.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <regex.h>
+
+#include "header_checks.h"
+
+static void regex_h() {
+ TYPE(regex_t);
+ STRUCT_MEMBER(regex_t, size_t, re_nsub);
+
+ TYPE(size_t);
+
+ TYPE(regmatch_t);
+ STRUCT_MEMBER(regmatch_t, regoff_t, rm_so);
+ STRUCT_MEMBER(regmatch_t, regoff_t, rm_eo);
+
+ MACRO(REG_EXTENDED);
+ MACRO(REG_ICASE);
+ MACRO(REG_NOSUB);
+ MACRO(REG_NEWLINE);
+
+ MACRO(REG_NOTBOL);
+ MACRO(REG_NOTEOL);
+
+ MACRO(REG_NOMATCH);
+ MACRO(REG_BADPAT);
+ MACRO(REG_ECOLLATE);
+ MACRO(REG_ECTYPE);
+ MACRO(REG_EESCAPE);
+ MACRO(REG_ESUBREG);
+ MACRO(REG_EBRACK);
+ MACRO(REG_EPAREN);
+ MACRO(REG_EBRACE);
+ MACRO(REG_BADBR);
+ MACRO(REG_ERANGE);
+ MACRO(REG_ESPACE);
+ MACRO(REG_BADRPT);
+
+ FUNCTION(regcomp, int (*f)(regex_t*, const char*, int));
+ FUNCTION(regerror, size_t (*f)(int, const regex_t*, char*, size_t));
+ FUNCTION(regexec, int (*f)(const regex_t*, const char*, size_t, regmatch_t*, int));
+}
diff --git a/tests/headers/posix/sched_h.c b/tests/headers/posix/sched_h.c
new file mode 100644
index 0000000..e9b98d6
--- /dev/null
+++ b/tests/headers/posix/sched_h.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#if !defined(DO_NOT_INCLUDE_SCHED_H)
+#include <sched.h>
+#endif
+
+#include "header_checks.h"
+
+static void sched_h() {
+ TYPE(pid_t);
+ TYPE(time_t);
+ TYPE(struct timespec);
+
+ TYPE(struct sched_param);
+ STRUCT_MEMBER(struct sched_param, int, sched_priority);
+#if !defined(__linux__)
+ STRUCT_MEMBER(struct sched_param, int, sched_ss_low_priority);
+ STRUCT_MEMBER(struct sched_param, struct timespec, sched_ss_repl_period);
+ STRUCT_MEMBER(struct sched_param, struct timespec, sched_ss_init_budget);
+ STRUCT_MEMBER(struct sched_param, int, sched_ss_max_repl);
+#endif
+
+ MACRO(SCHED_FIFO);
+ MACRO(SCHED_RR);
+#if !defined(__linux__)
+ MACRO(SCHED_SPORADIC);
+#endif
+ MACRO(SCHED_OTHER);
+
+ FUNCTION(sched_get_priority_max, int (*f)(int));
+ FUNCTION(sched_get_priority_min, int (*f)(int));
+ FUNCTION(sched_getparam, int (*f)(pid_t, struct sched_param*));
+ FUNCTION(sched_getscheduler, int (*f)(pid_t));
+ FUNCTION(sched_rr_get_interval, int (*f)(pid_t, struct timespec*));
+ FUNCTION(sched_setparam, int (*f)(pid_t, const struct sched_param*));
+ FUNCTION(sched_setscheduler, int (*f)(pid_t, int, const struct sched_param*));
+ FUNCTION(sched_yield, int (*f)(void));
+}
diff --git a/tests/headers/posix/search_h.c b/tests/headers/posix/search_h.c
new file mode 100644
index 0000000..9de079a
--- /dev/null
+++ b/tests/headers/posix/search_h.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <search.h>
+
+#include "header_checks.h"
+
+static void search_h() {
+ TYPE(ENTRY);
+ TYPE(struct entry);
+ STRUCT_MEMBER(ENTRY, char*, key);
+ STRUCT_MEMBER(ENTRY, void*, data);
+
+ ACTION a;
+ a = FIND;
+ a = ENTER;
+
+ VISIT v;
+ v = preorder;
+ v = postorder;
+ v = endorder;
+ v = leaf;
+
+ TYPE(size_t);
+
+ FUNCTION(hcreate, int (*f)(size_t));
+ FUNCTION(hdestroy, void (*f)(void));
+ FUNCTION(hsearch, ENTRY* (*f)(ENTRY, ACTION));
+ FUNCTION(insque, void (*f)(void*, void*));
+ FUNCTION(lfind, void* (*f)(const void*, const void*, size_t*, size_t,
+ int (*)(const void*, const void*)));
+ FUNCTION(lsearch, void* (*f)(const void*, void*, size_t*, size_t,
+ int (*)(const void*, const void*)));
+ FUNCTION(remque, void (*f)(void*));
+ FUNCTION(tdelete, void* (*f)(const void*, void**, int (*)(const void*, const void*)));
+ FUNCTION(tfind, void* (*f)(const void*, void* const*, int (*)(const void*, const void*)));
+ FUNCTION(tsearch, void* (*f)(const void*, void**, int (*)(const void*, const void*)));
+ FUNCTION(twalk, void (*f)(const void*, void (*)(const void*, VISIT, int)));
+}
diff --git a/tests/headers/posix/semaphore_h.c b/tests/headers/posix/semaphore_h.c
new file mode 100644
index 0000000..9d5c7e1
--- /dev/null
+++ b/tests/headers/posix/semaphore_h.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <semaphore.h>
+
+#include "header_checks.h"
+
+static void semaphore_h() {
+ TYPE(sem_t);
+
+ MACRO(SEM_FAILED);
+
+ FUNCTION(sem_close, int (*f)(sem_t*));
+ FUNCTION(sem_destroy, int (*f)(sem_t*));
+ FUNCTION(sem_getvalue, int (*f)(sem_t*, int*));
+ FUNCTION(sem_init, int (*f)(sem_t*, int, unsigned));
+ FUNCTION(sem_open, sem_t* (*f)(const char*, int, ...));
+ FUNCTION(sem_post, int (*f)(sem_t*));
+ FUNCTION(sem_timedwait, int (*f)(sem_t*, const struct timespec*));
+ FUNCTION(sem_trywait, int (*f)(sem_t*));
+ FUNCTION(sem_unlink, int (*f)(const char*));
+ FUNCTION(sem_wait, int (*f)(sem_t*));
+}
diff --git a/tests/headers/posix/setjmp_h.c b/tests/headers/posix/setjmp_h.c
new file mode 100644
index 0000000..b6b75ee
--- /dev/null
+++ b/tests/headers/posix/setjmp_h.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <setjmp.h>
+
+#include "header_checks.h"
+
+static void setjmp_h() {
+ TYPE(jmp_buf);
+ TYPE(sigjmp_buf);
+
+ FUNCTION(_longjmp, void (*f)(jmp_buf, int));
+ FUNCTION(longjmp, void (*f)(jmp_buf, int));
+ FUNCTION(siglongjmp, void (*f)(sigjmp_buf, int));
+
+ FUNCTION(_setjmp, int (*f)(jmp_buf));
+ FUNCTION(setjmp, int (*f)(jmp_buf));
+#if defined(__GLIBC__)
+ FUNCTION(__sigsetjmp, int (*f)(sigjmp_buf, int));
+#else
+ FUNCTION(sigsetjmp, int (*f)(sigjmp_buf, int));
+#endif
+}
diff --git a/tests/headers/posix/signal_h.c b/tests/headers/posix/signal_h.c
new file mode 100644
index 0000000..dbfacb1
--- /dev/null
+++ b/tests/headers/posix/signal_h.c
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <signal.h>
+
+#include "header_checks.h"
+
+static void signal_h() {
+ void (*h)(int);
+ h = SIG_DFL;
+ h = SIG_ERR;
+ h = SIG_HOLD;
+ h = SIG_IGN;
+
+ TYPE(pthread_t);
+ TYPE(size_t);
+ TYPE(uid_t);
+
+ TYPE(struct timespec);
+
+ TYPE(sig_atomic_t);
+ TYPE(pid_t);
+
+ TYPE(pthread_attr_t);
+
+ TYPE(struct sigevent);
+ STRUCT_MEMBER(struct sigevent, int, sigev_notify);
+ STRUCT_MEMBER(struct sigevent, int, sigev_signo);
+ STRUCT_MEMBER(struct sigevent, union sigval, sigev_value);
+ STRUCT_MEMBER_FUNCTION_POINTER(struct sigevent, void (*f)(union sigval), sigev_notify_function);
+#if defined(__BIONIC__) || defined(__GLIBC__)
+ STRUCT_MEMBER(struct sigevent, void*, sigev_notify_attributes);
+#else
+ STRUCT_MEMBER(struct sigevent, pthread_attr_t*, sigev_notify_attributes);
+#endif
+
+ MACRO(SIGEV_NONE);
+ MACRO(SIGEV_SIGNAL);
+ MACRO(SIGEV_THREAD);
+
+ TYPE(union sigval);
+ STRUCT_MEMBER(union sigval, int, sival_int);
+ STRUCT_MEMBER(union sigval, void*, sival_ptr);
+
+ int i;
+ i = SIGRTMIN;
+ i = SIGRTMAX;
+
+ MACRO(SIGABRT);
+ MACRO(SIGALRM);
+ MACRO(SIGBUS);
+ MACRO(SIGCHLD);
+ MACRO(SIGCONT);
+ MACRO(SIGFPE);
+ MACRO(SIGHUP);
+ MACRO(SIGILL);
+ MACRO(SIGINT);
+ MACRO(SIGKILL);
+ MACRO(SIGPIPE);
+ MACRO(SIGQUIT);
+ MACRO(SIGSEGV);
+ MACRO(SIGSTOP);
+ MACRO(SIGTERM);
+ MACRO(SIGTSTP);
+ MACRO(SIGTTIN);
+ MACRO(SIGTTOU);
+ MACRO(SIGUSR1);
+ MACRO(SIGUSR2);
+ MACRO(SIGPOLL);
+ MACRO(SIGPROF);
+ MACRO(SIGSYS);
+ MACRO(SIGTRAP);
+ MACRO(SIGURG);
+ MACRO(SIGVTALRM);
+ MACRO(SIGXCPU);
+ MACRO(SIGXFSZ);
+
+ TYPE(struct sigaction);
+ STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int), sa_handler);
+ STRUCT_MEMBER(struct sigaction, sigset_t, sa_mask);
+#if defined(__BIONIC__)
+#if defined(__LP64__)
+ STRUCT_MEMBER(struct sigaction, unsigned int, sa_flags); // TODO: easily fixed!
+#else
+ STRUCT_MEMBER(struct sigaction, unsigned long, sa_flags);
+#endif
+#else
+ STRUCT_MEMBER(struct sigaction, int, sa_flags);
+#endif
+ STRUCT_MEMBER_FUNCTION_POINTER(struct sigaction, void (*f)(int, siginfo_t*, void*), sa_sigaction);
+
+ i = SIG_BLOCK;
+ i = SIG_UNBLOCK;
+ i = SIG_SETMASK;
+
+ MACRO(SA_NOCLDSTOP);
+ MACRO(SA_ONSTACK);
+ MACRO(SA_RESETHAND);
+ MACRO(SA_RESTART);
+ MACRO(SA_SIGINFO);
+ MACRO(SA_NOCLDWAIT);
+ MACRO(SA_NODEFER);
+
+ MACRO(SS_ONSTACK);
+ MACRO(SS_DISABLE);
+
+ MACRO(MINSIGSTKSZ);
+ MACRO(SIGSTKSZ);
+
+ TYPE(mcontext_t);
+
+ TYPE(ucontext_t);
+ STRUCT_MEMBER(ucontext_t, ucontext_t*, uc_link);
+ STRUCT_MEMBER(ucontext_t, sigset_t, uc_sigmask);
+ STRUCT_MEMBER(ucontext_t, stack_t, uc_stack);
+ STRUCT_MEMBER(ucontext_t, mcontext_t, uc_mcontext);
+
+ TYPE(stack_t);
+ STRUCT_MEMBER(stack_t, void*, ss_sp);
+ STRUCT_MEMBER(stack_t, size_t, ss_size);
+ STRUCT_MEMBER(stack_t, int, ss_flags);
+
+ TYPE(siginfo_t);
+ STRUCT_MEMBER(siginfo_t, int, si_signo);
+ STRUCT_MEMBER(siginfo_t, int, si_code);
+ STRUCT_MEMBER(siginfo_t, int, si_errno);
+ STRUCT_MEMBER(siginfo_t, pid_t, si_pid);
+ STRUCT_MEMBER(siginfo_t, uid_t, si_uid);
+ STRUCT_MEMBER(siginfo_t, void*, si_addr);
+ STRUCT_MEMBER(siginfo_t, int, si_status);
+ STRUCT_MEMBER(siginfo_t, long, si_band);
+ STRUCT_MEMBER(siginfo_t, union sigval, si_value);
+
+ i = ILL_ILLOPC;
+ i = ILL_ILLOPN;
+ i = ILL_ILLADR;
+ i = ILL_ILLTRP;
+ i = ILL_PRVOPC;
+ i = ILL_PRVREG;
+ i = ILL_COPROC;
+ i = ILL_BADSTK;
+
+ i = FPE_INTDIV;
+ i = FPE_INTOVF;
+ i = FPE_FLTDIV;
+ i = FPE_FLTOVF;
+ i = FPE_FLTUND;
+ i = FPE_FLTRES;
+ i = FPE_FLTINV;
+ i = FPE_FLTSUB;
+
+ i = SEGV_MAPERR;
+ i = SEGV_ACCERR;
+
+ i = BUS_ADRALN;
+ i = BUS_ADRERR;
+ i = BUS_OBJERR;
+
+ i = TRAP_BRKPT;
+ i = TRAP_TRACE;
+
+ i = CLD_EXITED;
+ i = CLD_KILLED;
+ i = CLD_DUMPED;
+ i = CLD_TRAPPED;
+ i = CLD_STOPPED;
+ i = CLD_CONTINUED;
+
+ i = POLL_IN;
+ i = POLL_OUT;
+ i = POLL_MSG;
+ i = POLL_ERR;
+ i = POLL_PRI;
+ i = POLL_HUP;
+
+ i = SI_USER;
+ i = SI_QUEUE;
+ i = SI_TIMER;
+ i = SI_ASYNCIO;
+ i = SI_MESGQ;
+
+ typedef void (*signal_handler_type)(int);
+
+ FUNCTION(kill, int (*f)(pid_t, int));
+ FUNCTION(killpg, int (*f)(pid_t, int));
+ FUNCTION(psiginfo, void (*f)(const siginfo_t*, const char*));
+ FUNCTION(psignal, void (*f)(int, const char*));
+ FUNCTION(pthread_kill, int (*f)(pthread_t, int));
+ FUNCTION(pthread_sigmask, int (*f)(int, const sigset_t*, sigset_t*));
+ FUNCTION(raise, int (*f)(int));
+ FUNCTION(sigaction, int (*f)(int, const struct sigaction*, struct sigaction*));
+ FUNCTION(sigaddset, int (*f)(sigset_t*, int));
+ FUNCTION(sigaltstack, int (*f)(const stack_t*, stack_t*));
+ FUNCTION(sigdelset, int (*f)(sigset_t*, int));
+ FUNCTION(sigemptyset, int (*f)(sigset_t*));
+ FUNCTION(sigfillset, int (*f)(sigset_t*));
+ FUNCTION(sighold, int (*f)(int));
+ FUNCTION(sigignore, int (*f)(int));
+ FUNCTION(siginterrupt, int (*f)(int, int));
+ FUNCTION(sigismember, int (*f)(const sigset_t*, int));
+ FUNCTION(signal, signal_handler_type (*f)(int, signal_handler_type));
+ FUNCTION(sigpause, int (*f)(int));
+ FUNCTION(sigpending, int (*f)(sigset_t*));
+ FUNCTION(sigprocmask, int (*f)(int, const sigset_t*, sigset_t*));
+ FUNCTION(sigqueue, int (*f)(pid_t, int, union sigval));
+ FUNCTION(sigrelse, int (*f)(int));
+ FUNCTION(sigset, signal_handler_type (*f)(int, signal_handler_type));
+ FUNCTION(sigsuspend, int (*f)(const sigset_t*));
+ FUNCTION(sigtimedwait, int (*f)(const sigset_t*, siginfo_t*, const struct timespec*));
+ FUNCTION(sigwait, int (*f)(const sigset_t*, int*));
+ FUNCTION(sigwaitinfo, int (*f)(const sigset_t*, siginfo_t*));
+}
diff --git a/tests/headers/posix/spawn_h.c b/tests/headers/posix/spawn_h.c
new file mode 100644
index 0000000..48f8390
--- /dev/null
+++ b/tests/headers/posix/spawn_h.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <spawn.h>
+
+#include "header_checks.h"
+
+static void spawn_h() {
+ TYPE(posix_spawnattr_t);
+ TYPE(posix_spawn_file_actions_t);
+
+ TYPE(mode_t);
+ TYPE(pid_t);
+
+ TYPE(sigset_t);
+
+ TYPE(struct sched_param*);
+
+ MACRO(POSIX_SPAWN_RESETIDS);
+ MACRO(POSIX_SPAWN_SETPGROUP);
+ MACRO(POSIX_SPAWN_SETSCHEDPARAM);
+ MACRO(POSIX_SPAWN_SETSCHEDULER);
+ MACRO(POSIX_SPAWN_SETSIGDEF);
+ MACRO(POSIX_SPAWN_SETSIGMASK);
+
+ FUNCTION(posix_spawn, int (*f)(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const[], char* const[]));
+ FUNCTION(posix_spawn_file_actions_addclose, int (*f)(posix_spawn_file_actions_t*, int));
+ FUNCTION(posix_spawn_file_actions_adddup2, int (*f)(posix_spawn_file_actions_t*, int, int));
+ FUNCTION(posix_spawn_file_actions_addopen, int (*f)(posix_spawn_file_actions_t*, int, const char*, int, mode_t));
+ FUNCTION(posix_spawn_file_actions_destroy, int (*f)(posix_spawn_file_actions_t*));
+ FUNCTION(posix_spawn_file_actions_init, int (*f)(posix_spawn_file_actions_t*));
+ FUNCTION(posix_spawnattr_destroy, int (*f)(posix_spawnattr_t*));
+ FUNCTION(posix_spawnattr_getflags, int (*f)(const posix_spawnattr_t*, short*));
+ FUNCTION(posix_spawnattr_getpgroup, int (*f)(const posix_spawnattr_t*, pid_t*));
+ FUNCTION(posix_spawnattr_getschedparam, int (*f)(const posix_spawnattr_t*, struct sched_param*));
+ FUNCTION(posix_spawnattr_getschedpolicy, int (*f)(const posix_spawnattr_t*, int*));
+ FUNCTION(posix_spawnattr_getsigdefault, int (*f)(const posix_spawnattr_t*, sigset_t*));
+ FUNCTION(posix_spawnattr_getsigmask, int (*f)(const posix_spawnattr_t*, sigset_t*));
+ FUNCTION(posix_spawnattr_init, int (*f)(posix_spawnattr_t*));
+ FUNCTION(posix_spawnattr_setflags, int (*f)(posix_spawnattr_t*, short));
+ FUNCTION(posix_spawnattr_setpgroup, int (*f)(posix_spawnattr_t*, pid_t));
+ FUNCTION(posix_spawnattr_setschedparam, int (*f)(posix_spawnattr_t*, const struct sched_param*));
+ FUNCTION(posix_spawnattr_setsigdefault, int (*f)(posix_spawnattr_t*, const sigset_t*));
+ FUNCTION(posix_spawnattr_setsigmask, int (*f)(posix_spawnattr_t*, const sigset_t*));
+ FUNCTION(posix_spawnp, int (*f)(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const[], char* const[]));
+}
diff --git a/tests/headers/posix/stdarg_h.c b/tests/headers/posix/stdarg_h.c
new file mode 100644
index 0000000..ef1e8af
--- /dev/null
+++ b/tests/headers/posix/stdarg_h.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <stdarg.h>
+
+#include "header_checks.h"
+
+static void stdarg_h() {
+ TYPE(va_list);
+
+#if !defined(va_start)
+#error va_start
+#endif
+#if !defined(va_copy)
+#error va_copy
+#endif
+#if !defined(va_arg)
+#error va_arg
+#endif
+#if !defined(va_end)
+#error va_end
+#endif
+}
diff --git a/tests/headers/posix/stdbool_h.c b/tests/headers/posix/stdbool_h.c
new file mode 100644
index 0000000..f891a73
--- /dev/null
+++ b/tests/headers/posix/stdbool_h.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <stdbool.h>
+
+#include "header_checks.h"
+
+static void stdbool_h() {
+#if !defined(bool)
+#error bool
+#endif
+ MACRO_VALUE(true, 1);
+ MACRO_VALUE(false, 0);
+ MACRO_VALUE(__bool_true_false_are_defined, 1);
+}
diff --git a/tests/headers/posix/stddef_h.c b/tests/headers/posix/stddef_h.c
new file mode 100644
index 0000000..7cdfd76
--- /dev/null
+++ b/tests/headers/posix/stddef_h.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <stddef.h>
+
+#include "header_checks.h"
+
+static void stddef_h() {
+ void* null = NULL;
+
+#if !defined(offsetof)
+#error offsetof
+#endif
+
+ TYPE(ptrdiff_t);
+ TYPE(wchar_t);
+ TYPE(size_t);
+}
diff --git a/tests/headers/posix/stdint_h.c b/tests/headers/posix/stdint_h.c
new file mode 100644
index 0000000..a8f3346
--- /dev/null
+++ b/tests/headers/posix/stdint_h.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <stdint.h>
+
+#include "header_checks.h"
+
+static void stdint_h() {
+ TYPE(int8_t);
+ TYPE(int16_t);
+ TYPE(int32_t);
+ TYPE(uint8_t);
+ TYPE(uint16_t);
+ TYPE(uint32_t);
+
+ TYPE(int64_t);
+ TYPE(uint64_t);
+
+ TYPE(int_least8_t);
+ TYPE(int_least16_t);
+ TYPE(int_least32_t);
+ TYPE(int_least64_t);
+ TYPE(uint_least8_t);
+ TYPE(uint_least16_t);
+ TYPE(uint_least32_t);
+ TYPE(uint_least64_t);
+
+ TYPE(int_fast8_t);
+ TYPE(int_fast16_t);
+ TYPE(int_fast32_t);
+ TYPE(int_fast64_t);
+ TYPE(uint_fast8_t);
+ TYPE(uint_fast16_t);
+ TYPE(uint_fast32_t);
+ TYPE(uint_fast64_t);
+
+ TYPE(intptr_t);
+ TYPE(uintptr_t);
+
+ TYPE(intmax_t);
+ TYPE(uintmax_t);
+
+ MACRO(INT8_MIN);
+ MACRO(INT16_MIN);
+ MACRO(INT32_MIN);
+ MACRO(INT64_MIN);
+ MACRO(INT8_MAX);
+ MACRO(INT16_MAX);
+ MACRO(INT32_MAX);
+ MACRO(INT64_MAX);
+ MACRO(UINT8_MAX);
+ MACRO(UINT16_MAX);
+ MACRO(UINT32_MAX);
+ MACRO(UINT64_MAX);
+
+ MACRO(INT_LEAST8_MIN);
+ MACRO(INT_LEAST16_MIN);
+ MACRO(INT_LEAST32_MIN);
+ MACRO(INT_LEAST64_MIN);
+ MACRO(INT_LEAST8_MAX);
+ MACRO(INT_LEAST16_MAX);
+ MACRO(INT_LEAST32_MAX);
+ MACRO(INT_LEAST64_MAX);
+ MACRO(UINT_LEAST8_MAX);
+ MACRO(UINT_LEAST16_MAX);
+ MACRO(UINT_LEAST32_MAX);
+ MACRO(UINT_LEAST64_MAX);
+
+ MACRO(INT_FAST8_MIN);
+ MACRO(INT_FAST16_MIN);
+ MACRO(INT_FAST32_MIN);
+ MACRO(INT_FAST64_MIN);
+ MACRO(INT_FAST8_MAX);
+ MACRO(INT_FAST16_MAX);
+ MACRO(INT_FAST32_MAX);
+ MACRO(INT_FAST64_MAX);
+ MACRO(UINT_FAST8_MAX);
+ MACRO(UINT_FAST16_MAX);
+ MACRO(UINT_FAST32_MAX);
+ MACRO(UINT_FAST64_MAX);
+
+ MACRO(INTPTR_MIN);
+ MACRO(INTPTR_MAX);
+ MACRO(UINTPTR_MAX);
+
+ MACRO(INTMAX_MIN);
+ MACRO(INTMAX_MAX);
+ MACRO(UINTMAX_MAX);
+
+ MACRO(PTRDIFF_MIN);
+ MACRO(PTRDIFF_MAX);
+
+ MACRO(SIG_ATOMIC_MIN);
+ MACRO(SIG_ATOMIC_MAX);
+
+ MACRO(SIZE_MAX);
+
+ MACRO(WCHAR_MIN);
+ MACRO(WCHAR_MAX);
+
+ MACRO(WINT_MIN);
+ MACRO(WINT_MAX);
+
+#if !defined(INT8_C)
+#error INT8_C
+#endif
+#if !defined(INT16_C)
+#error INT16_C
+#endif
+#if !defined(INT32_C)
+#error INT32_C
+#endif
+#if !defined(INT32_C)
+#error INT32_C
+#endif
+
+#if !defined(UINT8_C)
+#error UINT8_C
+#endif
+#if !defined(UINT16_C)
+#error UINT16_C
+#endif
+#if !defined(UINT32_C)
+#error UINT32_C
+#endif
+#if !defined(UINT32_C)
+#error UINT32_C
+#endif
+
+#if !defined(INTMAX_C)
+#error INTMAX_C
+#endif
+#if !defined(UINTMAX_C)
+#error UINTMAX_C
+#endif
+}
diff --git a/tests/headers/posix/stdio_h.c b/tests/headers/posix/stdio_h.c
new file mode 100644
index 0000000..cbeb0bc
--- /dev/null
+++ b/tests/headers/posix/stdio_h.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <stdio.h>
+
+#include "header_checks.h"
+
+static void stdio_h() {
+ TYPE(FILE*);
+ TYPE(fpos_t);
+ TYPE(off_t);
+ TYPE(size_t);
+ TYPE(ssize_t);
+ TYPE(va_list);
+
+ MACRO(BUFSIZ);
+ MACRO(L_ctermid);
+ MACRO(L_tmpnam);
+
+ MACRO(_IOFBF);
+ MACRO(_IOLBF);
+ MACRO(_IONBF);
+
+ MACRO(SEEK_CUR);
+ MACRO(SEEK_END);
+ MACRO(SEEK_SET);
+
+ MACRO(FILENAME_MAX);
+ MACRO(FOPEN_MAX);
+ MACRO(TMP_MAX);
+
+ MACRO(EOF);
+
+ MACRO(NULL);
+
+ const char* s;
+ s = P_tmpdir;
+
+#if !defined(stderr)
+#error stderr
+#endif
+#if !defined(stdin)
+#error stdin
+#endif
+#if !defined(stdout)
+#error stdout
+#endif
+ FILE* fp;
+ fp = stderr;
+ fp = stdin;
+ fp = stdout;
+
+ FUNCTION(clearerr, void (*f)(FILE*));
+ FUNCTION(ctermid, char* (*f)(char*));
+ FUNCTION(dprintf, int (*f)(int, const char*, ...));
+ FUNCTION(fclose, int (*f)(FILE*));
+ FUNCTION(fdopen, FILE* (*f)(int, const char*));
+ FUNCTION(feof, int (*f)(FILE*));
+ FUNCTION(ferror, int (*f)(FILE*));
+ FUNCTION(fflush, int (*f)(FILE*));
+ FUNCTION(fgetc, int (*f)(FILE*));
+ FUNCTION(fgetpos, int (*f)(FILE*, fpos_t*));
+ FUNCTION(fgets, char* (*f)(char*, int, FILE*));
+ FUNCTION(fileno, int (*f)(FILE*));
+ FUNCTION(flockfile, void (*f)(FILE*));
+ FUNCTION(fmemopen, FILE* (*f)(void*, size_t, const char*));
+ FUNCTION(fopen, FILE* (*f)(const char*, const char*));
+ FUNCTION(fprintf, int (*f)(FILE*, const char*, ...));
+ FUNCTION(fputc, int (*f)(int, FILE*));
+ FUNCTION(fputs, int (*f)(const char*, FILE*));
+ FUNCTION(fread, size_t (*f)(void*, size_t, size_t, FILE*));
+ FUNCTION(freopen, FILE* (*f)(const char*, const char*, FILE*));
+ FUNCTION(fscanf, int (*f)(FILE*, const char*, ...));
+ FUNCTION(fseek, int (*f)(FILE*, long, int));
+ FUNCTION(fseeko, int (*f)(FILE*, off_t, int));
+ FUNCTION(fsetpos, int (*f)(FILE*, const fpos_t*));
+ FUNCTION(ftell, long (*f)(FILE*));
+ FUNCTION(ftello, off_t (*f)(FILE*));
+ FUNCTION(ftrylockfile, int (*f)(FILE*));
+ FUNCTION(funlockfile, void (*f)(FILE*));
+ FUNCTION(fwrite, size_t (*f)(const void*, size_t, size_t, FILE*));
+ FUNCTION(getc, int (*f)(FILE*));
+ FUNCTION(getchar, int (*f)(void));
+ FUNCTION(getc_unlocked, int (*f)(FILE*));
+ FUNCTION(getchar_unlocked, int (*f)(void));
+ FUNCTION(getdelim, ssize_t (*f)(char**, size_t*, int, FILE*));
+ FUNCTION(getline, ssize_t (*f)(char**, size_t*, FILE*));
+ FUNCTION(gets, char* (*f)(char*));
+ FUNCTION(open_memstream, FILE* (*f)(char**, size_t*));
+ FUNCTION(pclose, int (*f)(FILE*));
+ FUNCTION(perror, void (*f)(const char*));
+ FUNCTION(popen, FILE* (*f)(const char*, const char*));
+ FUNCTION(printf, int (*f)(const char*, ...));
+ FUNCTION(putc, int (*f)(int, FILE*));
+ FUNCTION(putchar, int (*f)(int));
+ FUNCTION(putc_unlocked, int (*f)(int, FILE*));
+ FUNCTION(putchar_unlocked, int (*f)(int));
+ FUNCTION(puts, int (*f)(const char*));
+ FUNCTION(remove, int (*f)(const char*));
+ FUNCTION(rename, int (*f)(const char*, const char*));
+ FUNCTION(renameat, int (*f)(int, const char*, int, const char*));
+ FUNCTION(rewind, void (*f)(FILE*));
+ FUNCTION(scanf, int (*f)(const char*, ...));
+ FUNCTION(setbuf, void (*f)(FILE*, char*));
+ FUNCTION(setvbuf, int (*f)(FILE*, char*, int, size_t));
+ FUNCTION(snprintf, int (*f)(char*, size_t, const char*, ...));
+ FUNCTION(sprintf, int (*f)(char*, const char*, ...));
+ FUNCTION(sscanf, int (*f)(const char*, const char*, ...));
+ FUNCTION(tempnam, char* (*f)(const char*, const char*));
+ FUNCTION(tmpfile, FILE* (*f)(void));
+ FUNCTION(tmpnam, char* (*f)(char*));
+ FUNCTION(ungetc, int (*f)(int, FILE*));
+ FUNCTION(vdprintf, int (*f)(int, const char*, va_list));
+ FUNCTION(vfprintf, int (*f)(FILE*, const char*, va_list));
+ FUNCTION(vfscanf, int (*f)(FILE*, const char*, va_list));
+ FUNCTION(vprintf, int (*f)(const char*, va_list));
+ FUNCTION(vscanf, int (*f)(const char*, va_list));
+ FUNCTION(vsnprintf, int (*f)(char*, size_t, const char*, va_list));
+ FUNCTION(vsprintf, int (*f)(char*, const char*, va_list));
+ FUNCTION(vsscanf, int (*f)(const char*, const char*, va_list));
+}
diff --git a/tests/headers/posix/stdlib_h.c b/tests/headers/posix/stdlib_h.c
new file mode 100644
index 0000000..52580cf
--- /dev/null
+++ b/tests/headers/posix/stdlib_h.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <stdlib.h>
+
+#include "header_checks.h"
+
+static void stdlib_h() {
+ MACRO(EXIT_FAILURE);
+ MACRO_VALUE(EXIT_SUCCESS, 0);
+
+ MACRO(RAND_MAX);
+
+ MACRO(MB_CUR_MAX);
+
+ MACRO(NULL);
+
+ TYPE(div_t);
+ TYPE(ldiv_t);
+ TYPE(lldiv_t);
+ TYPE(size_t);
+ TYPE(wchar_t);
+
+#if !defined(WEXITSTATUS)
+#error WEXITSTATUS
+#endif
+#if !defined(WIFEXITED)
+#error WIFEXITED
+#endif
+#if !defined(WIFSIGNALED)
+#error WIFSIGNALED
+#endif
+#if !defined(WIFSTOPPED)
+#error WIFSTOPPED
+#endif
+ MACRO(WNOHANG);
+#if !defined(WSTOPSIG)
+#error WSTOPSIG
+#endif
+#if !defined(WTERMSIG)
+#error WTERMSIG
+#endif
+ MACRO(WUNTRACED);
+
+ FUNCTION(_Exit, void (*f)(int));
+#if !defined(__BIONIC__)
+ FUNCTION(a64l, long (*f)(const char*));
+#endif
+ FUNCTION(abort, void (*f)(void));
+ FUNCTION(abs, int (*f)(int));
+ FUNCTION(atexit, int (*f)(void (*)(void)));
+ FUNCTION(atof, double (*f)(const char*));
+ FUNCTION(atoi, int (*f)(const char*));
+ FUNCTION(atol, long (*f)(const char*));
+ FUNCTION(atoll, long long (*f)(const char*));
+ FUNCTION(bsearch, void* (*f)(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)));
+ FUNCTION(calloc, void* (*f)(size_t, size_t));
+ FUNCTION(div, div_t (*f)(int, int));
+ FUNCTION(drand48, double (*f)(void));
+ FUNCTION(erand48, double (*f)(unsigned short[3]));
+ FUNCTION(exit, void (*f)(int));
+ FUNCTION(free, void (*f)(void*));
+ FUNCTION(getenv, char* (*f)(const char*));
+ FUNCTION(getsubopt, int (*f)(char**, char* const*, char**));
+ FUNCTION(grantpt, int (*f)(int));
+ FUNCTION(initstate, char* (*f)(unsigned, char*, size_t));
+ FUNCTION(jrand48, long (*f)(unsigned short[3]));
+#if !defined(__BIONIC__)
+ FUNCTION(l64a, char* (*f)(long));
+#endif
+ FUNCTION(labs, long (*f)(long));
+ FUNCTION(lcong48, void (*f)(unsigned short[7]));
+ FUNCTION(ldiv, ldiv_t (*f)(long, long));
+ FUNCTION(llabs, long long (*f)(long long));
+ FUNCTION(lldiv, lldiv_t (*f)(long long, long long));
+ FUNCTION(lrand48, long (*f)(void));
+ FUNCTION(malloc, void* (*f)(size_t));
+ FUNCTION(mblen, int (*f)(const char*, size_t));
+ FUNCTION(mbstowcs, size_t (*f)(wchar_t*, const char*, size_t));
+ FUNCTION(mbtowc, int (*f)(wchar_t*, const char*, size_t));
+ FUNCTION(mkdtemp, char* (*f)(char*));
+ FUNCTION(mkstemp, int (*f)(char*));
+ FUNCTION(mrand48, long (*f)(void));
+ FUNCTION(nrand48, long (*f)(unsigned short[3]));
+ FUNCTION(posix_memalign, int (*f)(void**, size_t, size_t));
+ FUNCTION(posix_openpt, int (*f)(int));
+ FUNCTION(ptsname, char* (*f)(int));
+ FUNCTION(putenv, int (*f)(char*));
+ FUNCTION(qsort, void (*f)(void*, size_t, size_t, int (*)(const void*, const void*)));
+ FUNCTION(rand, int (*f)(void));
+ FUNCTION(rand_r, int (*f)(unsigned*));
+ FUNCTION(random, long (*f)(void));
+ FUNCTION(realloc, void* (*f)(void*, size_t));
+ FUNCTION(realpath, char* (*f)(const char*, char*));
+ FUNCTION(seed48, unsigned short* (*f)(unsigned short[3]));
+ FUNCTION(setenv, int (*f)(const char*, const char*, int));
+#if !defined(__BIONIC__)
+ FUNCTION(setkey, void (*f)(const char*));
+#endif
+ FUNCTION(setstate, char* (*f)(char*));
+ FUNCTION(srand, void (*f)(unsigned));
+ FUNCTION(srand48, void (*f)(long));
+ FUNCTION(srandom, void (*f)(unsigned));
+ FUNCTION(strtod, double (*f)(const char*, char**));
+ FUNCTION(strtof, float (*f)(const char*, char**));
+ FUNCTION(strtol, long (*f)(const char*, char**, int));
+ FUNCTION(strtold, long double (*f)(const char*, char**));
+ FUNCTION(strtoll, long long (*f)(const char*, char**, int));
+ FUNCTION(strtoul, unsigned long (*f)(const char*, char**, int));
+ FUNCTION(strtoull, unsigned long long (*f)(const char*, char**, int));
+ FUNCTION(system, int (*f)(const char*));
+ FUNCTION(unlockpt, int (*f)(int));
+ FUNCTION(unsetenv, int (*f)(const char*));
+ FUNCTION(wcstombs, size_t (*f)(char*, const wchar_t*, size_t));
+ FUNCTION(wctomb, int (*f)(char*, wchar_t));
+}
diff --git a/tests/headers/posix/string_h.c b/tests/headers/posix/string_h.c
new file mode 100644
index 0000000..2440050
--- /dev/null
+++ b/tests/headers/posix/string_h.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <string.h>
+
+#include "header_checks.h"
+
+static void string_h() {
+ MACRO(NULL);
+ TYPE(size_t);
+ TYPE(locale_t);
+
+ FUNCTION(memccpy, void* (*f)(void*, const void*, int, size_t));
+ FUNCTION(memchr, void* (*f)(const void*, int, size_t));
+ FUNCTION(memcmp, int (*f)(const void*, const void*, size_t));
+ FUNCTION(memcpy, void* (*f)(void*, const void*, size_t));
+ FUNCTION(memmove, void* (*f)(void*, const void*, size_t));
+ FUNCTION(memset, void* (*f)(void*, int, size_t));
+ FUNCTION(stpcpy, char* (*f)(char*, const char*));
+ FUNCTION(stpncpy, char* (*f)(char*, const char*, size_t));
+ FUNCTION(strcat, char* (*f)(char*, const char*));
+ FUNCTION(strchr, char* (*f)(const char*, int));
+ FUNCTION(strcmp, int (*f)(const char*, const char*));
+ FUNCTION(strcoll, int (*f)(const char*, const char*));
+ FUNCTION(strcoll_l, int (*f)(const char*, const char*, locale_t));
+ FUNCTION(strcpy, char* (*f)(char*, const char*));
+ FUNCTION(strcspn, size_t (*f)(const char*, const char*));
+ FUNCTION(strdup, char* (*f)(const char*));
+ FUNCTION(strerror, char* (*f)(int));
+ FUNCTION(strerror_l, char* (*f)(int, locale_t));
+ FUNCTION(strerror_r, int (*f)(int, char*, size_t));
+ FUNCTION(strlen, size_t (*f)(const char*));
+ FUNCTION(strncat, char* (*f)(char*, const char*, size_t));
+ FUNCTION(strncmp, int (*f)(const char*, const char*, size_t));
+ FUNCTION(strncpy, char* (*f)(char*, const char*, size_t));
+ FUNCTION(strndup, char* (*f)(const char*, size_t));
+ FUNCTION(strnlen, size_t (*f)(const char*, size_t));
+ FUNCTION(strpbrk, char* (*f)(const char*, const char*));
+ FUNCTION(strrchr, char* (*f)(const char*, int));
+ FUNCTION(strsignal, char* (*f)(int));
+ FUNCTION(strspn, size_t (*f)(const char*, const char*));
+ FUNCTION(strstr, char* (*f)(const char*, const char*));
+ FUNCTION(strtok, char* (*f)(char*, const char*));
+ FUNCTION(strtok_r, char* (*f)(char*, const char*, char**));
+ FUNCTION(strxfrm, size_t (*f)(char*, const char*, size_t));
+ FUNCTION(strxfrm_l, size_t (*f)(char*, const char*, size_t, locale_t));
+}
diff --git a/tests/headers/posix/strings_h.c b/tests/headers/posix/strings_h.c
new file mode 100644
index 0000000..0a2fa84
--- /dev/null
+++ b/tests/headers/posix/strings_h.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <strings.h>
+
+#include "header_checks.h"
+
+static void strings_h() {
+ FUNCTION(ffs, int (*f)(int));
+ FUNCTION(strcasecmp, int (*f)(const char*, const char*));
+ FUNCTION(strcasecmp_l, int (*f)(const char*, const char*, locale_t));
+ FUNCTION(strncasecmp, int (*f)(const char*, const char*, size_t));
+ FUNCTION(strncasecmp_l, int (*f)(const char*, const char*, size_t, locale_t));
+
+ TYPE(locale_t);
+ TYPE(size_t);
+}
diff --git a/tests/headers/posix/sys_ipc_h.c b/tests/headers/posix/sys_ipc_h.c
new file mode 100644
index 0000000..48273e4
--- /dev/null
+++ b/tests/headers/posix/sys_ipc_h.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/ipc.h>
+
+#include "header_checks.h"
+
+static void sys_ipc_h() {
+ TYPE(struct ipc_perm);
+ STRUCT_MEMBER(struct ipc_perm, uid_t, uid);
+ STRUCT_MEMBER(struct ipc_perm, gid_t, gid);
+ STRUCT_MEMBER(struct ipc_perm, uid_t, cuid);
+ STRUCT_MEMBER(struct ipc_perm, gid_t, cgid);
+#if defined(__GLIBC__)
+ STRUCT_MEMBER(struct ipc_perm, unsigned short, mode);
+#else
+ STRUCT_MEMBER(struct ipc_perm, mode_t, mode);
+#endif
+
+ TYPE(uid_t);
+ TYPE(gid_t);
+ TYPE(mode_t);
+ TYPE(key_t);
+
+ MACRO(IPC_CREAT);
+ MACRO(IPC_EXCL);
+ MACRO(IPC_NOWAIT);
+
+ MACRO(IPC_PRIVATE);
+
+ MACRO(IPC_RMID);
+ MACRO(IPC_SET);
+ MACRO(IPC_STAT);
+
+ FUNCTION(ftok, key_t (*f)(const char*, int));
+}
diff --git a/tests/headers/posix/sys_mman_h.c b/tests/headers/posix/sys_mman_h.c
new file mode 100644
index 0000000..5ec889c
--- /dev/null
+++ b/tests/headers/posix/sys_mman_h.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/mman.h>
+
+#include "header_checks.h"
+
+static void sys_mman_h() {
+ MACRO(PROT_EXEC);
+ MACRO(PROT_NONE);
+ MACRO(PROT_READ);
+ MACRO(PROT_WRITE);
+
+ MACRO(MAP_FIXED);
+ MACRO(MAP_PRIVATE);
+ MACRO(MAP_SHARED);
+
+ MACRO(MS_ASYNC);
+ MACRO(MS_INVALIDATE);
+ MACRO(MS_SYNC);
+
+ MACRO(MCL_CURRENT);
+ MACRO(MCL_FUTURE);
+
+ void* p;
+ p = MAP_FAILED;
+
+ MACRO(POSIX_MADV_DONTNEED);
+ MACRO(POSIX_MADV_NORMAL);
+ MACRO(POSIX_MADV_RANDOM);
+ MACRO(POSIX_MADV_SEQUENTIAL);
+ MACRO(POSIX_MADV_WILLNEED);
+
+#if !defined(__linux__)
+ MACRO(POSIX_TYPED_MEM_ALLOCATE);
+ MACRO(POSIX_TYPED_MEM_ALLOCATE_CONTIG);
+ MACRO(POSIX_TYPED_MEM_ALLOCATABLE);
+#endif
+
+ TYPE(mode_t);
+ TYPE(off_t);
+ TYPE(size_t);
+
+#if !defined(__linux__)
+ TYPE(struct posix_typed_mem_info);
+ STRUCT_MEMBER(struct posix_typed_mem_info, size_t, posix_tmi_length);
+#endif
+
+ FUNCTION(mlock, int (*f)(const void*, size_t));
+ FUNCTION(mlockall, int (*f)(int));
+ FUNCTION(mmap, void* (*f)(void*, size_t, int, int, int, off_t));
+ FUNCTION(mprotect, int (*f)(void*, size_t, int));
+ FUNCTION(msync, int (*f)(void*, size_t, int));
+ FUNCTION(munlock, int (*f)(const void*, size_t));
+ FUNCTION(munlockall, int (*f)(void));
+ FUNCTION(munmap, int (*f)(void*, size_t));
+ FUNCTION(posix_madvise, int (*f)(void*, size_t, int));
+#if !defined(__linux__)
+ FUNCTION(posix_mem_offset, int (*f)(const void*, size_t, off_t*, size_t*, int*));
+ FUNCTION(posix_typed_mem_get_info, int (*f)(int, struct posix_typed_mem_info*));
+ FUNCTION(posix_typed_mem_open, int (*f)(const char*, int, int));
+#endif
+#if !defined(__BIONIC__) // Disallowed by SELinux, so not implemented.
+ FUNCTION(shm_open, int (*f)(const char*, int, mode_t));
+ FUNCTION(shm_unlink, int (*f)(const char*));
+#endif
+}
diff --git a/tests/headers/posix/sys_msg_h.c b/tests/headers/posix/sys_msg_h.c
new file mode 100644
index 0000000..b908188
--- /dev/null
+++ b/tests/headers/posix/sys_msg_h.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/msg.h>
+
+#include "header_checks.h"
+
+static void sys_msg_h() {
+ TYPE(msgqnum_t);
+ TYPE(msglen_t);
+
+ MACRO(MSG_NOERROR);
+
+ TYPE(struct msqid_ds);
+ STRUCT_MEMBER(struct msqid_ds, struct ipc_perm, msg_perm);
+ STRUCT_MEMBER(struct msqid_ds, msgqnum_t, msg_qnum);
+ STRUCT_MEMBER(struct msqid_ds, msglen_t, msg_qbytes);
+ STRUCT_MEMBER(struct msqid_ds, pid_t, msg_lspid);
+ STRUCT_MEMBER(struct msqid_ds, pid_t, msg_lrpid);
+ STRUCT_MEMBER(struct msqid_ds, time_t, msg_stime);
+ STRUCT_MEMBER(struct msqid_ds, time_t, msg_rtime);
+ STRUCT_MEMBER(struct msqid_ds, time_t, msg_ctime);
+
+ TYPE(pid_t);
+ TYPE(size_t);
+ TYPE(ssize_t);
+ TYPE(time_t);
+
+ FUNCTION(msgctl, int (*f)(int, int, struct msqid_ds*));
+ FUNCTION(msgget, int (*f)(key_t, int));
+ FUNCTION(msgrcv, ssize_t (*f)(int, void*, size_t, long, int));
+ FUNCTION(msgsnd, int (*f)(int, const void*, size_t, int));
+}
diff --git a/tests/headers/posix/sys_resource_h.c b/tests/headers/posix/sys_resource_h.c
new file mode 100644
index 0000000..0e95fd5
--- /dev/null
+++ b/tests/headers/posix/sys_resource_h.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/resource.h>
+
+#include "header_checks.h"
+
+static void sys_resource_h() {
+ MACRO(PRIO_PROCESS);
+ MACRO(PRIO_PGRP);
+ MACRO(PRIO_USER);
+
+ TYPE(rlim_t);
+
+ MACRO(RLIM_INFINITY);
+ MACRO(RLIM_SAVED_MAX);
+ MACRO(RLIM_SAVED_CUR);
+
+ MACRO(RUSAGE_SELF);
+ MACRO(RUSAGE_CHILDREN);
+
+ TYPE(struct rlimit);
+ STRUCT_MEMBER(struct rlimit, rlim_t, rlim_cur);
+ STRUCT_MEMBER(struct rlimit, rlim_t, rlim_max);
+
+ TYPE(struct rusage);
+ STRUCT_MEMBER(struct rusage, struct timeval, ru_utime);
+ STRUCT_MEMBER(struct rusage, struct timeval, ru_stime);
+
+ TYPE(struct timeval);
+
+ MACRO(RLIMIT_CORE);
+ MACRO(RLIMIT_CPU);
+ MACRO(RLIMIT_DATA);
+ MACRO(RLIMIT_FSIZE);
+ MACRO(RLIMIT_NOFILE);
+ MACRO(RLIMIT_STACK);
+ MACRO(RLIMIT_AS);
+
+ FUNCTION(getpriority, int (*f)(int, id_t));
+ FUNCTION(getrlimit, int (*f)(int, struct rlimit*));
+ FUNCTION(getrusage, int (*f)(int, struct rusage*));
+ FUNCTION(setpriority, int (*f)(int, id_t, int));
+ FUNCTION(setrlimit, int (*f)(int, const struct rlimit*));
+}
diff --git a/tests/headers/posix/sys_select_h.c b/tests/headers/posix/sys_select_h.c
new file mode 100644
index 0000000..32c6f57
--- /dev/null
+++ b/tests/headers/posix/sys_select_h.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/select.h>
+
+#include "header_checks.h"
+
+static void sys_select_h() {
+ TYPE(struct timeval);
+ STRUCT_MEMBER(struct timeval, time_t, tv_sec);
+ STRUCT_MEMBER(struct timeval, suseconds_t, tv_usec);
+
+ TYPE(time_t);
+ TYPE(suseconds_t);
+
+ TYPE(sigset_t);
+ TYPE(struct timespec);
+ TYPE(fd_set);
+
+ MACRO(FD_SETSIZE);
+
+#if !defined(FD_CLR)
+#error FD_CLR
+#endif
+#if !defined(FD_ISSET)
+#error FD_ISSET
+#endif
+#if !defined(FD_SET)
+#error FD_SET
+#endif
+#if !defined(FD_ZERO)
+#error FD_ZERO
+#endif
+
+ FUNCTION(pselect, int (*f)(int, fd_set*, fd_set*, fd_set*, const struct timespec*, const sigset_t*));
+ FUNCTION(select, int (*f)(int, fd_set*, fd_set*, fd_set*, struct timeval*));
+}
diff --git a/tests/headers/posix/sys_sem_h.c b/tests/headers/posix/sys_sem_h.c
new file mode 100644
index 0000000..1b1b16d
--- /dev/null
+++ b/tests/headers/posix/sys_sem_h.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/sem.h>
+
+#include "header_checks.h"
+
+static void sys_sem_h() {
+ MACRO(SEM_UNDO);
+
+ MACRO(GETNCNT);
+ MACRO(GETPID);
+ MACRO(GETVAL);
+ MACRO(GETALL);
+ MACRO(GETZCNT);
+ MACRO(SETVAL);
+ MACRO(SETALL);
+
+ TYPE(struct semid_ds);
+ STRUCT_MEMBER(struct semid_ds, struct ipc_perm, sem_perm);
+#if defined(__linux__) // POSIX says short, Linux says long.
+ STRUCT_MEMBER(struct semid_ds, unsigned long, sem_nsems);
+#else
+ STRUCT_MEMBER(struct semid_ds, unsigned short, sem_nsems);
+#endif
+ STRUCT_MEMBER(struct semid_ds, time_t, sem_otime);
+ STRUCT_MEMBER(struct semid_ds, time_t, sem_ctime);
+
+ TYPE(pid_t);
+ TYPE(size_t);
+ TYPE(time_t);
+
+ TYPE(struct sembuf);
+ STRUCT_MEMBER(struct sembuf, unsigned short, sem_num);
+ STRUCT_MEMBER(struct sembuf, short, sem_op);
+ STRUCT_MEMBER(struct sembuf, short, sem_flg);
+
+ FUNCTION(semctl, int (*f)(int, int, int, ...));
+ FUNCTION(semget, int (*f)(key_t, int, int));
+ FUNCTION(semop, int (*f)(int, struct sembuf*, size_t));
+}
diff --git a/tests/headers/posix/sys_shm_h.c b/tests/headers/posix/sys_shm_h.c
new file mode 100644
index 0000000..4ecd6d3
--- /dev/null
+++ b/tests/headers/posix/sys_shm_h.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/shm.h>
+
+#include "header_checks.h"
+
+static void sys_shm_h() {
+ MACRO(SHM_RDONLY);
+ MACRO(SHM_RND);
+ MACRO(SHMLBA);
+
+ TYPE(shmatt_t);
+
+ TYPE(struct shmid_ds);
+ STRUCT_MEMBER(struct shmid_ds, struct ipc_perm, shm_perm);
+ STRUCT_MEMBER(struct shmid_ds, size_t, shm_segsz);
+ STRUCT_MEMBER(struct shmid_ds, pid_t, shm_lpid);
+ STRUCT_MEMBER(struct shmid_ds, pid_t, shm_cpid);
+ STRUCT_MEMBER(struct shmid_ds, shmatt_t, shm_nattch);
+ STRUCT_MEMBER(struct shmid_ds, time_t, shm_atime);
+ STRUCT_MEMBER(struct shmid_ds, time_t, shm_dtime);
+ STRUCT_MEMBER(struct shmid_ds, time_t, shm_ctime);
+
+ TYPE(pid_t);
+ TYPE(size_t);
+ TYPE(time_t);
+
+ FUNCTION(shmat, void* (*f)(int, const void*, int));
+ FUNCTION(shmctl, int (*f)(int, int, struct shmid_ds*));
+ FUNCTION(shmdt, int (*f)(const void*));
+ FUNCTION(shmget, int (*f)(key_t, size_t, int));
+}
diff --git a/tests/headers/posix/sys_socket_h.c b/tests/headers/posix/sys_socket_h.c
new file mode 100644
index 0000000..ed437f3
--- /dev/null
+++ b/tests/headers/posix/sys_socket_h.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/socket.h>
+
+#include "header_checks.h"
+
+static void sys_socket_h() {
+ TYPE(socklen_t);
+ TYPE(sa_family_t);
+
+ TYPE(struct sockaddr);
+ STRUCT_MEMBER(struct sockaddr, sa_family_t, sa_family);
+ STRUCT_MEMBER_ARRAY(struct sockaddr, char/*[]*/, sa_data);
+
+ TYPE(struct sockaddr_storage);
+ STRUCT_MEMBER(struct sockaddr_storage, sa_family_t, ss_family);
+
+ TYPE(struct msghdr);
+ STRUCT_MEMBER(struct msghdr, void*, msg_name);
+ STRUCT_MEMBER(struct msghdr, socklen_t, msg_namelen);
+ STRUCT_MEMBER(struct msghdr, struct iovec*, msg_iov);
+#if defined(__BIONIC__) || defined(__GLIBC__)
+ STRUCT_MEMBER(struct msghdr, size_t, msg_iovlen);
+#else
+ STRUCT_MEMBER(struct msghdr, int, msg_iovlen);
+#endif
+ STRUCT_MEMBER(struct msghdr, void*, msg_control);
+#if defined(__BIONIC__) || defined(__GLIBC__)
+ STRUCT_MEMBER(struct msghdr, size_t, msg_controllen);
+#else
+ STRUCT_MEMBER(struct msghdr, socklen_t, msg_controllen);
+#endif
+ STRUCT_MEMBER(struct msghdr, int, msg_flags);
+
+ TYPE(struct iovec);
+
+ TYPE(struct cmsghdr);
+#if defined(__BIONIC__) || defined(__GLIBC__)
+ STRUCT_MEMBER(struct cmsghdr, size_t, cmsg_len);
+#else
+ STRUCT_MEMBER(struct cmsghdr, socklen_t, cmsg_len);
+#endif
+ STRUCT_MEMBER(struct cmsghdr, int, cmsg_level);
+ STRUCT_MEMBER(struct cmsghdr, int, cmsg_type);
+
+ MACRO(SCM_RIGHTS);
+
+#if !defined(CMSG_DATA)
+#error CMSG_DATA
+#endif
+#if !defined(CMSG_NXTHDR)
+#error CMSG_NXTHDR
+#endif
+#if !defined(CMSG_FIRSTHDR)
+#error CMSG_FIRSTHDR
+#endif
+
+ TYPE(struct linger);
+ STRUCT_MEMBER(struct linger, int, l_onoff);
+ STRUCT_MEMBER(struct linger, int, l_linger);
+
+ MACRO(SOCK_DGRAM);
+ MACRO(SOCK_RAW);
+ MACRO(SOCK_SEQPACKET);
+ MACRO(SOCK_STREAM);
+
+ MACRO(SOL_SOCKET);
+
+ MACRO(SO_ACCEPTCONN);
+ MACRO(SO_BROADCAST);
+ MACRO(SO_DEBUG);
+ MACRO(SO_DONTROUTE);
+ MACRO(SO_ERROR);
+ MACRO(SO_KEEPALIVE);
+ MACRO(SO_LINGER);
+ MACRO(SO_OOBINLINE);
+ MACRO(SO_RCVBUF);
+ MACRO(SO_RCVLOWAT);
+ MACRO(SO_RCVTIMEO);
+ MACRO(SO_REUSEADDR);
+ MACRO(SO_SNDBUF);
+ MACRO(SO_SNDLOWAT);
+ MACRO(SO_SNDTIMEO);
+ MACRO(SO_TYPE);
+
+ MACRO(SOMAXCONN);
+
+ MACRO(MSG_CTRUNC);
+ MACRO(MSG_DONTROUTE);
+ MACRO(MSG_EOR);
+ MACRO(MSG_OOB);
+ MACRO(MSG_NOSIGNAL);
+ MACRO(MSG_PEEK);
+ MACRO(MSG_TRUNC);
+ MACRO(MSG_WAITALL);
+
+ MACRO(AF_INET);
+ MACRO(AF_INET6);
+ MACRO(AF_UNIX);
+ MACRO_VALUE(AF_UNSPEC, 0);
+
+ MACRO(SHUT_RD);
+ MACRO(SHUT_RDWR);
+ MACRO(SHUT_WR);
+
+ TYPE(size_t);
+ TYPE(ssize_t);
+
+ FUNCTION(accept, int (*f)(int, struct sockaddr*, socklen_t*));
+ FUNCTION(bind, int (*f)(int, const struct sockaddr*, socklen_t));
+ FUNCTION(connect, int (*f)(int, const struct sockaddr*, socklen_t));
+ FUNCTION(getpeername, int (*f)(int, struct sockaddr*, socklen_t*));
+ FUNCTION(getsockname, int (*f)(int, struct sockaddr*, socklen_t*));
+ FUNCTION(getsockopt, int (*f)(int, int, int, void*, socklen_t*));
+ FUNCTION(listen, int (*f)(int, int));
+ FUNCTION(recv, ssize_t (*f)(int, void*, size_t, int));
+ FUNCTION(recvfrom, ssize_t (*f)(int, void*, size_t, int, struct sockaddr*, socklen_t*));
+ FUNCTION(send, ssize_t (*f)(int, const void*, size_t, int));
+ FUNCTION(sendmsg, ssize_t (*f)(int, const struct msghdr*, int));
+ FUNCTION(sendto, ssize_t (*f)(int, const void*, size_t, int, const struct sockaddr*, socklen_t));
+ FUNCTION(setsockopt, int (*f)(int, int, int, const void*, socklen_t));
+ FUNCTION(shutdown, int (*f)(int, int));
+#if !defined(__BIONIC__) // Obsolete, plus ioctl disallowed by SELinux.
+ FUNCTION(sockatmark, int (*f)(int));
+#endif
+ FUNCTION(socket, int (*f)(int, int, int));
+ FUNCTION(socketpair, int (*f)(int, int, int, int[2]));
+}
diff --git a/tests/headers/posix/sys_stat_h.c b/tests/headers/posix/sys_stat_h.c
new file mode 100644
index 0000000..9ddbe21
--- /dev/null
+++ b/tests/headers/posix/sys_stat_h.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/stat.h>
+
+#include "header_checks.h"
+
+static void sys_stat_h() {
+ TYPE(struct stat);
+#if defined(__BIONIC__) && (defined(__arm__) || defined(__i386__))
+ STRUCT_MEMBER(struct stat, unsigned long long, st_dev);
+#else
+ STRUCT_MEMBER(struct stat, dev_t, st_dev);
+#endif
+#if defined(__BIONIC__) && (defined(__arm__) || defined(__i386__))
+ STRUCT_MEMBER(struct stat, unsigned long long, st_ino);
+#else
+ STRUCT_MEMBER(struct stat, ino_t, st_ino);
+#endif
+#if defined(__BIONIC__) && (defined(__arm__) || defined(__i386__))
+ STRUCT_MEMBER(struct stat, unsigned int, st_mode);
+#else
+ STRUCT_MEMBER(struct stat, mode_t, st_mode);
+#endif
+#if defined(__BIONIC__) && defined(__x86_64__)
+ // We can't just fix the x86_64 nlink_t because it's ABI via <fts.h>.
+ STRUCT_MEMBER(struct stat, unsigned long, st_nlink);
+#else
+ STRUCT_MEMBER(struct stat, nlink_t, st_nlink);
+#endif
+ STRUCT_MEMBER(struct stat, uid_t, st_uid);
+ STRUCT_MEMBER(struct stat, gid_t, st_gid);
+#if defined(__BIONIC__) && (defined(__arm__) || defined(__i386__))
+ STRUCT_MEMBER(struct stat, unsigned long long, st_rdev);
+#else
+ STRUCT_MEMBER(struct stat, dev_t, st_rdev);
+#endif
+#if defined(__BIONIC__) && (defined(__arm__) || defined(__i386__))
+ STRUCT_MEMBER(struct stat, long long, st_size);
+#else
+ STRUCT_MEMBER(struct stat, off_t, st_size);
+#endif
+ STRUCT_MEMBER(struct stat, struct timespec, st_atim);
+ STRUCT_MEMBER(struct stat, struct timespec, st_mtim);
+ STRUCT_MEMBER(struct stat, struct timespec, st_ctim);
+#if defined(__BIONIC__)
+#if defined(__aarch64__)
+ STRUCT_MEMBER(struct stat, int, st_blksize);
+#elif defined(__x86_64__)
+ STRUCT_MEMBER(struct stat, long, st_blksize);
+#else
+ STRUCT_MEMBER(struct stat, unsigned long, st_blksize);
+#endif
+#else
+ STRUCT_MEMBER(struct stat, blksize_t, st_blksize);
+#endif
+#if defined(__BIONIC__)
+#if defined(__aarch64__) || defined(__x86_64__)
+ STRUCT_MEMBER(struct stat, long, st_blocks);
+#else
+ STRUCT_MEMBER(struct stat, unsigned long long, st_blocks);
+#endif
+#else
+ STRUCT_MEMBER(struct stat, blkcnt_t, st_blocks);
+#endif
+
+ TYPE(blkcnt_t);
+ TYPE(blksize_t);
+ TYPE(dev_t);
+ TYPE(ino_t);
+ TYPE(mode_t);
+ TYPE(nlink_t);
+ TYPE(uid_t);
+ TYPE(gid_t);
+ TYPE(off_t);
+ TYPE(time_t);
+
+ TYPE(struct timespec);
+
+#if !defined(st_atime)
+#error st_atime
+#endif
+#if !defined(st_ctime)
+#error st_ctime
+#endif
+#if !defined(st_mtime)
+#error st_mtime
+#endif
+
+#include "sys_stat_h_mode_constants.h"
+#include "sys_stat_h_file_type_test_macros.h"
+
+#if !defined(S_TYPEISMQ)
+#error S_TYPEISMQ
+#endif
+#if !defined(S_TYPEISSEM)
+#error S_TYPEISSEM
+#endif
+#if !defined(S_TYPEISSHM)
+#error S_TYPEISSHM
+#endif
+
+#if !defined(__BIONIC__) && !defined(__GLIBC__)
+#if !defined(S_TYPEISTMO)
+#error S_TYPEISTMO
+#endif
+#endif
+
+ MACRO(UTIME_NOW);
+ MACRO(UTIME_OMIT);
+
+ FUNCTION(chmod, int (*f)(const char*, mode_t));
+ FUNCTION(fchmod, int (*f)(int, mode_t));
+ FUNCTION(fchmodat, int (*f)(int, const char*, mode_t, int));
+ FUNCTION(fstat, int (*f)(int, struct stat*));
+ FUNCTION(fstatat, int (*f)(int, const char*, struct stat*, int));
+ FUNCTION(futimens, int (*f)(int, const struct timespec[2]));
+ FUNCTION(lstat, int (*f)(const char*, struct stat*));
+ FUNCTION(lstat, int (*f)(const char*, struct stat*));
+ FUNCTION(mkdir, int (*f)(const char*, mode_t));
+ FUNCTION(mkdirat, int (*f)(int, const char*, mode_t));
+ FUNCTION(mkfifo, int (*f)(const char*, mode_t));
+ FUNCTION(mkfifoat, int (*f)(int, const char*, mode_t));
+ FUNCTION(mknod, int (*f)(const char*, mode_t, dev_t));
+ FUNCTION(mknodat, int (*f)(int, const char*, mode_t, dev_t));
+ FUNCTION(stat, int (*f)(const char*, struct stat*));
+ FUNCTION(umask, mode_t (*f)(mode_t));
+ FUNCTION(utimensat, int (*f)(int, const char*, const struct timespec[2], int));
+}
diff --git a/tests/headers/posix/sys_stat_h_file_type_test_macros.h b/tests/headers/posix/sys_stat_h_file_type_test_macros.h
new file mode 100644
index 0000000..5e09fdb
--- /dev/null
+++ b/tests/headers/posix/sys_stat_h_file_type_test_macros.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#if !defined(S_ISBLK)
+#error S_ISBLK
+#endif
+#if !defined(S_ISCHR)
+#error S_ISCHR
+#endif
+#if !defined(S_ISDIR)
+#error S_ISDIR
+#endif
+#if !defined(S_ISFIFO)
+#error S_ISFIFO
+#endif
+#if !defined(S_ISREG)
+#error S_ISREG
+#endif
+#if !defined(S_ISLNK)
+#error S_ISLNK
+#endif
+#if !defined(S_ISSOCK)
+#error S_ISSOCK
+#endif
diff --git a/tests/headers/posix/sys_stat_h_mode_constants.h b/tests/headers/posix/sys_stat_h_mode_constants.h
new file mode 100644
index 0000000..cce8469
--- /dev/null
+++ b/tests/headers/posix/sys_stat_h_mode_constants.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+ MACRO(S_IFMT);
+ MACRO(S_IFBLK);
+ MACRO(S_IFCHR);
+ MACRO(S_IFIFO);
+ MACRO(S_IFREG);
+ MACRO(S_IFDIR);
+ MACRO(S_IFLNK);
+ MACRO(S_IFSOCK);
+
+ MACRO_VALUE(S_IRWXU, 0700);
+ MACRO_VALUE(S_IRUSR, 0400);
+ MACRO_VALUE(S_IWUSR, 0200);
+ MACRO_VALUE(S_IXUSR, 0100);
+
+ MACRO_VALUE(S_IRWXG, 070);
+ MACRO_VALUE(S_IRGRP, 040);
+ MACRO_VALUE(S_IWGRP, 020);
+ MACRO_VALUE(S_IXGRP, 010);
+
+ MACRO_VALUE(S_IRWXO, 07);
+ MACRO_VALUE(S_IROTH, 04);
+ MACRO_VALUE(S_IWOTH, 02);
+ MACRO_VALUE(S_IXOTH, 01);
+
+ MACRO_VALUE(S_ISUID, 04000);
+ MACRO_VALUE(S_ISGID, 02000);
+ MACRO_VALUE(S_ISVTX, 01000);
diff --git a/tests/headers/posix/sys_statvfs_h.c b/tests/headers/posix/sys_statvfs_h.c
new file mode 100644
index 0000000..b44a93a
--- /dev/null
+++ b/tests/headers/posix/sys_statvfs_h.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/statvfs.h>
+
+#include "header_checks.h"
+
+static void sys_statvfs_h() {
+ TYPE(struct statvfs);
+ STRUCT_MEMBER(struct statvfs, unsigned long, f_bsize);
+ STRUCT_MEMBER(struct statvfs, unsigned long, f_frsize);
+ STRUCT_MEMBER(struct statvfs, fsblkcnt_t, f_blocks);
+ STRUCT_MEMBER(struct statvfs, fsblkcnt_t, f_bfree);
+ STRUCT_MEMBER(struct statvfs, fsblkcnt_t, f_bavail);
+ STRUCT_MEMBER(struct statvfs, fsfilcnt_t, f_files);
+ STRUCT_MEMBER(struct statvfs, fsfilcnt_t, f_ffree);
+ STRUCT_MEMBER(struct statvfs, fsfilcnt_t, f_favail);
+ STRUCT_MEMBER(struct statvfs, unsigned long, f_fsid);
+ STRUCT_MEMBER(struct statvfs, unsigned long, f_flag);
+ STRUCT_MEMBER(struct statvfs, unsigned long, f_namemax);
+
+ TYPE(fsblkcnt_t);
+ TYPE(fsfilcnt_t);
+
+ MACRO(ST_RDONLY);
+ MACRO(ST_NOSUID);
+
+ FUNCTION(fstatvfs, int (*f)(int, struct statvfs*));
+ FUNCTION(statvfs, int (*f)(const char*, struct statvfs*));
+}
diff --git a/tests/headers/posix/sys_time_h.c b/tests/headers/posix/sys_time_h.c
new file mode 100644
index 0000000..394abd2
--- /dev/null
+++ b/tests/headers/posix/sys_time_h.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/time.h>
+
+#include "header_checks.h"
+
+static void sys_time_h() {
+ TYPE(struct timeval);
+ STRUCT_MEMBER(struct timeval, time_t, tv_sec);
+ STRUCT_MEMBER(struct timeval, suseconds_t, tv_usec);
+
+ TYPE(struct itimerval);
+ STRUCT_MEMBER(struct itimerval, struct timeval, it_interval);
+ STRUCT_MEMBER(struct itimerval, struct timeval, it_value);
+
+ TYPE(time_t);
+ TYPE(suseconds_t);
+
+ TYPE(fd_set);
+
+ MACRO(ITIMER_REAL);
+ MACRO(ITIMER_VIRTUAL);
+ MACRO(ITIMER_PROF);
+
+#if !defined(FD_CLR)
+#error FD_CLR
+#endif
+#if !defined(FD_ISSET)
+#error FD_ISSET
+#endif
+#if !defined(FD_SET)
+#error FD_SET
+#endif
+#if !defined(FD_ZERO)
+#error FD_ZERO
+#endif
+ MACRO(FD_SETSIZE);
+
+ FUNCTION(getitimer, int (*f)(int, struct itimerval*));
+#if defined(__BIONIC__)
+ FUNCTION(gettimeofday, int (*f)(struct timeval*, struct timezone*));
+#else
+ FUNCTION(gettimeofday, int (*f)(struct timeval*, void*));
+#endif
+ FUNCTION(setitimer, int (*f)(int, const struct itimerval*, struct itimerval*));
+ FUNCTION(select, int (*f)(int, fd_set*, fd_set*, fd_set*, struct timeval*));
+ FUNCTION(utimes, int (*f)(const char*, const struct timeval[2]));
+}
diff --git a/tests/headers/posix/sys_times_h.c b/tests/headers/posix/sys_times_h.c
new file mode 100644
index 0000000..195d11b
--- /dev/null
+++ b/tests/headers/posix/sys_times_h.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/times.h>
+
+#include "header_checks.h"
+
+static void sys_times_h() {
+ TYPE(struct tms);
+ STRUCT_MEMBER(struct tms, clock_t, tms_utime);
+ STRUCT_MEMBER(struct tms, clock_t, tms_stime);
+ STRUCT_MEMBER(struct tms, clock_t, tms_cutime);
+ STRUCT_MEMBER(struct tms, clock_t, tms_cstime);
+
+ TYPE(clock_t);
+
+ FUNCTION(times, clock_t (*f)(struct tms*));
+}
diff --git a/tests/headers/posix/sys_types_h.c b/tests/headers/posix/sys_types_h.c
new file mode 100644
index 0000000..3b0f55f
--- /dev/null
+++ b/tests/headers/posix/sys_types_h.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/types.h>
+
+#include "header_checks.h"
+
+static void sys_types_h() {
+ TYPE(blkcnt_t);
+ TYPE(blksize_t);
+ TYPE(clock_t);
+ TYPE(clockid_t);
+ TYPE(dev_t);
+ TYPE(fsblkcnt_t);
+ TYPE(fsfilcnt_t);
+ TYPE(gid_t);
+ TYPE(id_t);
+ TYPE(ino_t);
+ TYPE(key_t);
+ TYPE(mode_t);
+ TYPE(nlink_t);
+ TYPE(off_t);
+ TYPE(pid_t);
+ TYPE(pthread_attr_t);
+ TYPE(pthread_barrier_t);
+ TYPE(pthread_barrierattr_t);
+ TYPE(pthread_cond_t);
+ TYPE(pthread_condattr_t);
+ TYPE(pthread_key_t);
+ TYPE(pthread_mutex_t);
+ TYPE(pthread_mutexattr_t);
+ TYPE(pthread_once_t);
+ TYPE(pthread_rwlock_t);
+ TYPE(pthread_rwlockattr_t);
+ TYPE(pthread_spinlock_t);
+ TYPE(pthread_t);
+ TYPE(size_t);
+ TYPE(ssize_t);
+ TYPE(suseconds_t);
+ TYPE(time_t);
+ TYPE(timer_t);
+ TYPE(uid_t);
+}
diff --git a/tests/headers/posix/sys_uio_h.c b/tests/headers/posix/sys_uio_h.c
new file mode 100644
index 0000000..90b210d
--- /dev/null
+++ b/tests/headers/posix/sys_uio_h.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/uio.h>
+
+#include "header_checks.h"
+
+static void sys_uio_h() {
+ TYPE(struct iovec);
+ STRUCT_MEMBER(struct iovec, void*, iov_base);
+ STRUCT_MEMBER(struct iovec, size_t, iov_len);
+
+ TYPE(ssize_t);
+ TYPE(size_t);
+
+ FUNCTION(readv, ssize_t (*f)(int, const struct iovec*, int));
+ FUNCTION(writev, ssize_t (*f)(int, const struct iovec*, int));
+}
diff --git a/tests/headers/posix/sys_un_h.c b/tests/headers/posix/sys_un_h.c
new file mode 100644
index 0000000..d48ac61
--- /dev/null
+++ b/tests/headers/posix/sys_un_h.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/un.h>
+
+#include "header_checks.h"
+
+static void sys_un_h() {
+ TYPE(struct sockaddr_un);
+ STRUCT_MEMBER(struct sockaddr_un, sa_family_t, sun_family);
+ STRUCT_MEMBER_ARRAY(struct sockaddr_un, char/*[]*/, sun_path);
+
+ TYPE(sa_family_t);
+}
diff --git a/tests/headers/posix/sys_utsname_h.c b/tests/headers/posix/sys_utsname_h.c
new file mode 100644
index 0000000..5ebd703
--- /dev/null
+++ b/tests/headers/posix/sys_utsname_h.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/utsname.h>
+
+#include "header_checks.h"
+
+static void sys_utsname_h() {
+ TYPE(struct utsname);
+ STRUCT_MEMBER_ARRAY(struct utsname, char/*[]*/, sysname);
+ STRUCT_MEMBER_ARRAY(struct utsname, char/*[]*/, nodename);
+ STRUCT_MEMBER_ARRAY(struct utsname, char/*[]*/, release);
+ STRUCT_MEMBER_ARRAY(struct utsname, char/*[]*/, version);
+ STRUCT_MEMBER_ARRAY(struct utsname, char/*[]*/, machine);
+
+ FUNCTION(uname, int (*f)(struct utsname*));
+}
diff --git a/tests/headers/posix/sys_wait_h.c b/tests/headers/posix/sys_wait_h.c
new file mode 100644
index 0000000..406e051
--- /dev/null
+++ b/tests/headers/posix/sys_wait_h.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <sys/wait.h>
+
+#include "header_checks.h"
+
+static void sys_wait_h() {
+ MACRO(WCONTINUED);
+ MACRO(WNOHANG);
+ MACRO(WUNTRACED);
+
+#if !defined(WEXITSTATUS)
+#error WEXITSTATUS
+#endif
+#if !defined(WIFCONTINUED)
+#error WIFCONTINUED
+#endif
+#if !defined(WIFEXITED)
+#error WIFEXITED
+#endif
+#if !defined(WIFSIGNALED)
+#error WIFSIGNALED
+#endif
+#if !defined(WIFSTOPPED)
+#error WIFSTOPPED
+#endif
+#if !defined(WSTOPSIG)
+#error WSTOPSIG
+#endif
+#if !defined(WTERMSIG)
+#error WTERMSIG
+#endif
+
+ MACRO(WEXITED);
+ MACRO(WNOWAIT);
+ MACRO(WSTOPPED);
+
+ TYPE(idtype_t);
+ MACRO(P_ALL);
+ MACRO(P_PGID);
+ MACRO(P_PID);
+
+ TYPE(id_t);
+ TYPE(pid_t);
+ TYPE(siginfo_t);
+ TYPE(union sigval);
+
+ FUNCTION(wait, pid_t (*f)(int*));
+ FUNCTION(waitid, int (*f)(idtype_t, id_t, siginfo_t*, int));
+ FUNCTION(waitpid, pid_t (*f)(pid_t, int*, int));
+}
diff --git a/tests/headers/posix/syslog_h.c b/tests/headers/posix/syslog_h.c
new file mode 100644
index 0000000..b43f49e
--- /dev/null
+++ b/tests/headers/posix/syslog_h.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <syslog.h>
+
+#include "header_checks.h"
+
+static void syslog_h() {
+ MACRO(LOG_PID);
+ MACRO(LOG_CONS);
+ MACRO(LOG_NDELAY);
+ MACRO(LOG_ODELAY);
+ MACRO(LOG_NOWAIT);
+
+ MACRO(LOG_KERN);
+ MACRO(LOG_USER);
+ MACRO(LOG_MAIL);
+ MACRO(LOG_NEWS);
+ MACRO(LOG_UUCP);
+ MACRO(LOG_DAEMON);
+ MACRO(LOG_AUTH);
+ MACRO(LOG_CRON);
+ MACRO(LOG_LPR);
+ MACRO(LOG_LOCAL0);
+ MACRO(LOG_LOCAL1);
+ MACRO(LOG_LOCAL2);
+ MACRO(LOG_LOCAL3);
+ MACRO(LOG_LOCAL4);
+ MACRO(LOG_LOCAL5);
+ MACRO(LOG_LOCAL6);
+ MACRO(LOG_LOCAL7);
+
+#if !defined(LOG_MASK)
+#error LOG_MASK
+#endif
+
+ MACRO(LOG_EMERG);
+ MACRO(LOG_ALERT);
+ MACRO(LOG_CRIT);
+ MACRO(LOG_ERR);
+ MACRO(LOG_WARNING);
+ MACRO(LOG_NOTICE);
+ MACRO(LOG_INFO);
+ MACRO(LOG_DEBUG);
+
+ FUNCTION(closelog, void (*f)(void));
+ FUNCTION(openlog, void (*f)(const char*, int, int));
+ FUNCTION(setlogmask, int (*f)(int));
+ FUNCTION(syslog, void (*f)(int, const char*, ...));
+}
diff --git a/tests/headers/posix/tar_h.c b/tests/headers/posix/tar_h.c
new file mode 100644
index 0000000..bd22c17
--- /dev/null
+++ b/tests/headers/posix/tar_h.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <tar.h>
+
+#include "header_checks.h"
+
+static void tar_h() {
+ MACRO(TMAGIC);
+ MACRO_VALUE(TMAGLEN, 6);
+ MACRO(TVERSION);
+ MACRO_VALUE(TVERSLEN, 2);
+
+ MACRO_VALUE(REGTYPE, '0');
+ MACRO_VALUE(AREGTYPE, '\0');
+ MACRO_VALUE(LNKTYPE, '1');
+ MACRO_VALUE(SYMTYPE, '2');
+ MACRO_VALUE(CHRTYPE, '3');
+ MACRO_VALUE(BLKTYPE, '4');
+ MACRO_VALUE(DIRTYPE, '5');
+ MACRO_VALUE(FIFOTYPE, '6');
+ MACRO_VALUE(CONTTYPE, '7');
+
+ MACRO_VALUE(TSUID, 04000);
+ MACRO_VALUE(TSGID, 02000);
+ MACRO_VALUE(TSVTX, 01000);
+ MACRO_VALUE(TUREAD, 0400);
+ MACRO_VALUE(TUWRITE, 0200);
+ MACRO_VALUE(TUEXEC, 0100);
+ MACRO_VALUE(TGREAD, 040);
+ MACRO_VALUE(TGWRITE, 020);
+ MACRO_VALUE(TGEXEC, 010);
+ MACRO_VALUE(TOREAD, 04);
+ MACRO_VALUE(TOWRITE, 02);
+ MACRO_VALUE(TOEXEC, 01);
+}
diff --git a/tests/headers/posix/termios_h.c b/tests/headers/posix/termios_h.c
new file mode 100644
index 0000000..1255c16
--- /dev/null
+++ b/tests/headers/posix/termios_h.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <termios.h>
+
+#include "header_checks.h"
+
+static void termios_h() {
+ TYPE(cc_t);
+ TYPE(speed_t);
+ TYPE(tcflag_t);
+
+ TYPE(struct termios);
+ STRUCT_MEMBER(struct termios, tcflag_t, c_iflag);
+ STRUCT_MEMBER(struct termios, tcflag_t, c_oflag);
+ STRUCT_MEMBER(struct termios, tcflag_t, c_cflag);
+ STRUCT_MEMBER(struct termios, tcflag_t, c_lflag);
+ STRUCT_MEMBER_ARRAY(struct termios, cc_t/*[]*/, c_cc);
+
+ MACRO(NCCS);
+
+ MACRO(VEOF);
+ MACRO(VEOL);
+ MACRO(VERASE);
+ MACRO(VINTR);
+ MACRO(VKILL);
+ MACRO(VMIN);
+ MACRO(VQUIT);
+ MACRO(VSTART);
+ MACRO(VSTOP);
+ MACRO(VSUSP);
+ MACRO(VTIME);
+
+ MACRO(BRKINT);
+ MACRO(ICRNL);
+ MACRO(IGNBRK);
+ MACRO(IGNCR);
+ MACRO(IGNPAR);
+ MACRO(INLCR);
+ MACRO(INPCK);
+ MACRO(ISTRIP);
+ MACRO(IXANY);
+ MACRO(IXOFF);
+ MACRO(IXON);
+ MACRO(PARMRK);
+
+ MACRO(OPOST);
+ MACRO(ONLCR);
+ MACRO(OCRNL);
+ MACRO(ONOCR);
+ MACRO(ONLRET);
+ MACRO(OFDEL);
+ MACRO(OFILL);
+ MACRO(NLDLY);
+ MACRO(NL0);
+ MACRO(NL1);
+ MACRO(CRDLY);
+ MACRO(CR0);
+ MACRO(CR1);
+ MACRO(CR2);
+ MACRO(CR3);
+ MACRO(TABDLY);
+ MACRO(TAB0);
+ MACRO(TAB1);
+ MACRO(TAB2);
+ MACRO(TAB3);
+ MACRO(BSDLY);
+ MACRO(BS0);
+ MACRO(BS1);
+ MACRO(VTDLY);
+ MACRO(VT0);
+ MACRO(VT1);
+ MACRO(FFDLY);
+ MACRO(FF0);
+ MACRO(FF1);
+
+ MACRO(B0);
+ MACRO(B50);
+ MACRO(B75);
+ MACRO(B110);
+ MACRO(B134);
+ MACRO(B150);
+ MACRO(B200);
+ MACRO(B300);
+ MACRO(B600);
+ MACRO(B1200);
+ MACRO(B1800);
+ MACRO(B2400);
+ MACRO(B4800);
+ MACRO(B9600);
+ MACRO(B19200);
+ MACRO(B38400);
+
+ MACRO(CSIZE);
+ MACRO(CS5);
+ MACRO(CS6);
+ MACRO(CS7);
+ MACRO(CS8);
+ MACRO(CSTOPB);
+ MACRO(CREAD);
+ MACRO(PARENB);
+ MACRO(PARODD);
+ MACRO(HUPCL);
+ MACRO(CLOCAL);
+
+ MACRO(ECHO);
+ MACRO(ECHOE);
+ MACRO(ECHOK);
+ MACRO(ECHONL);
+ MACRO(ICANON);
+ MACRO(IEXTEN);
+ MACRO(ISIG);
+ MACRO(NOFLSH);
+ MACRO(TOSTOP);
+
+ MACRO(TCSANOW);
+ MACRO(TCSADRAIN);
+ MACRO(TCSAFLUSH);
+
+ MACRO(TCIFLUSH);
+ MACRO(TCIOFLUSH);
+ MACRO(TCOFLUSH);
+
+ MACRO(TCIOFF);
+ MACRO(TCION);
+ MACRO(TCOOFF);
+ MACRO(TCOON);
+
+ TYPE(pid_t);
+
+ FUNCTION(cfgetispeed, speed_t (*f)(const struct termios*));
+ FUNCTION(cfgetospeed, speed_t (*f)(const struct termios*));
+ FUNCTION(cfsetispeed, int (*f)(struct termios*, speed_t));
+ FUNCTION(cfsetospeed, int (*f)(struct termios*, speed_t));
+ FUNCTION(tcdrain, int (*f)(int));
+ FUNCTION(tcflow, int (*f)(int, int));
+ FUNCTION(tcflush, int (*f)(int, int));
+ FUNCTION(tcgetattr, int (*f)(int, struct termios*));
+ FUNCTION(tcgetsid, pid_t (*f)(int));
+ FUNCTION(tcsendbreak, int (*f)(int, int));
+ FUNCTION(tcsetattr, int (*f)(int, int, const struct termios*));
+}
diff --git a/tests/headers/posix/tgmath_h.c b/tests/headers/posix/tgmath_h.c
new file mode 100644
index 0000000..c3a4311
--- /dev/null
+++ b/tests/headers/posix/tgmath_h.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <tgmath.h>
+
+#include "header_checks.h"
+
+#define TGMATH(f_) f_(f1); f_(d1); f_(ld1);
+#define TGMATHC(f_) f_(f1); f_(d1); f_(ld1); f_(fc1); f_(dc1); f_(ldc1);
+#define TGMATHCONLY(f_) f_(fc1); f_(dc1); f_(ldc1);
+#define TGMATH2(f_) f_(f1, f2); f_(d1, d2); f_(ld1, ld2);
+#define TGMATH2C(f_) f_(f1, f2); f_(d1, d2); f_(ld1, ld2); f_(fc1, fc2); f_(dc1, dc2); f_(ldc1, ldc2);
+#define TGMATH3(f_) f_(f1, f2, f3); f_(d1, d2, d3); f_(ld1, ld2, ld3);
+
+static void tgmath_h() {
+ float f1, f2, f3;
+ f1 = f2 = f3 = 0;
+ float complex fc1, fc2, fc3;
+ fc1 = fc2 = fc3 = 0;
+ double d1, d2, d3;
+ d1 = d2 = d3 = 0;
+ double complex dc1, dc2, dc3;
+ dc1 = dc2 = dc3 = 0;
+ long double ld1, ld2, ld3;
+ ld1 = ld2 = ld3 = 0;
+ long double complex ldc1, ldc2, ldc3;
+ ldc1 = ldc2 = ldc3 = 0;
+ int i = 0;
+ long l = 0;
+
+ TGMATHC(acos);
+ TGMATHC(asin);
+ TGMATHC(atan);
+ TGMATHC(acosh);
+ TGMATHC(asinh);
+ TGMATHC(atanh);
+ TGMATHC(cos);
+ TGMATHC(sin);
+ TGMATHC(tan);
+ TGMATHC(cosh);
+ TGMATHC(sinh);
+ TGMATHC(tanh);
+ TGMATHC(exp);
+ TGMATHC(log);
+ TGMATH2C(pow);
+ TGMATHC(sqrt);
+ TGMATHC(fabs);
+
+ TGMATH2(atan2);
+ TGMATH(cbrt);
+ TGMATH(ceil);
+ TGMATH2(copysign);
+ TGMATH(erf);
+ TGMATH(erfc);
+ TGMATH(exp2);
+ TGMATH(expm1);
+ TGMATH2(fdim);
+ TGMATH(floor);
+ TGMATH3(fma);
+ TGMATH2(fmax);
+ TGMATH2(fmin);
+ TGMATH2(fmod);
+ frexp(f1, &i); frexp(d1, &i); frexp(ld1, &i);
+ TGMATH2(hypot);
+ TGMATH(ilogb);
+ ldexp(f1, i); ldexp(d1, i); ldexp(ld1, i);
+ TGMATH(lgamma);
+ TGMATH(llrint);
+ TGMATH(llround);
+ TGMATH(log10);
+ TGMATH(log1p);
+ TGMATH(log2);
+ TGMATH(logb);
+ TGMATH(lrint);
+ TGMATH(lround);
+ TGMATH(nearbyint);
+ TGMATH2(nextafter);
+ TGMATH2(nexttoward);
+ TGMATH2(remainder);
+ remquo(f1, f2, &i); remquo(d1, d2, &i); remquo(ld1, ld2, &i);
+ TGMATH(rint);
+ TGMATH(round);
+ scalbln(f1, l); scalbln(d1, l); scalbln(ld1, l);
+ scalbn(f1, i); scalbn(d1, i); scalbn(ld1, i);
+ TGMATH(tgamma);
+ TGMATH(trunc);
+
+ TGMATHCONLY(carg);
+ TGMATHCONLY(cimag);
+ TGMATHCONLY(conj);
+ TGMATHCONLY(cproj);
+ TGMATHCONLY(creal);
+}
diff --git a/tests/headers/posix/time_h.c b/tests/headers/posix/time_h.c
new file mode 100644
index 0000000..d3e088a
--- /dev/null
+++ b/tests/headers/posix/time_h.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#if !defined(DO_NOT_INCLUDE_TIME_H)
+#include <time.h>
+#endif
+
+#include "header_checks.h"
+
+static void time_h() {
+ TYPE(clock_t);
+ TYPE(size_t);
+ TYPE(time_t);
+
+ TYPE(clockid_t);
+ TYPE(timer_t);
+
+ TYPE(locale_t);
+
+ TYPE(pid_t);
+
+ TYPE(struct tm);
+ STRUCT_MEMBER(struct tm, int, tm_sec);
+ STRUCT_MEMBER(struct tm, int, tm_min);
+ STRUCT_MEMBER(struct tm, int, tm_hour);
+ STRUCT_MEMBER(struct tm, int, tm_mday);
+ STRUCT_MEMBER(struct tm, int, tm_mon);
+ STRUCT_MEMBER(struct tm, int, tm_year);
+ STRUCT_MEMBER(struct tm, int, tm_wday);
+ STRUCT_MEMBER(struct tm, int, tm_yday);
+ STRUCT_MEMBER(struct tm, int, tm_isdst);
+
+ TYPE(struct timespec);
+ STRUCT_MEMBER(struct timespec, time_t, tv_sec);
+ STRUCT_MEMBER(struct timespec, long, tv_nsec);
+
+ TYPE(struct itimerspec);
+ STRUCT_MEMBER(struct itimerspec, struct timespec, it_interval);
+ STRUCT_MEMBER(struct itimerspec, struct timespec, it_value);
+
+ MACRO(NULL);
+ MACRO(CLOCKS_PER_SEC);
+
+ MACRO(CLOCK_MONOTONIC);
+ MACRO(CLOCK_PROCESS_CPUTIME_ID);
+ MACRO(CLOCK_REALTIME);
+ MACRO(CLOCK_THREAD_CPUTIME_ID);
+
+ MACRO(TIMER_ABSTIME);
+
+ FUNCTION(asctime, char* (*f)(const struct tm*));
+ FUNCTION(asctime_r, char* (*f)(const struct tm*, char*));
+ FUNCTION(clock, clock_t (*f)(void));
+ FUNCTION(clock_getcpuclockid, int (*f)(pid_t, clockid_t*));
+ FUNCTION(clock_getres, int (*f)(clockid_t, struct timespec*));
+ FUNCTION(clock_gettime, int (*f)(clockid_t, struct timespec*));
+ FUNCTION(clock_nanosleep, int (*f)(clockid_t, int, const struct timespec*, struct timespec*));
+ FUNCTION(clock_settime, int (*f)(clockid_t, const struct timespec*));
+ FUNCTION(ctime, char* (*f)(const time_t*));
+ FUNCTION(ctime_r, char* (*f)(const time_t*, char*));
+ FUNCTION(difftime, double (*f)(time_t, time_t));
+#if !defined(__BIONIC__)
+ FUNCTION(getdate, struct tm* (*f)(const char*));
+#endif
+ FUNCTION(gmtime, struct tm* (*f)(const time_t*));
+ FUNCTION(gmtime_r, struct tm* (*f)(const time_t*, struct tm*));
+ FUNCTION(localtime, struct tm* (*f)(const time_t*));
+ FUNCTION(localtime_r, struct tm* (*f)(const time_t*, struct tm*));
+ FUNCTION(mktime, time_t (*f)(struct tm*));
+ FUNCTION(nanosleep, int (*f)(const struct timespec*, struct timespec*));
+ FUNCTION(strftime, size_t (*f)(char*, size_t, const char*, const struct tm*));
+ FUNCTION(strftime_l, size_t (*f)(char*, size_t, const char*, const struct tm*, locale_t));
+ FUNCTION(strptime, char* (*f)(const char*, const char*, struct tm*));
+ FUNCTION(time, time_t (*f)(time_t*));
+ FUNCTION(timer_create, int (*f)(clockid_t, struct sigevent*, timer_t*));
+ FUNCTION(timer_delete, int (*f)(timer_t));
+ FUNCTION(timer_getoverrun, int (*f)(timer_t));
+ FUNCTION(timer_gettime, int (*f)(timer_t, struct itimerspec*));
+ FUNCTION(timer_settime, int (*f)(timer_t, int, const struct itimerspec*, struct itimerspec*));
+ FUNCTION(tzset, void (*f)(void));
+
+ int i = daylight;
+ long l = timezone;
+ char** sp = tzname;
+}
diff --git a/tests/headers/posix/unistd_h.c b/tests/headers/posix/unistd_h.c
new file mode 100644
index 0000000..b713f53
--- /dev/null
+++ b/tests/headers/posix/unistd_h.c
@@ -0,0 +1,383 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <unistd.h>
+
+#include "header_checks.h"
+
+static void unistd_h() {
+ MACRO(_POSIX_VERSION);
+ MACRO(_POSIX2_VERSION);
+ MACRO(_XOPEN_VERSION);
+
+ MACRO(_POSIX_ADVISORY_INFO);
+ MACRO(_POSIX_ASYNCHRONOUS_IO);
+ MACRO(_POSIX_BARRIERS);
+ MACRO(_POSIX_CHOWN_RESTRICTED);
+ MACRO(_POSIX_CLOCK_SELECTION);
+ MACRO(_POSIX_CPUTIME);
+ MACRO(_POSIX_FSYNC);
+ MACRO(_POSIX_IPV6);
+ MACRO(_POSIX_JOB_CONTROL);
+ MACRO(_POSIX_MAPPED_FILES);
+ MACRO(_POSIX_MEMLOCK);
+ MACRO(_POSIX_MEMLOCK_RANGE);
+ MACRO(_POSIX_MEMORY_PROTECTION);
+ MACRO(_POSIX_MESSAGE_PASSING);
+ MACRO(_POSIX_MONOTONIC_CLOCK);
+ MACRO(_POSIX_NO_TRUNC);
+ MACRO(_POSIX_PRIORITIZED_IO);
+ MACRO(_POSIX_PRIORITY_SCHEDULING);
+ MACRO(_POSIX_RAW_SOCKETS);
+ MACRO(_POSIX_READER_WRITER_LOCKS);
+ MACRO(_POSIX_REALTIME_SIGNALS);
+ MACRO(_POSIX_REGEXP);
+ MACRO(_POSIX_SAVED_IDS);
+ MACRO(_POSIX_SEMAPHORES);
+ MACRO(_POSIX_SHARED_MEMORY_OBJECTS);
+ MACRO(_POSIX_SHELL);
+ MACRO(_POSIX_SPAWN);
+ MACRO(_POSIX_SPIN_LOCKS);
+ MACRO(_POSIX_SPORADIC_SERVER);
+ MACRO(_POSIX_SYNCHRONIZED_IO);
+ MACRO(_POSIX_THREAD_ATTR_STACKADDR);
+ MACRO(_POSIX_THREAD_ATTR_STACKSIZE);
+ MACRO(_POSIX_THREAD_CPUTIME);
+ MACRO(_POSIX_THREAD_PRIO_INHERIT);
+ MACRO(_POSIX_THREAD_PRIO_PROTECT);
+ MACRO(_POSIX_THREAD_PRIORITY_SCHEDULING);
+ MACRO(_POSIX_THREAD_PROCESS_SHARED);
+ MACRO(_POSIX_THREAD_ROBUST_PRIO_INHERIT);
+ MACRO(_POSIX_THREAD_ROBUST_PRIO_PROTECT);
+ MACRO(_POSIX_THREAD_SAFE_FUNCTIONS);
+ MACRO(_POSIX_THREAD_SPORADIC_SERVER);
+ MACRO(_POSIX_THREADS);
+ MACRO(_POSIX_TIMEOUTS);
+ MACRO(_POSIX_TIMERS);
+ MACRO(_POSIX_TYPED_MEMORY_OBJECTS);
+ MACRO(_POSIX2_C_BIND);
+ MACRO(_POSIX2_CHAR_TERM);
+ MACRO(_POSIX2_LOCALEDEF);
+ MACRO(_POSIX2_SW_DEV);
+#if 0 // No libc I can find actually has this.
+ MACRO(_POSIX2_UPE);
+#endif
+ MACRO(_XOPEN_CRYPT);
+ MACRO(_XOPEN_ENH_I18N);
+ MACRO(_XOPEN_REALTIME);
+ MACRO(_XOPEN_REALTIME_THREADS);
+ MACRO(_XOPEN_SHM);
+ MACRO(_XOPEN_UNIX);
+#if defined(_XOPEN_UUCP)
+#if _XOPEN_UUCP != -1 && _XOPEN_UUCP != 0 && _XOPEN_UUCP != 200809L
+#error _XOPEN_UUCP
+#endif
+#endif
+
+ MACRO(NULL);
+
+ MACRO(F_OK);
+ MACRO(R_OK);
+ MACRO(W_OK);
+ MACRO(X_OK);
+
+#if !defined(__BIONIC__) // No confstr on Android.
+ MACRO(_CS_PATH);
+ MACRO(_CS_POSIX_V7_ILP32_OFF32_CFLAGS);
+ MACRO(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS);
+ MACRO(_CS_POSIX_V7_ILP32_OFF32_LIBS);
+ MACRO(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS);
+ MACRO(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS);
+ MACRO(_CS_POSIX_V7_ILP32_OFFBIG_LIBS);
+ MACRO(_CS_POSIX_V7_LP64_OFF64_CFLAGS);
+ MACRO(_CS_POSIX_V7_LP64_OFF64_LDFLAGS);
+ MACRO(_CS_POSIX_V7_LP64_OFF64_LIBS);
+ MACRO(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS);
+ MACRO(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS);
+ MACRO(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS);
+ MACRO(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS);
+ MACRO(_CS_V7_ENV);
+#endif
+
+ MACRO(SEEK_CUR);
+ MACRO(SEEK_END);
+ MACRO(SEEK_SET);
+
+ MACRO(F_LOCK);
+ MACRO(F_TEST);
+ MACRO(F_TLOCK);
+ MACRO(F_ULOCK);
+
+ MACRO(_PC_2_SYMLINKS);
+ MACRO(_PC_ALLOC_SIZE_MIN);
+ MACRO(_PC_ASYNC_IO);
+ MACRO(_PC_CHOWN_RESTRICTED);
+ MACRO(_PC_FILESIZEBITS);
+ MACRO(_PC_LINK_MAX);
+ MACRO(_PC_MAX_CANON);
+ MACRO(_PC_MAX_INPUT);
+ MACRO(_PC_NAME_MAX);
+ MACRO(_PC_NO_TRUNC);
+ MACRO(_PC_PATH_MAX);
+ MACRO(_PC_PIPE_BUF);
+ MACRO(_PC_PRIO_IO);
+ MACRO(_PC_REC_INCR_XFER_SIZE);
+ MACRO(_PC_REC_MAX_XFER_SIZE);
+ MACRO(_PC_REC_MIN_XFER_SIZE);
+ MACRO(_PC_REC_XFER_ALIGN);
+ MACRO(_PC_SYMLINK_MAX);
+ MACRO(_PC_SYNC_IO);
+#if 0 // No libc I can find actually has this.
+ MACRO(_PC_TIMESTAMP_RESOLUTION);
+#endif
+ MACRO(_PC_VDISABLE);
+
+ MACRO(_SC_2_C_BIND);
+ MACRO(_SC_2_C_DEV);
+ MACRO(_SC_2_CHAR_TERM);
+ MACRO(_SC_2_FORT_DEV);
+ MACRO(_SC_2_FORT_RUN);
+ MACRO(_SC_2_LOCALEDEF);
+ MACRO(_SC_2_SW_DEV);
+ MACRO(_SC_2_UPE);
+ MACRO(_SC_2_VERSION);
+ MACRO(_SC_ADVISORY_INFO);
+ MACRO(_SC_AIO_LISTIO_MAX);
+ MACRO(_SC_AIO_MAX);
+ MACRO(_SC_AIO_PRIO_DELTA_MAX);
+ MACRO(_SC_ARG_MAX);
+ MACRO(_SC_ASYNCHRONOUS_IO);
+ MACRO(_SC_ATEXIT_MAX);
+ MACRO(_SC_BARRIERS);
+ MACRO(_SC_BC_BASE_MAX);
+ MACRO(_SC_BC_DIM_MAX);
+ MACRO(_SC_BC_SCALE_MAX);
+ MACRO(_SC_BC_STRING_MAX);
+ MACRO(_SC_CHILD_MAX);
+ MACRO(_SC_CLK_TCK);
+ MACRO(_SC_CLOCK_SELECTION);
+ MACRO(_SC_COLL_WEIGHTS_MAX);
+ MACRO(_SC_CPUTIME);
+ MACRO(_SC_DELAYTIMER_MAX);
+ MACRO(_SC_EXPR_NEST_MAX);
+ MACRO(_SC_FSYNC);
+ MACRO(_SC_GETGR_R_SIZE_MAX);
+ MACRO(_SC_GETPW_R_SIZE_MAX);
+ MACRO(_SC_HOST_NAME_MAX);
+ MACRO(_SC_IOV_MAX);
+ MACRO(_SC_IPV6);
+ MACRO(_SC_JOB_CONTROL);
+ MACRO(_SC_LINE_MAX);
+ MACRO(_SC_LOGIN_NAME_MAX);
+ MACRO(_SC_MAPPED_FILES);
+ MACRO(_SC_MEMLOCK);
+ MACRO(_SC_MEMLOCK_RANGE);
+ MACRO(_SC_MEMORY_PROTECTION);
+ MACRO(_SC_MESSAGE_PASSING);
+ MACRO(_SC_MONOTONIC_CLOCK);
+ MACRO(_SC_MQ_OPEN_MAX);
+ MACRO(_SC_MQ_PRIO_MAX);
+ MACRO(_SC_NGROUPS_MAX);
+ MACRO(_SC_OPEN_MAX);
+ MACRO(_SC_PAGE_SIZE);
+ MACRO(_SC_PAGESIZE);
+ MACRO(_SC_PRIORITIZED_IO);
+ MACRO(_SC_PRIORITY_SCHEDULING);
+ MACRO(_SC_RAW_SOCKETS);
+ MACRO(_SC_RE_DUP_MAX);
+ MACRO(_SC_READER_WRITER_LOCKS);
+ MACRO(_SC_REALTIME_SIGNALS);
+ MACRO(_SC_REGEXP);
+ MACRO(_SC_RTSIG_MAX);
+ MACRO(_SC_SAVED_IDS);
+ MACRO(_SC_SEM_NSEMS_MAX);
+ MACRO(_SC_SEM_VALUE_MAX);
+ MACRO(_SC_SEMAPHORES);
+ MACRO(_SC_SHARED_MEMORY_OBJECTS);
+ MACRO(_SC_SHELL);
+ MACRO(_SC_SIGQUEUE_MAX);
+ MACRO(_SC_SPAWN);
+ MACRO(_SC_SPIN_LOCKS);
+ MACRO(_SC_SPORADIC_SERVER);
+ MACRO(_SC_SS_REPL_MAX);
+ MACRO(_SC_STREAM_MAX);
+ MACRO(_SC_SYMLOOP_MAX);
+ MACRO(_SC_SYNCHRONIZED_IO);
+ MACRO(_SC_THREAD_ATTR_STACKADDR);
+ MACRO(_SC_THREAD_ATTR_STACKSIZE);
+ MACRO(_SC_THREAD_CPUTIME);
+ MACRO(_SC_THREAD_DESTRUCTOR_ITERATIONS);
+ MACRO(_SC_THREAD_KEYS_MAX);
+ MACRO(_SC_THREAD_PRIO_INHERIT);
+ MACRO(_SC_THREAD_PRIO_PROTECT);
+ MACRO(_SC_THREAD_PRIORITY_SCHEDULING);
+ MACRO(_SC_THREAD_PROCESS_SHARED);
+ MACRO(_SC_THREAD_ROBUST_PRIO_INHERIT);
+ MACRO(_SC_THREAD_ROBUST_PRIO_PROTECT);
+ MACRO(_SC_THREAD_SAFE_FUNCTIONS);
+ MACRO(_SC_THREAD_SPORADIC_SERVER);
+ MACRO(_SC_THREAD_STACK_MIN);
+ MACRO(_SC_THREAD_THREADS_MAX);
+ MACRO(_SC_THREADS);
+ MACRO(_SC_TIMEOUTS);
+ MACRO(_SC_TIMER_MAX);
+ MACRO(_SC_TIMERS);
+ MACRO(_SC_TRACE);
+ MACRO(_SC_TRACE_EVENT_FILTER);
+ MACRO(_SC_TRACE_EVENT_NAME_MAX);
+ MACRO(_SC_TRACE_INHERIT);
+ MACRO(_SC_TRACE_LOG);
+ MACRO(_SC_TRACE_NAME_MAX);
+ MACRO(_SC_TRACE_SYS_MAX);
+ MACRO(_SC_TRACE_USER_EVENT_MAX);
+ MACRO(_SC_TYPED_MEMORY_OBJECTS);
+ MACRO(_SC_TZNAME_MAX);
+ MACRO(_SC_V7_ILP32_OFF32);
+ MACRO(_SC_VERSION);
+ MACRO(_SC_XOPEN_CRYPT);
+ MACRO(_SC_XOPEN_ENH_I18N);
+ MACRO(_SC_XOPEN_REALTIME);
+ MACRO(_SC_XOPEN_REALTIME_THREADS);
+ MACRO(_SC_XOPEN_SHM);
+ MACRO(_SC_XOPEN_STREAMS);
+ MACRO(_SC_XOPEN_UNIX);
+#if 0 // No libc I can find actually has this.
+ MACRO(_SC_XOPEN_UUCP);
+#endif
+ MACRO(_SC_XOPEN_VERSION);
+
+ MACRO_VALUE(STDERR_FILENO, 2);
+ MACRO_VALUE(STDIN_FILENO, 0);
+ MACRO_VALUE(STDOUT_FILENO, 1);
+
+ MACRO(_POSIX_VDISABLE);
+
+ TYPE(size_t);
+ TYPE(ssize_t);
+ TYPE(uid_t);
+ TYPE(gid_t);
+ TYPE(off_t);
+ TYPE(pid_t);
+ TYPE(intptr_t);
+
+ FUNCTION(access, int (*f)(const char*, int));
+ FUNCTION(alarm, unsigned (*f)(unsigned));
+ FUNCTION(chdir, int (*f)(const char*));
+ FUNCTION(chown, int (*f)(const char*, uid_t, gid_t));
+ FUNCTION(close, int (*f)(int));
+#if !defined(__BIONIC__)
+ FUNCTION(confstr, size_t (*f)(int, char*, size_t));
+ FUNCTION(crypt, char* (*f)(const char*, const char*));
+#endif
+ FUNCTION(dup, int (*f)(int));
+ FUNCTION(dup2, int (*f)(int, int));
+ FUNCTION(_exit, void (*f)(int));
+#if !defined(__BIONIC__)
+ FUNCTION(encrypt, void (*f)(char[64], int));
+#endif
+ FUNCTION(execl, int (*f)(const char*, const char*, ...));
+ FUNCTION(execle, int (*f)(const char*, const char*, ...));
+ FUNCTION(execlp, int (*f)(const char*, const char*, ...));
+ FUNCTION(execv, int (*f)(const char*, char* const[]));
+ FUNCTION(execve, int (*f)(const char*, char* const[], char* const[]));
+ FUNCTION(execvp, int (*f)(const char*, char* const[]));
+ FUNCTION(faccessat, int (*f)(int, const char*, int, int));
+ FUNCTION(fchdir, int (*f)(int));
+ FUNCTION(fchown, int (*f)(int, uid_t, gid_t));
+ FUNCTION(fchownat, int (*f)(int, const char*, uid_t, gid_t, int));
+ FUNCTION(fdatasync, int (*f)(int));
+ FUNCTION(fexecve, int (*f)(int, char* const[], char* const[]));
+ FUNCTION(fork, pid_t (*f)(void));
+ FUNCTION(fpathconf, long (*f)(int, int));
+ FUNCTION(fsync, int (*f)(int));
+ FUNCTION(ftruncate, int (*f)(int, off_t));
+ FUNCTION(getcwd, char* (*f)(char*, size_t));
+ FUNCTION(getegid, gid_t (*f)(void));
+ FUNCTION(geteuid, uid_t (*f)(void));
+ FUNCTION(getgid, gid_t (*f)(void));
+ FUNCTION(getgroups, int (*f)(int, gid_t[]));
+#if !defined(__BIONIC__)
+ FUNCTION(gethostid, long (*f)(void));
+#endif
+ FUNCTION(gethostname, int (*f)(char*, size_t));
+ FUNCTION(getlogin, char* (*f)(void));
+ FUNCTION(getlogin_r, int (*f)(char*, size_t));
+ FUNCTION(getopt, int (*f)(int, char* const[], const char*));
+ FUNCTION(getpgid, pid_t (*f)(pid_t));
+ FUNCTION(getpgrp, pid_t (*f)(void));
+ FUNCTION(getpid, pid_t (*f)(void));
+ FUNCTION(getppid, pid_t (*f)(void));
+ FUNCTION(getsid, pid_t (*f)(pid_t));
+ FUNCTION(getuid, uid_t (*f)(void));
+ FUNCTION(isatty, int (*f)(int));
+ FUNCTION(lchown, int (*f)(const char*, uid_t, gid_t));
+ FUNCTION(link, int (*f)(const char*, const char*));
+ FUNCTION(linkat, int (*f)(int, const char*, int, const char*, int));
+ FUNCTION(lockf, int (*f)(int, int, off_t));
+ FUNCTION(lseek, off_t (*f)(int, off_t, int));
+ FUNCTION(nice, int (*f)(int));
+ FUNCTION(pathconf, long (*f)(const char*, int));
+ FUNCTION(pause, int (*f)(void));
+ FUNCTION(pipe, int (*f)(int[2]));
+ FUNCTION(pread, ssize_t (*f)(int, void*, size_t, off_t));
+ FUNCTION(pwrite, ssize_t (*f)(int, const void*, size_t, off_t));
+ FUNCTION(read, ssize_t (*f)(int, void*, size_t));
+ FUNCTION(readlink, ssize_t (*f)(const char*, char*, size_t));
+ FUNCTION(readlinkat, ssize_t (*f)(int, const char*, char*, size_t));
+ FUNCTION(rmdir, int (*f)(const char*));
+ FUNCTION(setegid, int (*f)(gid_t));
+ FUNCTION(seteuid, int (*f)(uid_t));
+ FUNCTION(setgid, int (*f)(gid_t));
+ FUNCTION(setpgid, int (*f)(pid_t, pid_t));
+ FUNCTION(setpgrp, pid_t (*f)(void));
+ FUNCTION(setregid, int (*f)(gid_t, gid_t));
+ FUNCTION(setreuid, int (*f)(uid_t, uid_t));
+ FUNCTION(setsid, pid_t (*f)(void));
+ FUNCTION(setuid, int (*f)(uid_t));
+ FUNCTION(sleep, unsigned (*f)(unsigned));
+ FUNCTION(swab, void (*f)(const void*, void*, ssize_t));
+ FUNCTION(symlink, int (*f)(const char*, const char*));
+ FUNCTION(symlinkat, int (*f)(const char*, int, const char*));
+ FUNCTION(sync, void (*f)(void));
+ FUNCTION(sysconf, long (*f)(int));
+ FUNCTION(tcgetpgrp, pid_t (*f)(int));
+ FUNCTION(tcsetpgrp, int (*f)(int, pid_t));
+ FUNCTION(truncate, int (*f)(const char*, off_t));
+ FUNCTION(ttyname, char* (*f)(int));
+ FUNCTION(ttyname_r, int (*f)(int, char*, size_t));
+ FUNCTION(unlink, int (*f)(const char*));
+ FUNCTION(unlinkat, int (*f)(int, const char*, int));
+ FUNCTION(write, ssize_t (*f)(int, const void*, size_t));
+
+ char* cp;
+ cp = optarg;
+ int i;
+ i = opterr;
+ i = optind;
+ i = optopt;
+}
diff --git a/tests/headers/posix/utime_h.c b/tests/headers/posix/utime_h.c
new file mode 100644
index 0000000..c5b304b
--- /dev/null
+++ b/tests/headers/posix/utime_h.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <utime.h>
+
+#include "header_checks.h"
+
+static void utime_h() {
+ TYPE(struct utimbuf);
+ STRUCT_MEMBER(struct utimbuf, time_t, actime);
+ STRUCT_MEMBER(struct utimbuf, time_t, modtime);
+
+ TYPE(time_t);
+
+ FUNCTION(utime, int (*f)(const char*, const struct utimbuf*));
+}
diff --git a/tests/headers/posix/wchar_h.c b/tests/headers/posix/wchar_h.c
new file mode 100644
index 0000000..48b3b92
--- /dev/null
+++ b/tests/headers/posix/wchar_h.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <wchar.h>
+
+#include "header_checks.h"
+
+static void wchar_h() {
+ TYPE(FILE*);
+ TYPE(locale_t);
+ TYPE(mbstate_t);
+ TYPE(size_t);
+ TYPE(va_list);
+ TYPE(wchar_t);
+ TYPE(wctype_t);
+ TYPE(wint_t);
+
+ MACRO(WCHAR_MAX);
+ MACRO(WCHAR_MIN);
+ MACRO(WEOF);
+ MACRO(NULL);
+
+ FUNCTION(btowc, wint_t (*f)(int));
+ FUNCTION(fgetwc, wint_t (*f)(FILE*));
+ FUNCTION(fgetws, wchar_t* (*f)(wchar_t*, int, FILE*));
+ FUNCTION(fputwc, wint_t (*f)(wchar_t, FILE*));
+ FUNCTION(fputws, int (*f)(const wchar_t*, FILE*));
+ FUNCTION(fwide, int (*f)(FILE*, int));
+ FUNCTION(fwprintf, int (*f)(FILE*, const wchar_t*, ...));
+ FUNCTION(fwscanf, int (*f)(FILE*, const wchar_t*, ...));
+ FUNCTION(getwc, wint_t (*f)(FILE*));
+ FUNCTION(getwchar, wint_t (*f)(void));
+ FUNCTION(mbrlen, size_t (*f)(const char*, size_t, mbstate_t*));
+ FUNCTION(mbrtowc, size_t (*f)(wchar_t*, const char*, size_t, mbstate_t*));
+ FUNCTION(mbsinit, int (*f)(const mbstate_t*));
+ FUNCTION(mbsnrtowcs, size_t (*f)(wchar_t*, const char**, size_t, size_t, mbstate_t*));
+ FUNCTION(mbsrtowcs, size_t (*f)(wchar_t*, const char**, size_t, mbstate_t*));
+ FUNCTION(open_wmemstream, FILE* (*f)(wchar_t**, size_t*));
+ FUNCTION(putwc, wint_t (*f)(wchar_t, FILE*));
+ FUNCTION(putwchar, wint_t (*f)(wchar_t));
+ FUNCTION(swprintf, int (*f)(wchar_t*, size_t, const wchar_t*, ...));
+ FUNCTION(swscanf, int (*f)(const wchar_t*, const wchar_t*, ...));
+ FUNCTION(ungetwc, wint_t (*f)(wint_t, FILE*));
+ FUNCTION(vfwprintf, int (*f)(FILE*, const wchar_t*, va_list));
+ FUNCTION(vfwscanf, int (*f)(FILE*, const wchar_t*, va_list));
+ FUNCTION(vswprintf, int (*f)(wchar_t*, size_t, const wchar_t*, va_list));
+ FUNCTION(vswscanf, int (*f)(const wchar_t*, const wchar_t*, va_list));
+ FUNCTION(vwprintf, int (*f)(const wchar_t*, va_list));
+ FUNCTION(vwscanf, int (*f)(const wchar_t*, va_list));
+ FUNCTION(wcpcpy, wchar_t* (*f)(wchar_t*, const wchar_t*));
+ FUNCTION(wcpncpy, wchar_t* (*f)(wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wcrtomb, size_t (*f)(char*, wchar_t, mbstate_t*));
+ FUNCTION(wcscasecmp, int (*f)(const wchar_t*, const wchar_t*));
+ FUNCTION(wcscasecmp_l, int (*f)(const wchar_t*, const wchar_t*, locale_t));
+ FUNCTION(wcscat, wchar_t* (*f)(wchar_t*, const wchar_t*));
+ FUNCTION(wcschr, wchar_t* (*f)(const wchar_t*, wchar_t));
+ FUNCTION(wcscmp, int (*f)(const wchar_t*, const wchar_t*));
+ FUNCTION(wcscoll, int (*f)(const wchar_t*, const wchar_t*));
+ FUNCTION(wcscoll_l, int (*f)(const wchar_t*, const wchar_t*, locale_t));
+ FUNCTION(wcscpy, wchar_t* (*f)(wchar_t*, const wchar_t*));
+ FUNCTION(wcscspn, size_t (*f)(const wchar_t*, const wchar_t*));
+ FUNCTION(wcsdup, wchar_t* (*f)(const wchar_t*));
+ FUNCTION(wcsftime, size_t (*f)(wchar_t*, size_t, const wchar_t*, const struct tm*));
+ FUNCTION(wcslen, size_t (*f)(const wchar_t*));
+ FUNCTION(wcsncasecmp, int (*f)(const wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wcsncasecmp_l, int (*f)(const wchar_t*, const wchar_t*, size_t, locale_t));
+ FUNCTION(wcsncat, wchar_t* (*f)(wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wcsncmp, int (*f)(const wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wcsncpy, wchar_t* (*f)(wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wcsnlen, size_t (*f)(const wchar_t*, size_t));
+ FUNCTION(wcsnrtombs, size_t (*f)(char*, const wchar_t**, size_t, size_t, mbstate_t*));
+ FUNCTION(wcspbrk, wchar_t* (*f)(const wchar_t*, const wchar_t*));
+ FUNCTION(wcsrchr, wchar_t* (*f)(const wchar_t*, wchar_t));
+ FUNCTION(wcsrtombs, size_t (*f)(char*, const wchar_t**, size_t, mbstate_t*));
+ FUNCTION(wcsspn, size_t (*f)(const wchar_t*, const wchar_t*));
+ FUNCTION(wcsstr, wchar_t* (*f)(const wchar_t*, const wchar_t*));
+ FUNCTION(wcstod, double (*f)(const wchar_t*, wchar_t**));
+ FUNCTION(wcstof, float (*f)(const wchar_t*, wchar_t**));
+ FUNCTION(wcstok, wchar_t* (*f)(wchar_t*, const wchar_t*, wchar_t**));
+ FUNCTION(wcstol, long (*f)(const wchar_t*, wchar_t**, int));
+ FUNCTION(wcstold, long double (*f)(const wchar_t*, wchar_t**));
+ FUNCTION(wcstoll, long long (*f)(const wchar_t*, wchar_t**, int));
+ FUNCTION(wcstoul, unsigned long (*f)(const wchar_t*, wchar_t**, int));
+ FUNCTION(wcstoull, unsigned long long (*f)(const wchar_t*, wchar_t**, int));
+ FUNCTION(wcswidth, int (*f)(const wchar_t*, size_t));
+ FUNCTION(wcsxfrm, size_t (*f)(wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wcsxfrm_l, size_t (*f)(wchar_t*, const wchar_t*, size_t, locale_t));
+ FUNCTION(wctob, int (*f)(wint_t));
+ FUNCTION(wcwidth, int (*f)(wchar_t));
+ FUNCTION(wmemchr, wchar_t* (*f)(const wchar_t*, wchar_t, size_t));
+ FUNCTION(wmemcmp, int (*f)(const wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wmemcpy, wchar_t* (*f)(wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wmemmove, wchar_t* (*f)(wchar_t*, const wchar_t*, size_t));
+ FUNCTION(wmemset, wchar_t* (*f)(wchar_t*, wchar_t, size_t));
+ FUNCTION(wprintf, int (*f)(const wchar_t*, ...));
+ FUNCTION(wscanf, int (*f)(const wchar_t*, ...));
+}
diff --git a/tests/headers/posix/wctype_h.c b/tests/headers/posix/wctype_h.c
new file mode 100644
index 0000000..c5839d5
--- /dev/null
+++ b/tests/headers/posix/wctype_h.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <wctype.h>
+
+#include "header_checks.h"
+
+static void wctype_h() {
+ TYPE(wint_t);
+ TYPE(wctrans_t);
+ TYPE(wctype_t);
+ TYPE(locale_t);
+
+ MACRO(WEOF);
+
+ FUNCTION(iswalnum, int (*f)(wint_t));
+ FUNCTION(iswalnum_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswalpha, int (*f)(wint_t));
+ FUNCTION(iswalpha_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswblank, int (*f)(wint_t));
+ FUNCTION(iswblank_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswcntrl, int (*f)(wint_t));
+ FUNCTION(iswcntrl_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswctype, int (*f)(wint_t, wctype_t));
+ FUNCTION(iswctype_l, int (*f)(wint_t, wctype_t, locale_t));
+ FUNCTION(iswdigit, int (*f)(wint_t));
+ FUNCTION(iswdigit_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswgraph, int (*f)(wint_t));
+ FUNCTION(iswgraph_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswlower, int (*f)(wint_t));
+ FUNCTION(iswlower_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswprint, int (*f)(wint_t));
+ FUNCTION(iswprint_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswpunct, int (*f)(wint_t));
+ FUNCTION(iswpunct_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswspace, int (*f)(wint_t));
+ FUNCTION(iswspace_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswupper, int (*f)(wint_t));
+ FUNCTION(iswupper_l, int (*f)(wint_t, locale_t));
+ FUNCTION(iswxdigit, int (*f)(wint_t));
+ FUNCTION(iswxdigit_l, int (*f)(wint_t, locale_t));
+ FUNCTION(towctrans, wint_t (*f)(wint_t, wctrans_t));
+ FUNCTION(towctrans_l, wint_t (*f)(wint_t, wctrans_t, locale_t));
+ FUNCTION(towlower, wint_t (*f)(wint_t));
+ FUNCTION(towlower_l, wint_t (*f)(wint_t, locale_t));
+ FUNCTION(towupper, wint_t (*f)(wint_t));
+ FUNCTION(towupper_l, wint_t (*f)(wint_t, locale_t));
+ FUNCTION(wctrans, wctrans_t (*f)(const char*));
+ FUNCTION(wctrans_l, wctrans_t (*f)(const char*, locale_t));
+ FUNCTION(wctype, wctype_t (*f)(const char*));
+ FUNCTION(wctype_l, wctype_t (*f)(const char*, locale_t));
+}