Merge "Refactor BufferOutputStream."
diff --git a/libc/Android.bp b/libc/Android.bp
index b0e0d8c..be45f40 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1385,6 +1385,7 @@
     defaults: ["libc_defaults"],
     srcs: [
         "bionic/NetdClientDispatch.cpp",
+        "bionic/__bionic_get_shell_path.cpp",
         "bionic/__cmsg_nxthdr.cpp",
         "bionic/__errno.cpp",
         "bionic/__gnu_basename.cpp",
@@ -1399,6 +1400,7 @@
         "bionic/assert.cpp",
         "bionic/atof.cpp",
         "bionic/bionic_arc4random.cpp",
+        "bionic/bionic_futex.cpp",
         "bionic/bionic_netlink.cpp",
         "bionic/bionic_systrace.cpp",
         "bionic/bionic_time_conversions.cpp",
diff --git a/libc/arch-arm/generic/bionic/strlen.c b/libc/arch-arm/generic/bionic/strlen.c
index f6b9209..dccd564 100644
--- a/libc/arch-arm/generic/bionic/strlen.c
+++ b/libc/arch-arm/generic/bionic/strlen.c
@@ -67,53 +67,46 @@
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
+        "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
 #if !defined(__OPTIMIZE_SIZE__)
-        "bne     1f                         \n"
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
         "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
         "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
         "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
         "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
         "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
         "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
         "sub     %[t], %[v], %[mask], lsr #7\n"
         "and     %[t], %[t], %[mask]        \n"
         "bics    %[t], %[t], %[v]           \n"
-        "it      eq                         \n"
-        "ldreq   %[v], [%[s]], #4           \n"
+        "bne     1f                         \n"
+        "ldr     %[v], [%[s]], #4           \n"
 #endif
-        "beq     0b                         \n"
+        "b       0b                         \n"
         "1:                                 \n"
         "add     %[l], %[l], %[s]           \n"
         "tst     %[v], #0xFF                \n"
diff --git a/libc/bionic/__bionic_get_shell_path.cpp b/libc/bionic/__bionic_get_shell_path.cpp
new file mode 100644
index 0000000..477fa4a
--- /dev/null
+++ b/libc/bionic/__bionic_get_shell_path.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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 <string.h>
+#include <sys/cdefs.h>
+#include <unistd.h>
+
+__LIBC_HIDDEN__ static const char* __libc_system_sh = "/system/bin/sh";
+__LIBC_HIDDEN__ static const char* __libc_vendor_sh = "/vendor/bin/sh";
+
+static const char* init_sh_path() {
+  /* look for /system or /vendor prefix */
+  char exe_path[7];
+  ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path));
+  if (len != -1 && !strncmp(exe_path, __libc_vendor_sh, sizeof(exe_path))) {
+    return __libc_vendor_sh;
+  }
+
+  return __libc_system_sh;
+}
+
+__LIBC_HIDDEN__ extern "C" const char* __bionic_get_shell_path() {
+  static const char* sh_path = init_sh_path();
+  return sh_path;
+}
diff --git a/libc/bionic/__cxa_guard.cpp b/libc/bionic/__cxa_guard.cpp
index 06926df..30b5f41 100644
--- a/libc/bionic/__cxa_guard.cpp
+++ b/libc/bionic/__cxa_guard.cpp
@@ -104,7 +104,7 @@
       }
     }
 
-    __futex_wait_ex(&gv->state, false, CONSTRUCTION_UNDERWAY_WITH_WAITER, false, nullptr);
+    __futex_wait_ex(&gv->state, false, CONSTRUCTION_UNDERWAY_WITH_WAITER);
     old_value = atomic_load_explicit(&gv->state, memory_order_acquire);
   }
 }
diff --git a/libc/bionic/bionic_futex.cpp b/libc/bionic/bionic_futex.cpp
new file mode 100644
index 0000000..dd66e40
--- /dev/null
+++ b/libc/bionic/bionic_futex.cpp
@@ -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 "private/bionic_futex.h"
+
+#include <time.h>
+
+#include "private/bionic_time_conversions.h"
+
+int __futex_wait_ex(volatile void* ftx, bool shared, int value, bool use_realtime_clock,
+                    const timespec* abs_timeout) {
+  const timespec* futex_abs_timeout = abs_timeout;
+  // pthread's and semaphore's default behavior is to use CLOCK_REALTIME, however this behavior is
+  // essentially never intended, as that clock is prone to change discontinuously.
+  //
+  // What users really intend is to use CLOCK_MONOTONIC, however only pthread_cond_timedwait()
+  // provides this as an option and even there, a large amount of existing code does not opt into
+  // CLOCK_MONOTONIC.
+  //
+  // We have seen numerous bugs directly attributable to this difference.  Therefore, we provide
+  // this general workaround to always use CLOCK_MONOTONIC for waiting, regardless of what the input
+  // timespec is.
+  timespec converted_monotonic_abs_timeout;
+  if (abs_timeout && use_realtime_clock) {
+    monotonic_time_from_realtime_time(converted_monotonic_abs_timeout, *abs_timeout);
+    if (converted_monotonic_abs_timeout.tv_sec < 0) {
+      return -ETIMEDOUT;
+    }
+    futex_abs_timeout = &converted_monotonic_abs_timeout;
+  }
+
+  return __futex(ftx, (shared ? FUTEX_WAIT_BITSET : FUTEX_WAIT_BITSET_PRIVATE), value,
+                 futex_abs_timeout, FUTEX_BITSET_MATCH_ANY);
+}
diff --git a/libc/bionic/bionic_time_conversions.cpp b/libc/bionic/bionic_time_conversions.cpp
index ade3a55..d21e12e 100644
--- a/libc/bionic/bionic_time_conversions.cpp
+++ b/libc/bionic/bionic_time_conversions.cpp
@@ -51,3 +51,24 @@
   tv.tv_sec = ts.tv_sec;
   tv.tv_usec = ts.tv_nsec / 1000;
 }
+
+void monotonic_time_from_realtime_time(timespec& monotonic_time, const timespec& realtime_time) {
+  monotonic_time = realtime_time;
+
+  timespec cur_monotonic_time;
+  clock_gettime(CLOCK_MONOTONIC, &cur_monotonic_time);
+  timespec cur_realtime_time;
+  clock_gettime(CLOCK_REALTIME, &cur_realtime_time);
+
+  monotonic_time.tv_nsec -= cur_realtime_time.tv_nsec;
+  monotonic_time.tv_nsec += cur_monotonic_time.tv_nsec;
+  if (monotonic_time.tv_nsec >= NS_PER_S) {
+    monotonic_time.tv_nsec -= NS_PER_S;
+    monotonic_time.tv_sec += 1;
+  } else if (monotonic_time.tv_nsec < 0) {
+    monotonic_time.tv_nsec += NS_PER_S;
+    monotonic_time.tv_sec -= 1;
+  }
+  monotonic_time.tv_sec -= cur_realtime_time.tv_sec;
+  monotonic_time.tv_sec += cur_monotonic_time.tv_sec;
+}
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 9197aa3..9be86f1 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -278,7 +278,7 @@
       munmap(thread->attr.stack_base, thread->mmap_size);
     }
     async_safe_format_log(ANDROID_LOG_WARN, "libc", "pthread_create failed: clone failed: %s",
-                          strerror(errno));
+                          strerror(clone_errno));
     return clone_errno;
   }
 
diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp
index a958699..6906ecd 100644
--- a/libc/bionic/system_properties.cpp
+++ b/libc/bionic/system_properties.cpp
@@ -1051,16 +1051,15 @@
     if (!initialize_properties_from_file("/system/etc/selinux/plat_property_contexts")) {
       return false;
     }
-    if (!initialize_properties_from_file("/vendor/etc/selinux/nonplat_property_contexts")) {
-      return false;
-    }
+    // Don't check for failure here, so we always have a sane list of properties.
+    // E.g. In case of recovery, the vendor partition will not have mounted and we
+    // still need the system / platform properties to function.
+    initialize_properties_from_file("/vendor/etc/selinux/nonplat_property_contexts");
   } else {
     if (!initialize_properties_from_file("/plat_property_contexts")) {
       return false;
     }
-    if (!initialize_properties_from_file("/nonplat_property_contexts")) {
-      return false;
-    }
+    initialize_properties_from_file("/nonplat_property_contexts");
   }
 
   return true;
diff --git a/libc/include/arpa/inet.h b/libc/include/arpa/inet.h
index d137130..db054c9 100644
--- a/libc/include/arpa/inet.h
+++ b/libc/include/arpa/inet.h
@@ -36,18 +36,18 @@
 
 __BEGIN_DECLS
 
-in_addr_t inet_addr(const char*);
-int inet_aton(const char*, struct in_addr*);
-in_addr_t inet_lnaof(struct in_addr) __INTRODUCED_IN(21);
-struct in_addr inet_makeaddr(in_addr_t, in_addr_t) __INTRODUCED_IN(21);
-in_addr_t inet_netof(struct in_addr) __INTRODUCED_IN(21);
-in_addr_t inet_network(const char*) __INTRODUCED_IN(21);
-char* inet_ntoa(struct in_addr);
-const char* inet_ntop(int, const void*, char*, socklen_t);
-unsigned int inet_nsap_addr(const char*, unsigned char*, int);
-char* inet_nsap_ntoa(int, const unsigned char*, char*);
-int inet_pton(int, const char*, void*);
+in_addr_t inet_addr(const char* __s);
+int inet_aton(const char* __s, struct in_addr* __addr);
+in_addr_t inet_lnaof(struct in_addr __addr) __INTRODUCED_IN(21);
+struct in_addr inet_makeaddr(in_addr_t __net, in_addr_t __host) __INTRODUCED_IN(21);
+in_addr_t inet_netof(struct in_addr __addr) __INTRODUCED_IN(21);
+in_addr_t inet_network(const char* __s) __INTRODUCED_IN(21);
+char* inet_ntoa(struct in_addr __addr);
+const char* inet_ntop(int __af, const void* __src, char* __dst, socklen_t __size);
+unsigned int inet_nsap_addr(const char* __ascii, unsigned char* __binary, int __n);
+char* inet_nsap_ntoa(int __binary_length, const unsigned char* __binary, char* __ascii);
+int inet_pton(int __af, const char* __src, void* __dst);
 
 __END_DECLS
 
-#endif /* _ARPA_INET_H_ */
+#endif
diff --git a/libc/include/arpa/nameser.h b/libc/include/arpa/nameser.h
index 9507f49..ffb5250 100644
--- a/libc/include/arpa/nameser.h
+++ b/libc/include/arpa/nameser.h
@@ -562,63 +562,61 @@
 #define	ns_makecanon		__ns_makecanon
 #define	ns_samename		__ns_samename
 
-int ns_msg_getflag(ns_msg, int);
-uint16_t ns_get16(const u_char*);
-uint32_t ns_get32(const u_char*);
-void ns_put16(uint16_t, u_char*);
-void ns_put32(uint32_t, u_char*);
-int ns_initparse(const u_char*, int, ns_msg*);
-int ns_skiprr(const u_char*, const u_char*, ns_sect, int);
-int ns_parserr(ns_msg*, ns_sect, int, ns_rr*);
-int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t);
-int ns_sprintrrf(const u_char*, size_t, const char*, ns_class, ns_type, u_long, const u_char*,
-                 size_t, const char*, const char*, char*, size_t);
-int ns_format_ttl(u_long, char*, size_t);
-int ns_name_ntol(const u_char*, u_char*, size_t);
-int ns_name_ntop(const u_char*, char*, size_t);
-int ns_name_pton(const char*, u_char*, size_t);
-int ns_name_unpack(const u_char*, const u_char*, const u_char*, u_char*, size_t);
-int ns_name_pack(const u_char*, u_char*, int, const u_char**, const u_char**);
-int ns_name_uncompress(const u_char*, const u_char*, const u_char*, char*, size_t);
-int ns_name_compress(const char*, u_char*, size_t, const u_char**, const u_char**);
-int ns_name_skip(const u_char**, const u_char*);
-void ns_name_rollback(const u_char*, const u_char**, const u_char**);
+int ns_msg_getflag(ns_msg __handle, int __flag);
+uint16_t ns_get16(const u_char* __src);
+uint32_t ns_get32(const u_char* __src);
+void ns_put16(uint16_t __src, u_char* __dst);
+void ns_put32(uint32_t __src, u_char* __dst);
+int ns_initparse(const u_char* __msg, int __msg_size, ns_msg* __handle);
+int ns_skiprr(const u_char* __ptr, const u_char* __eom, ns_sect __section, int __count);
+int ns_parserr(ns_msg* __handle, ns_sect __section, int __rr_number, ns_rr* __rr);
+int ns_sprintrr(const ns_msg* __handle, const ns_rr* __rr, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size);
+int ns_sprintrrf(const u_char* __msg, size_t __msg_size, const char* __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* __rdata, size_t __rdata_size, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size);
+int ns_format_ttl(u_long __ttl, char* __dst, size_t __dst_size);
+int ns_name_ntol(const u_char* __src, u_char* __dst, size_t __dst_size);
+int ns_name_ntop(const u_char* __src, char* __dst, size_t __dst_size);
+int ns_name_pton(const char* __src, u_char* __dst, size_t __dst_size);
+int ns_name_unpack(const u_char* __msg, const u_char* __eom, const u_char* __src, u_char* __dst, size_t __dst_size);
+int ns_name_pack(const u_char* __src, u_char* __dst, int __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr);
+int ns_name_uncompress(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, size_t __dst_size);
+int ns_name_compress(const char* __src, u_char* __dst, size_t __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr);
+int ns_name_skip(const u_char** __ptr_ptr, const u_char* __eom);
+void ns_name_rollback(const u_char* __src, const u_char** __dn_ptrs, const u_char** __last_dn_ptr);
 
-int ns_makecanon(const char*, char*, size_t);
-int ns_samename(const char*, const char*);
+int ns_makecanon(const char* __src, char* __dst, size_t __dst_size);
+int ns_samename(const char* __lhs, const char* __rhs);
 
 #else
 /* The names of these symbols were accidentally prefixed with __ in L. */
 /* The duplication here is intentional to avoid declaring different symbols with the same
  * declaration. */
-int ns_msg_getflag(ns_msg, int) __INTRODUCED_IN_64(23);
-uint16_t ns_get16(const u_char*) __INTRODUCED_IN_64(23);
-uint32_t ns_get32(const u_char*) __INTRODUCED_IN_64(23);
-void ns_put16(uint16_t, u_char*) __INTRODUCED_IN_64(23);
-void ns_put32(uint32_t, u_char*) __INTRODUCED_IN_64(23);
-int ns_initparse(const u_char*, int, ns_msg*) __INTRODUCED_IN_64(23);
-int ns_skiprr(const u_char*, const u_char*, ns_sect, int) __INTRODUCED_IN_64(23);
-int ns_parserr(ns_msg*, ns_sect, int, ns_rr*) __INTRODUCED_IN_64(23);
-int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t)
+int ns_msg_getflag(ns_msg __handle, int __flag) __INTRODUCED_IN_64(23);
+uint16_t ns_get16(const u_char* __src) __INTRODUCED_IN_64(23);
+uint32_t ns_get32(const u_char* __src) __INTRODUCED_IN_64(23);
+void ns_put16(uint16_t __src, u_char* __dst) __INTRODUCED_IN_64(23);
+void ns_put32(uint32_t __src, u_char* __dst) __INTRODUCED_IN_64(23);
+int ns_initparse(const u_char* __msg, int __msg_size, ns_msg* __handle) __INTRODUCED_IN_64(23);
+int ns_skiprr(const u_char* __ptr, const u_char* __eom, ns_sect __section, int __count) __INTRODUCED_IN_64(23);
+int ns_parserr(ns_msg* __handle, ns_sect __section, int __rr_number, ns_rr* __rr) __INTRODUCED_IN_64(23);
+int ns_sprintrr(const ns_msg* __handle, const ns_rr* __rr, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size)
   __INTRODUCED_IN_64(23);
-int ns_sprintrrf(const u_char*, size_t, const char*, ns_class, ns_type, u_long, const u_char*,
-                 size_t, const char*, const char*, char*, size_t) __INTRODUCED_IN_64(23);
-int ns_format_ttl(u_long, char*, size_t) __INTRODUCED_IN_64(23);
-int ns_name_ntol(const u_char*, u_char*, size_t) __INTRODUCED_IN_64(23);
-int ns_name_ntop(const u_char*, char*, size_t) __INTRODUCED_IN_64(23);
-int ns_name_pton(const char*, u_char*, size_t) __INTRODUCED_IN_64(23);
-int ns_name_unpack(const u_char*, const u_char*, const u_char*, u_char*, size_t)
+int ns_sprintrrf(const u_char* __msg, size_t __msg_size, const char* __name, ns_class __class, ns_type __type, u_long __ttl, const u_char* __rdata, size_t __rdata_size, const char* __name_ctx, const char* __origin, char* __buf, size_t __buf_size) __INTRODUCED_IN_64(23);
+int ns_format_ttl(u_long __ttl, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_ntol(const u_char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_ntop(const u_char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_pton(const char* __src, u_char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_name_unpack(const u_char* __msg, const u_char* __eom, const u_char* __src, u_char* __dst, size_t __dst_size)
   __INTRODUCED_IN_64(23);
-int ns_name_pack(const u_char*, u_char*, int, const u_char**, const u_char**) __INTRODUCED_IN_64(23);
-int ns_name_uncompress(const u_char*, const u_char*, const u_char*, char*, size_t)
+int ns_name_pack(const u_char* __src, u_char* __dst, int __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(23);
+int ns_name_uncompress(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, size_t __dst_size)
   __INTRODUCED_IN_64(23);
-int ns_name_compress(const char*, u_char*, size_t, const u_char**, const u_char**)
+int ns_name_compress(const char* __src, u_char* __dst, size_t __dst_size, const u_char** __dn_ptrs, const u_char** __last_dn_ptr)
   __INTRODUCED_IN_64(23);
-int ns_name_skip(const u_char**, const u_char*) __INTRODUCED_IN_64(23);
-void ns_name_rollback(const u_char*, const u_char**, const u_char**) __INTRODUCED_IN_64(23);
+int ns_name_skip(const u_char** __ptr_ptr, const u_char* __eom) __INTRODUCED_IN_64(23);
+void ns_name_rollback(const u_char* __src, const u_char** __dn_ptrs, const u_char** __last_dn_ptr) __INTRODUCED_IN_64(23);
 
-int ns_makecanon(const char*, char*, size_t) __INTRODUCED_IN_64(23);
-int ns_samename(const char*, const char*) __INTRODUCED_IN_64(23);
+int ns_makecanon(const char* __src, char* __dst, size_t __dst_size) __INTRODUCED_IN_64(23);
+int ns_samename(const char* __lhs, const char* __rhs) __INTRODUCED_IN_64(23);
 #endif /* !defined(__LP64__) */
 
 __END_DECLS
diff --git a/libc/include/assert.h b/libc/include/assert.h
index 8c456ef..7a9d84d 100644
--- a/libc/include/assert.h
+++ b/libc/include/assert.h
@@ -60,6 +60,6 @@
 #endif
 
 __BEGIN_DECLS
-void __assert(const char*, int, const char*) __noreturn;
-void __assert2(const char*, int, const char*, const char*) __noreturn;
+void __assert(const char* __file, int __line, const char* __msg) __noreturn;
+void __assert2(const char* __file, int __line, const char* __function, const char* __msg) __noreturn;
 __END_DECLS
diff --git a/libc/include/complex.h b/libc/include/complex.h
index c020e4f..79fe07c 100644
--- a/libc/include/complex.h
+++ b/libc/include/complex.h
@@ -59,102 +59,102 @@
 
 /* 7.3.5 Trigonometric functions */
 /* 7.3.5.1 The cacos functions */
-double complex cacos(double complex) __INTRODUCED_IN(23);
-float complex cacosf(float complex) __INTRODUCED_IN(23);
-long double complex cacosl(long double complex) __INTRODUCED_IN(26);
+double complex cacos(double complex __z) __INTRODUCED_IN(23);
+float complex cacosf(float complex __z) __INTRODUCED_IN(23);
+long double complex cacosl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.5.2 The casin functions */
-double complex casin(double complex) __INTRODUCED_IN(23);
-float complex casinf(float complex) __INTRODUCED_IN(23);
-long double complex casinl(long double complex) __INTRODUCED_IN(26);
+double complex casin(double complex __z) __INTRODUCED_IN(23);
+float complex casinf(float complex __z) __INTRODUCED_IN(23);
+long double complex casinl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.5.1 The catan functions */
-double complex catan(double complex) __INTRODUCED_IN(23);
-float complex catanf(float complex) __INTRODUCED_IN(23);
-long double complex catanl(long double complex) __INTRODUCED_IN(26);
+double complex catan(double complex __z) __INTRODUCED_IN(23);
+float complex catanf(float complex __z) __INTRODUCED_IN(23);
+long double complex catanl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.5.1 The ccos functions */
-double complex ccos(double complex) __INTRODUCED_IN(23);
-float complex ccosf(float complex) __INTRODUCED_IN(23);
-long double complex ccosl(long double complex) __INTRODUCED_IN(26);
+double complex ccos(double complex __z) __INTRODUCED_IN(23);
+float complex ccosf(float complex __z) __INTRODUCED_IN(23);
+long double complex ccosl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.5.1 The csin functions */
-double complex csin(double complex) __INTRODUCED_IN(23);
-float complex csinf(float complex) __INTRODUCED_IN(23);
-long double complex csinl(long double complex) __INTRODUCED_IN(26);
+double complex csin(double complex __z) __INTRODUCED_IN(23);
+float complex csinf(float complex __z) __INTRODUCED_IN(23);
+long double complex csinl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.5.1 The ctan functions */
-double complex ctan(double complex) __INTRODUCED_IN(23);
-float complex ctanf(float complex) __INTRODUCED_IN(23);
-long double complex ctanl(long double complex) __INTRODUCED_IN(26);
+double complex ctan(double complex __z) __INTRODUCED_IN(23);
+float complex ctanf(float complex __z) __INTRODUCED_IN(23);
+long double complex ctanl(long double complex __z) __INTRODUCED_IN(26);
 
 /* 7.3.6 Hyperbolic functions */
 /* 7.3.6.1 The cacosh functions */
-double complex cacosh(double complex) __INTRODUCED_IN(23);
-float complex cacoshf(float complex) __INTRODUCED_IN(23);
-long double complex cacoshl(long double complex) __INTRODUCED_IN(26);
+double complex cacosh(double complex __z) __INTRODUCED_IN(23);
+float complex cacoshf(float complex __z) __INTRODUCED_IN(23);
+long double complex cacoshl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.6.2 The casinh functions */
-double complex casinh(double complex) __INTRODUCED_IN(23);
-float complex casinhf(float complex) __INTRODUCED_IN(23);
-long double complex casinhl(long double complex) __INTRODUCED_IN(26);
+double complex casinh(double complex __z) __INTRODUCED_IN(23);
+float complex casinhf(float complex __z) __INTRODUCED_IN(23);
+long double complex casinhl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.6.3 The catanh functions */
-double complex catanh(double complex) __INTRODUCED_IN(23);
-float complex catanhf(float complex) __INTRODUCED_IN(23);
-long double complex catanhl(long double complex) __INTRODUCED_IN(26);
+double complex catanh(double complex __z) __INTRODUCED_IN(23);
+float complex catanhf(float complex __z) __INTRODUCED_IN(23);
+long double complex catanhl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.6.4 The ccosh functions */
-double complex ccosh(double complex) __INTRODUCED_IN(23);
-float complex ccoshf(float complex) __INTRODUCED_IN(23);
-long double complex ccoshl(long double complex) __INTRODUCED_IN(26);
+double complex ccosh(double complex __z) __INTRODUCED_IN(23);
+float complex ccoshf(float complex __z) __INTRODUCED_IN(23);
+long double complex ccoshl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.6.5 The csinh functions */
-double complex csinh(double complex) __INTRODUCED_IN(23);
-float complex csinhf(float complex) __INTRODUCED_IN(23);
-long double complex csinhl(long double complex) __INTRODUCED_IN(26);
+double complex csinh(double complex __z) __INTRODUCED_IN(23);
+float complex csinhf(float complex __z) __INTRODUCED_IN(23);
+long double complex csinhl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.6.6 The ctanh functions */
-double complex ctanh(double complex) __INTRODUCED_IN(23);
-float complex ctanhf(float complex) __INTRODUCED_IN(23);
-long double complex ctanhl(long double complex) __INTRODUCED_IN(26);
+double complex ctanh(double complex __z) __INTRODUCED_IN(23);
+float complex ctanhf(float complex __z) __INTRODUCED_IN(23);
+long double complex ctanhl(long double complex __z) __INTRODUCED_IN(26);
 
 /* 7.3.7 Exponential and logarithmic functions */
 /* 7.3.7.1 The cexp functions */
-double complex cexp(double complex) __INTRODUCED_IN(23);
-float complex cexpf(float complex) __INTRODUCED_IN(23);
-long double complex cexpl(long double complex) __INTRODUCED_IN(26);
+double complex cexp(double complex __z) __INTRODUCED_IN(23);
+float complex cexpf(float complex __z) __INTRODUCED_IN(23);
+long double complex cexpl(long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.7.2 The clog functions */
-double complex clog(double complex) __INTRODUCED_IN(26);
-float complex clogf(float complex) __INTRODUCED_IN(26);
-long double complex clogl(long double complex) __INTRODUCED_IN(26);
+double complex clog(double complex __z) __INTRODUCED_IN(26);
+float complex clogf(float complex __z) __INTRODUCED_IN(26);
+long double complex clogl(long double complex __z) __INTRODUCED_IN(26);
 
 /* 7.3.8 Power and absolute-value functions */
 /* 7.3.8.1 The cabs functions */
-double cabs(double complex) __INTRODUCED_IN(23);
-float cabsf(float complex) __INTRODUCED_IN(23);
-long double cabsl(long double complex) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
+double cabs(double complex __z) __INTRODUCED_IN(23);
+float cabsf(float complex __z) __INTRODUCED_IN(23);
+long double cabsl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
 /* 7.3.8.2 The cpow functions */
-double complex cpow(double complex, double complex) __INTRODUCED_IN(26);
-float complex cpowf(float complex, float complex) __INTRODUCED_IN(26);
-long double complex cpowl(long double complex, long double complex) __INTRODUCED_IN(26);
+double complex cpow(double complex __x, double complex __z) __INTRODUCED_IN(26);
+float complex cpowf(float complex __x, float complex __z) __INTRODUCED_IN(26);
+long double complex cpowl(long double complex __x, long double complex __z) __INTRODUCED_IN(26);
 /* 7.3.8.3 The csqrt functions */
-double complex csqrt(double complex) __INTRODUCED_IN(23);
-float complex csqrtf(float complex) __INTRODUCED_IN(23);
-long double complex csqrtl(long double complex) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
+double complex csqrt(double complex __z) __INTRODUCED_IN(23);
+float complex csqrtf(float complex __z) __INTRODUCED_IN(23);
+long double complex csqrtl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
 
 /* 7.3.9 Manipulation functions */
 /* 7.3.9.1 The carg functions */
-double carg(double complex) __INTRODUCED_IN(23);
-float cargf(float complex) __INTRODUCED_IN(23);
-long double cargl(long double complex) __INTRODUCED_IN(23);
+double carg(double complex __z) __INTRODUCED_IN(23);
+float cargf(float complex __z) __INTRODUCED_IN(23);
+long double cargl(long double complex __z) __INTRODUCED_IN(23);
 /* 7.3.9.2 The cimag functions */
-double cimag(double complex) __INTRODUCED_IN(23);
-float cimagf(float complex) __INTRODUCED_IN(23);
-long double cimagl(long double complex) __INTRODUCED_IN(23);
+double cimag(double complex __z) __INTRODUCED_IN(23);
+float cimagf(float complex __z) __INTRODUCED_IN(23);
+long double cimagl(long double complex __z) __INTRODUCED_IN(23);
 /* 7.3.9.3 The conj functions */
-double complex conj(double complex) __INTRODUCED_IN(23);
-float complex conjf(float complex) __INTRODUCED_IN(23);
-long double complex conjl(long double complex) __INTRODUCED_IN(23);
+double complex conj(double complex __z) __INTRODUCED_IN(23);
+float complex conjf(float complex __z) __INTRODUCED_IN(23);
+long double complex conjl(long double complex __z) __INTRODUCED_IN(23);
 /* 7.3.9.4 The cproj functions */
-double complex cproj(double complex) __INTRODUCED_IN(23);
-float complex cprojf(float complex) __INTRODUCED_IN(23);
-long double complex cprojl(long double complex) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
+double complex cproj(double complex __z) __INTRODUCED_IN(23);
+float complex cprojf(float complex __z) __INTRODUCED_IN(23);
+long double complex cprojl(long double complex __z) __INTRODUCED_IN_32(21) __INTRODUCED_IN_64(23);
 /* 7.3.9.5 The creal functions */
-double creal(double complex) __INTRODUCED_IN(23);
-float crealf(float complex) __INTRODUCED_IN(23);
-long double creall(long double complex) __INTRODUCED_IN(23);
+double creal(double complex __z) __INTRODUCED_IN(23);
+float crealf(float complex __z) __INTRODUCED_IN(23);
+long double creall(long double complex __z) __INTRODUCED_IN(23);
 
 __END_DECLS
 
-#endif /* _COMPLEX_H */
+#endif
diff --git a/libc/include/ctype.h b/libc/include/ctype.h
index 84dd5aa..df11cb1 100644
--- a/libc/include/ctype.h
+++ b/libc/include/ctype.h
@@ -61,45 +61,45 @@
 
 extern const char* _ctype_;
 
-int isalnum(int);
-int isalpha(int);
-int isblank(int);
-int iscntrl(int);
-int isdigit(int);
-int isgraph(int);
-int islower(int);
-int isprint(int);
-int ispunct(int);
-int isspace(int);
-int isupper(int);
-int isxdigit(int);
-int tolower(int);
-int toupper(int);
+int isalnum(int __ch);
+int isalpha(int __ch);
+int isblank(int __ch);
+int iscntrl(int __ch);
+int isdigit(int __ch);
+int isgraph(int __ch);
+int islower(int __ch);
+int isprint(int __ch);
+int ispunct(int __ch);
+int isspace(int __ch);
+int isupper(int __ch);
+int isxdigit(int __ch);
+int tolower(int __ch);
+int toupper(int __ch);
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-int isalnum_l(int, locale_t) __INTRODUCED_IN(21);
-int isalpha_l(int, locale_t) __INTRODUCED_IN(21);
-int isblank_l(int, locale_t) __INTRODUCED_IN(21);
-int iscntrl_l(int, locale_t) __INTRODUCED_IN(21);
-int isdigit_l(int, locale_t) __INTRODUCED_IN(21);
-int isgraph_l(int, locale_t) __INTRODUCED_IN(21);
-int islower_l(int, locale_t) __INTRODUCED_IN(21);
-int isprint_l(int, locale_t) __INTRODUCED_IN(21);
-int ispunct_l(int, locale_t) __INTRODUCED_IN(21);
-int isspace_l(int, locale_t) __INTRODUCED_IN(21);
-int isupper_l(int, locale_t) __INTRODUCED_IN(21);
-int isxdigit_l(int, locale_t) __INTRODUCED_IN(21);
-int tolower_l(int, locale_t) __INTRODUCED_IN(21);
-int toupper_l(int, locale_t) __INTRODUCED_IN(21);
+int isalnum_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isalpha_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isblank_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int iscntrl_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isdigit_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isgraph_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int islower_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isprint_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int ispunct_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isspace_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isupper_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int isxdigit_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int tolower_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
+int toupper_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
 #else
 // Implemented as static inlines before 21.
 #endif
 
-int isascii(int);
-int toascii(int);
-int _tolower(int) __INTRODUCED_IN(21);
-int _toupper(int) __INTRODUCED_IN(21);
+int isascii(int __ch);
+int toascii(int __ch);
+int _tolower(int __ch) __INTRODUCED_IN(21);
+int _toupper(int __ch) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* !_CTYPE_H_ */
+#endif
diff --git a/libc/include/dirent.h b/libc/include/dirent.h
index ebcf085..7ac4ab7 100644
--- a/libc/include/dirent.h
+++ b/libc/include/dirent.h
@@ -76,30 +76,27 @@
 
 typedef struct DIR DIR;
 
-DIR* opendir(const char*);
-DIR* fdopendir(int);
-struct dirent* readdir(DIR*);
-struct dirent64* readdir64(DIR*) __INTRODUCED_IN(21);
-int readdir_r(DIR*, struct dirent*, struct dirent**);
-int readdir64_r(DIR*, struct dirent64*, struct dirent64**) __INTRODUCED_IN(21);
-int closedir(DIR*);
-void rewinddir(DIR*);
-void seekdir(DIR*, long) __INTRODUCED_IN(23);
-long telldir(DIR*) __INTRODUCED_IN(23);
-int dirfd(DIR*);
-int alphasort(const struct dirent**, const struct dirent**);
-int alphasort64(const struct dirent64**, const struct dirent64**) __INTRODUCED_IN(21);
-int scandir64(const char*, struct dirent64***, int (*)(const struct dirent64*),
-              int (*)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(21);
-int scandir(const char*, struct dirent***, int (*)(const struct dirent*), int (*)(const struct dirent**, const struct dirent**));
+DIR* opendir(const char* __path);
+DIR* fdopendir(int __dir_fd);
+struct dirent* readdir(DIR* __dir);
+struct dirent64* readdir64(DIR* __dir) __INTRODUCED_IN(21);
+int readdir_r(DIR* __dir, struct dirent* __entry, struct dirent** __buffer);
+int readdir64_r(DIR* __dir, struct dirent64* __entry, struct dirent64** __buffer) __INTRODUCED_IN(21);
+int closedir(DIR* __dir);
+void rewinddir(DIR* __dir);
+void seekdir(DIR* __dir, long __location) __INTRODUCED_IN(23);
+long telldir(DIR* __dir) __INTRODUCED_IN(23);
+int dirfd(DIR* __dir);
+int alphasort(const struct dirent** __lhs, const struct dirent** __rhs);
+int alphasort64(const struct dirent64** __lhs, const struct dirent64** __rhs) __INTRODUCED_IN(21);
+int scandir64(const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(21);
+int scandir(const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**));
 
 #if defined(__USE_GNU)
-int scandirat64(int, const char*, struct dirent64***, int (*)(const struct dirent64*),
-                int (*)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(24);
-int scandirat(int, const char*, struct dirent***, int (*)(const struct dirent*),
-              int (*)(const struct dirent**, const struct dirent**)) __INTRODUCED_IN(24);
+int scandirat64(int __dir_fd, const char* __path, struct dirent64*** __name_list, int (*__filter)(const struct dirent64*), int (*__comparator)(const struct dirent64**, const struct dirent64**)) __INTRODUCED_IN(24);
+int scandirat(int __dir_fd, const char* __path, struct dirent*** __name_list, int (*__filter)(const struct dirent*), int (*__comparator)(const struct dirent**, const struct dirent**)) __INTRODUCED_IN(24);
 #endif
 
 __END_DECLS
 
-#endif /* _DIRENT_H_ */
+#endif
diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h
index 76bbdb8..68d8bc9 100644
--- a/libc/include/dlfcn.h
+++ b/libc/include/dlfcn.h
@@ -45,12 +45,12 @@
   void* dli_saddr;
 } Dl_info;
 
-void* dlopen(const char* filename, int flag);
-int dlclose(void* handle);
+void* dlopen(const char* __filename, int __flag);
+int dlclose(void* __handle);
 char* dlerror(void);
-void* dlsym(void* handle, const char* symbol);
-void* dlvsym(void* handle, const char* symbol, const char* version) __INTRODUCED_IN(24);
-int dladdr(const void* addr, Dl_info* info);
+void* dlsym(void* __handle, const char* __symbol);
+void* dlvsym(void* __handle, const char* __symbol, const char* __version) __INTRODUCED_IN(24);
+int dladdr(const void* __addr, Dl_info* __info);
 
 #define RTLD_LOCAL    0
 #define RTLD_LAZY     0x00001
@@ -77,4 +77,4 @@
 
 __END_DECLS
 
-#endif /* __DLFCN_H */
+#endif
diff --git a/libc/include/err.h b/libc/include/err.h
index 7ee3608..a64d01d 100644
--- a/libc/include/err.h
+++ b/libc/include/err.h
@@ -41,18 +41,14 @@
 
 __BEGIN_DECLS
 
-/* printf's format string isn't nullable; the err family's one is,
- * so we can't use __errlike here. */
-#define __errlike(x, y) __attribute__((__format__(printf, x, y)))
-
-__noreturn void err(int, const char *, ...) __errlike(2, 3);
-__noreturn void verr(int, const char *, va_list) __errlike(2, 0);
-__noreturn void errx(int, const char *, ...) __errlike(2, 3);
-__noreturn void verrx(int, const char *, va_list) __errlike(2, 0);
-void warn(const char *, ...) __errlike(1, 2);
-void vwarn(const char *, va_list) __errlike(1, 0);
-void warnx(const char *, ...) __errlike(1, 2);
-void vwarnx(const char *, va_list) __errlike(1, 0);
+__noreturn void err(int __status, const char* __fmt, ...) __printflike(2, 3);
+__noreturn void verr(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
+__noreturn void errx(int __status, const char* __fmt, ...) __printflike(2, 3);
+__noreturn void verrx(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
+void warn(const char* __fmt, ...) __printflike(1, 2);
+void vwarn(const char* __fmt, va_list __args) __printflike(1, 0);
+void warnx(const char* __fmt, ...) __printflike(1, 2);
+void vwarnx(const char* __fmt, va_list __args) __printflike(1, 0);
 
 __END_DECLS
 
diff --git a/libc/include/error.h b/libc/include/error.h
index b145afc..d612994 100644
--- a/libc/include/error.h
+++ b/libc/include/error.h
@@ -37,8 +37,8 @@
 extern unsigned int error_message_count __INTRODUCED_IN(23);
 extern int error_one_per_line __INTRODUCED_IN(23);
 
-void error(int, int, const char*, ...) __printflike(3, 4) __INTRODUCED_IN(23);
-void error_at_line(int, int, const char*, unsigned int, const char*, ...)
+void error(int __status, int __errno, const char* __fmt, ...) __printflike(3, 4) __INTRODUCED_IN(23);
+void error_at_line(int __status, int __errno, const char* __filename, unsigned int __line_number, const char* __fmt, ...)
     __printflike(5, 6) __INTRODUCED_IN(23);
 
 __END_DECLS
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index cd52b45..4852f5f 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -69,26 +69,26 @@
 #define SYNC_FILE_RANGE_WAIT_AFTER 4
 #endif
 
-int creat(const char*, mode_t);
-int creat64(const char*, mode_t) __INTRODUCED_IN(21);
-int openat(int, const char*, int, ...) __overloadable __RENAME_CLANG(openat);
-int openat64(int, const char*, int, ...) __INTRODUCED_IN(21);
-int open(const char*, int, ...) __overloadable __RENAME_CLANG(open);
-int open64(const char*, int, ...) __INTRODUCED_IN(21);
-ssize_t splice(int, off64_t*, int, off64_t*, size_t, unsigned int) __INTRODUCED_IN(21);
-ssize_t tee(int, int, size_t, unsigned int) __INTRODUCED_IN(21);
-ssize_t vmsplice(int, const struct iovec*, size_t, unsigned int) __INTRODUCED_IN(21);
+int creat(const char* __path, mode_t __mode);
+int creat64(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
+int openat(int __dir_fd, const char* __path, int __flags, ...) __overloadable __RENAME_CLANG(openat);
+int openat64(int __dir_fd, const char* __path, int __flags, ...) __INTRODUCED_IN(21);
+int open(const char* __path, int __flags, ...) __overloadable __RENAME_CLANG(open);
+int open64(const char* __path, int __flags, ...) __INTRODUCED_IN(21);
+ssize_t splice(int __in_fd, off64_t* __in_offset, int __out_fd, off64_t* __out_offset, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
+ssize_t tee(int __in_fd, int __out_fd, size_t __length, unsigned int __flags) __INTRODUCED_IN(21);
+ssize_t vmsplice(int __fd, const struct iovec* __iov, size_t __count, unsigned int __flags) __INTRODUCED_IN(21);
 
-int fallocate(int, int, off_t, off_t) __RENAME_IF_FILE_OFFSET64(fallocate64) __INTRODUCED_IN(21);
-int fallocate64(int, int, off64_t, off64_t) __INTRODUCED_IN(21);
-int posix_fadvise(int, off_t, off_t, int) __RENAME_IF_FILE_OFFSET64(posix_fadvise64) __INTRODUCED_IN(21);
-int posix_fadvise64(int, off64_t, off64_t, int) __INTRODUCED_IN(21);
-int posix_fallocate(int, off_t, off_t) __RENAME_IF_FILE_OFFSET64(posix_fallocate64) __INTRODUCED_IN(21);
-int posix_fallocate64(int, off64_t, off64_t) __INTRODUCED_IN(21);
+int fallocate(int __fd, int __mode, off_t __offset, off_t __length) __RENAME_IF_FILE_OFFSET64(fallocate64) __INTRODUCED_IN(21);
+int fallocate64(int __fd, int __mode, off64_t __offset, off64_t __length) __INTRODUCED_IN(21);
+int posix_fadvise(int __fd, off_t __offset, off_t __length, int __advice) __RENAME_IF_FILE_OFFSET64(posix_fadvise64) __INTRODUCED_IN(21);
+int posix_fadvise64(int __fd, off64_t __offset, off64_t __length, int __advice) __INTRODUCED_IN(21);
+int posix_fallocate(int __fd, off_t __offset, off_t __length) __RENAME_IF_FILE_OFFSET64(posix_fallocate64) __INTRODUCED_IN(21);
+int posix_fallocate64(int __fd, off64_t __offset, off64_t __length) __INTRODUCED_IN(21);
 
 #if defined(__USE_GNU)
-ssize_t readahead(int, off64_t, size_t) __INTRODUCED_IN(16);
-int sync_file_range(int, off64_t, off64_t, unsigned int) __INTRODUCED_IN(26);
+ssize_t readahead(int __fd, off64_t __offset, size_t __length) __INTRODUCED_IN(16);
+int sync_file_range(int __fd, off64_t __offset, off64_t __length, unsigned int __flags) __INTRODUCED_IN(26);
 #endif
 
 #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
@@ -97,4 +97,4 @@
 
 __END_DECLS
 
-#endif /* _FCNTL_H */
+#endif
diff --git a/libc/include/fenv.h b/libc/include/fenv.h
index a4c37e6..ae35ae3 100644
--- a/libc/include/fenv.h
+++ b/libc/include/fenv.h
@@ -37,25 +37,25 @@
 
 // fenv was always available on x86.
 #if __ANDROID_API__ >= __ANDROID_API_L__ || defined(__i386__)
-int feclearexcept(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fegetexceptflag(fexcept_t*, int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
+int feclearexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fegetexceptflag(fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
     __INTRODUCED_IN_X86(9);
-int feraiseexcept(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fesetexceptflag(const fexcept_t*, int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
+int feraiseexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fesetexceptflag(const fexcept_t* __flag_ptr, int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
     __INTRODUCED_IN_X86(9);
-int fetestexcept(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fetestexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 
 int fegetround(void) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fesetround(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fesetround(int __rounding_mode) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 
-int fegetenv(fenv_t*) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int feholdexcept(fenv_t*) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fesetenv(const fenv_t*) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int feupdateenv(const fenv_t*) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
+int fegetenv(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int feholdexcept(fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fesetenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int feupdateenv(const fenv_t* __env) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
     __INTRODUCED_IN_X86(9);
 
-int feenableexcept(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
-int fedisableexcept(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int feenableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
+int fedisableexcept(int __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 int fegetexcept(void) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 #else
 /* Defined as inlines for pre-21 ARM and MIPS. */
diff --git a/libc/include/fnmatch.h b/libc/include/fnmatch.h
index 1a5348b..3fcc665 100644
--- a/libc/include/fnmatch.h
+++ b/libc/include/fnmatch.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _FNMATCH_H
 #define _FNMATCH_H
 
@@ -44,8 +45,8 @@
 #define FNM_IGNORECASE   FNM_CASEFOLD
 #define FNM_FILE_NAME    FNM_PATHNAME
 
-int fnmatch(const char* pattern, const char* string, int flags);
+int fnmatch(const char* __pattern, const char* __string, int __flags);
 
 __END_DECLS
 
-#endif /* _FNMATCH_H */
+#endif
diff --git a/libc/include/ftw.h b/libc/include/ftw.h
index cb8ae7d..300f624 100644
--- a/libc/include/ftw.h
+++ b/libc/include/ftw.h
@@ -55,12 +55,12 @@
 };
 
 __BEGIN_DECLS
-int ftw(const char*, int (*)(const char*, const struct stat*, int), int) __INTRODUCED_IN(17);
-int nftw(const char*, int (*)(const char*, const struct stat*, int, struct FTW*), int, int)
+int ftw(const char* __dir_path, int (*__callback)(const char*, const struct stat*, int), int __max_fd_count) __INTRODUCED_IN(17);
+int nftw(const char* __dir_path, int (*__callback)(const char*, const struct stat*, int, struct FTW*), int __max_fd_count, int __flags)
   __INTRODUCED_IN(17);
-int ftw64(const char*, int (*)(const char*, const struct stat64*, int), int) __INTRODUCED_IN(21);
-int nftw64(const char*, int (*)(const char*, const struct stat64*, int, struct FTW*), int, int)
+int ftw64(const char* __dir_path, int (*__callback)(const char*, const struct stat64*, int), int __max_fd_count) __INTRODUCED_IN(21);
+int nftw64(const char* __dir_path, int (*__callback)(const char*, const struct stat64*, int, struct FTW*), int __max_fd_count, int __flags)
   __INTRODUCED_IN(21);
 __END_DECLS
 
-#endif	/* !_FTW_H */
+#endif
diff --git a/libc/include/getopt.h b/libc/include/getopt.h
index 46d2eb7..c5a6106 100644
--- a/libc/include/getopt.h
+++ b/libc/include/getopt.h
@@ -59,10 +59,8 @@
 };
 
 __BEGIN_DECLS
-int	getopt_long(int, char * const *, const char *,
-	const struct option *, int *);
-int	getopt_long_only(int, char * const *, const char *,
-	const struct option *, int *);
+int getopt_long(int __argc, char* const* __argv, const char* __options, const struct option* __long_options, int* __long_index);
+int getopt_long_only(int __argc, char* const* __argv, const char* __options, const struct option* __long_options, int* __long_index);
 
 #ifndef _OPTRESET_DECLARED
 #define	_OPTRESET_DECLARED
@@ -70,4 +68,4 @@
 #endif
 __END_DECLS
  
-#endif /* !_GETOPT_H_ */
+#endif
diff --git a/libc/include/grp.h b/libc/include/grp.h
index b727562..9d67adf 100644
--- a/libc/include/grp.h
+++ b/libc/include/grp.h
@@ -47,19 +47,19 @@
 
 __BEGIN_DECLS
 
-struct group* getgrgid(gid_t);
-struct group* getgrnam(const char*);
+struct group* getgrgid(gid_t __gid);
+struct group* getgrnam(const char* __name);
 
 /* Note: Android has thousands and thousands of ids to iterate through. */
 struct group* getgrent(void) __INTRODUCED_IN(26);
 
 void setgrent(void) __INTRODUCED_IN(26);
 void endgrent(void) __INTRODUCED_IN(26);
-int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**) __INTRODUCED_IN(24);
-int getgrnam_r(const char*, struct group*, char*, size_t, struct group**) __INTRODUCED_IN(24);
-int getgrouplist (const char*, gid_t, gid_t*, int*);
-int initgroups (const char*, gid_t);
+int getgrgid_r(gid_t __gid, struct group* __group, char* __buf, size_t __n, struct group** __result) __INTRODUCED_IN(24);
+int getgrnam_r(const char* __name, struct group* __group, char* __buf, size_t __n, struct group** __result) __INTRODUCED_IN(24);
+int getgrouplist(const char* __user, gid_t __group, gid_t* __groups, int* __group_count);
+int initgroups(const char* __user, gid_t __group);
 
 __END_DECLS
 
-#endif /* !_GRP_H_ */
+#endif
diff --git a/libc/include/ifaddrs.h b/libc/include/ifaddrs.h
index 083b27a..0e2b0ea 100644
--- a/libc/include/ifaddrs.h
+++ b/libc/include/ifaddrs.h
@@ -51,8 +51,8 @@
 #define ifa_broadaddr ifa_ifu.ifu_broadaddr
 #define ifa_dstaddr ifa_ifu.ifu_dstaddr
 
-void freeifaddrs(struct ifaddrs*) __INTRODUCED_IN(24);
-int getifaddrs(struct ifaddrs**) __INTRODUCED_IN(24);
+void freeifaddrs(struct ifaddrs* __ptr) __INTRODUCED_IN(24);
+int getifaddrs(struct ifaddrs** __list_ptr) __INTRODUCED_IN(24);
 
 __END_DECLS
 
diff --git a/libc/include/inttypes.h b/libc/include/inttypes.h
index 43474df..7a409d8 100644
--- a/libc/include/inttypes.h
+++ b/libc/include/inttypes.h
@@ -255,12 +255,12 @@
 } imaxdiv_t;
 
 __BEGIN_DECLS
-intmax_t imaxabs(intmax_t) __attribute_const__ __INTRODUCED_IN(19);
-imaxdiv_t imaxdiv(intmax_t, intmax_t) __attribute_const__ __INTRODUCED_IN(19);
-intmax_t strtoimax(const char*, char**, int);
-uintmax_t strtoumax(const char*, char**, int);
-intmax_t wcstoimax(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21);
-uintmax_t wcstoumax(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21);
+intmax_t imaxabs(intmax_t __i) __attribute_const__ __INTRODUCED_IN(19);
+imaxdiv_t imaxdiv(intmax_t __numerator, intmax_t __denominator) __attribute_const__ __INTRODUCED_IN(19);
+intmax_t strtoimax(const char* __s, char** __end_ptr, int __base);
+uintmax_t strtoumax(const char* __s, char** __end_ptr, int __base);
+intmax_t wcstoimax(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
+uintmax_t wcstoumax(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
 __END_DECLS
 
-#endif /* _INTTYPES_H_ */
+#endif
diff --git a/libc/include/langinfo.h b/libc/include/langinfo.h
index c330117..d9d8c15 100644
--- a/libc/include/langinfo.h
+++ b/libc/include/langinfo.h
@@ -92,8 +92,8 @@
 #define NOEXPR 54
 #define CRNCYSTR 55
 
-char* nl_langinfo(nl_item) __INTRODUCED_IN(26);
-char* nl_langinfo_l(nl_item, locale_t) __INTRODUCED_IN(26);
+char* nl_langinfo(nl_item __item) __INTRODUCED_IN(26);
+char* nl_langinfo_l(nl_item __item, locale_t __l) __INTRODUCED_IN(26);
 
 __END_DECLS
 
diff --git a/libc/include/libgen.h b/libc/include/libgen.h
index f864ee1..5fa9089 100644
--- a/libc/include/libgen.h
+++ b/libc/include/libgen.h
@@ -32,7 +32,6 @@
 #include <sys/cdefs.h>
 #include <sys/types.h>
 
-
 __BEGIN_DECLS
 
 /*
@@ -42,19 +41,19 @@
  * Note that this has the wrong argument cv-qualifiers, but doesn't modify its
  * input and uses thread-local storage for the result if necessary.
  */
-char* __posix_basename(const char*) __RENAME(basename);
+char* __posix_basename(const char* __path) __RENAME(basename);
 
 #define basename __posix_basename
 
 /* This has the wrong argument cv-qualifiers, but doesn't modify its input and uses thread-local storage for the result if necessary. */
-char* dirname(const char*);
+char* dirname(const char* __path);
 
 #if !defined(__LP64__)
 /* These non-standard functions are not needed on Android; basename and dirname use thread-local storage. */
-int dirname_r(const char*, char*, size_t);
-int basename_r(const char*, char*, size_t);
+int dirname_r(const char* __path, char* __buf, size_t __n);
+int basename_r(const char* __path, char* __buf, size_t __n);
 #endif
 
 __END_DECLS
 
-#endif /* _LIBGEN_H */
+#endif
diff --git a/libc/include/link.h b/libc/include/link.h
index dd3b99f..072f093 100644
--- a/libc/include/link.h
+++ b/libc/include/link.h
@@ -50,9 +50,9 @@
 };
 
 #if defined(__arm__)
-int dl_iterate_phdr(int (*)(struct dl_phdr_info*, size_t, void*), void*) __INTRODUCED_IN(21);
+int dl_iterate_phdr(int (*__callback)(struct dl_phdr_info*, size_t, void*), void* __data) __INTRODUCED_IN(21);
 #else
-int dl_iterate_phdr(int (*)(struct dl_phdr_info*, size_t, void*), void*);
+int dl_iterate_phdr(int (*__callback)(struct dl_phdr_info*, size_t, void*), void* __data);
 #endif
 
 #ifdef __arm__
@@ -84,4 +84,4 @@
 
 __END_DECLS
 
-#endif /* _LINK_H_ */
+#endif
diff --git a/libc/include/locale.h b/libc/include/locale.h
index c1b6299..4290992 100644
--- a/libc/include/locale.h
+++ b/libc/include/locale.h
@@ -98,14 +98,14 @@
 
 struct lconv* localeconv(void) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
 
-locale_t duplocale(locale_t) __INTRODUCED_IN(21);
-void freelocale(locale_t) __INTRODUCED_IN(21);
-locale_t newlocale(int, const char*, locale_t) __INTRODUCED_IN(21);
-char* setlocale(int, const char*);
-locale_t uselocale(locale_t) __INTRODUCED_IN(21);
+locale_t duplocale(locale_t __l) __INTRODUCED_IN(21);
+void freelocale(locale_t __l) __INTRODUCED_IN(21);
+locale_t newlocale(int __category_mask, const char* __locale_name, locale_t __base) __INTRODUCED_IN(21);
+char* setlocale(int __category, const char* __locale_name);
+locale_t uselocale(locale_t __l) __INTRODUCED_IN(21);
 
 #define LC_GLOBAL_LOCALE __BIONIC_CAST(reinterpret_cast, locale_t, -1L)
 
 __END_DECLS
 
-#endif /* _LOCALE_H_ */
+#endif
diff --git a/libc/include/math.h b/libc/include/math.h
index 7dd1539..248ed3c 100644
--- a/libc/include/math.h
+++ b/libc/include/math.h
@@ -89,69 +89,69 @@
  * as __attribute_const__. In C99, FENV_ACCESS affects the purity of these functions.
  */
 
-int __fpclassifyd(double) __attribute_const__;
-int __fpclassifyf(float) __attribute_const__;
-int __fpclassifyl(long double) __attribute_const__;
-int __isfinitef(float) __attribute_const__;
-int __isfinite(double) __attribute_const__;
-int __isfinitel(long double) __attribute_const__;
-int __isinff(float) __attribute_const__;
-int __isinfl(long double) __attribute_const__;
-int __isnanf(float) __attribute_const__ __INTRODUCED_IN(21);
-int __isnanl(long double) __attribute_const__;
-int __isnormalf(float) __attribute_const__;
-int __isnormal(double) __attribute_const__;
-int __isnormall(long double) __attribute_const__;
-int __signbit(double) __attribute_const__;
-int __signbitf(float) __attribute_const__;
-int __signbitl(long double) __attribute_const__;
+int __fpclassifyd(double __x) __attribute_const__;
+int __fpclassifyf(float __x) __attribute_const__;
+int __fpclassifyl(long double __x) __attribute_const__;
+int __isfinitef(float __x) __attribute_const__;
+int __isfinite(double __x) __attribute_const__;
+int __isfinitel(long double __x) __attribute_const__;
+int __isinff(float __x) __attribute_const__;
+int __isinfl(long double __x) __attribute_const__;
+int __isnanf(float __x) __attribute_const__ __INTRODUCED_IN(21);
+int __isnanl(long double __x) __attribute_const__;
+int __isnormalf(float __x) __attribute_const__;
+int __isnormal(double __x) __attribute_const__;
+int __isnormall(long double __x) __attribute_const__;
+int __signbit(double __x) __attribute_const__;
+int __signbitf(float __x) __attribute_const__;
+int __signbitl(long double __x) __attribute_const__;
 
-double	acos(double);
-double	asin(double);
-double	atan(double);
-double	atan2(double, double);
-double	cos(double);
-double	sin(double);
-double	tan(double);
+double acos(double __x);
+double asin(double __x);
+double atan(double __x);
+double atan2(double __y, double __x);
+double cos(double __x);
+double sin(double __x);
+double tan(double __x);
 
-double	cosh(double);
-double	sinh(double);
-double	tanh(double);
+double cosh(double __x);
+double sinh(double __x);
+double tanh(double __x);
 
-double	exp(double);
-double	frexp(double, int *);	/* fundamentally !__attribute_const__ */
-double	ldexp(double, int);
-double	log(double);
-double	log10(double);
-double	modf(double, double *);	/* fundamentally !__attribute_const__ */
+double exp(double __x);
+double frexp(double __x, int* __exponent); /* fundamentally !__attribute_const__ */
+double ldexp(double __x, int __exponent);
+double log(double __x);
+double log10(double __x);
+double modf(double __x, double* __integral_part); /* fundamentally !__attribute_const__ */
 
-double	pow(double, double);
-double	sqrt(double);
+double pow(double __x, double __y);
+double sqrt(double __x);
 
-double	ceil(double);
-double	fabs(double) __attribute_const__;
-double	floor(double);
-double	fmod(double, double);
+double ceil(double __x);
+double fabs(double __x) __attribute_const__;
+double floor(double __x);
+double fmod(double __x, double __y);
 
-double	acosh(double);
-double	asinh(double);
-double	atanh(double);
-double	cbrt(double);
-double	erf(double);
-double	erfc(double);
-double	exp2(double);
-double	expm1(double);
-double	fma(double, double, double);
-double	hypot(double, double);
-int	ilogb(double) __attribute_const__;
-double	lgamma(double);
-long long llrint(double);
-long long llround(double);
-double	log1p(double);
-double log2(double) __INTRODUCED_IN(18);
-double	logb(double);
-long	lrint(double);
-long	lround(double);
+double acosh(double __x);
+double asinh(double __x);
+double atanh(double __x);
+double cbrt(double __x);
+double erf(double __x);
+double erfc(double __x);
+double exp2(double __x);
+double expm1(double __x);
+double fma(double __x, double __y, double __z);
+double hypot(double __x, double __y);
+int ilogb(double __x) __attribute_const__;
+double lgamma(double __x);
+long long llrint(double __x);
+long long llround(double __x);
+double log1p(double __x);
+double log2(double __x) __INTRODUCED_IN(18);
+double logb(double __x);
+long lrint(double __x);
+long lround(double __x);
 
 /*
  * https://code.google.com/p/android/issues/detail?id=271629
@@ -164,160 +164,160 @@
  * to the std namespace, making it impossible to use both <cmath> (which gets
  * included by a lot of other standard headers) and ::isnan.
  */
-int(isinf)(double) __attribute_const__ __INTRODUCED_IN(21);
-int	(isnan)(double) __attribute_const__;
+int (isinf)(double __x) __attribute_const__ __INTRODUCED_IN(21);
+int (isnan)(double __x) __attribute_const__;
 
-double nan(const char*) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
+double nan(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
     __INTRODUCED_IN_X86(9);
 
-double	nextafter(double, double);
-double	remainder(double, double);
-double	remquo(double, double, int*);
-double	rint(double);
+double nextafter(double __x, double __y);
+double remainder(double __x, double __y);
+double remquo(double __x, double __y, int* __quotient_bits);
+double rint(double __x);
 
-double	copysign(double, double) __attribute_const__;
-double	fdim(double, double);
-double	fmax(double, double) __attribute_const__;
-double	fmin(double, double) __attribute_const__;
-double	nearbyint(double);
-double	round(double);
-double scalbln(double, long) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
-double scalbn(double, int);
-double	tgamma(double);
-double	trunc(double);
+double copysign(double __value, double __sign) __attribute_const__;
+double fdim(double __x, double __y);
+double fmax(double __x, double __y) __attribute_const__;
+double fmin(double __x, double __y) __attribute_const__;
+double nearbyint(double __x);
+double round(double __x);
+double scalbln(double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
+double scalbn(double __x, int __exponent);
+double tgamma(double __x);
+double trunc(double __x);
 
-float	acosf(float);
-float	asinf(float);
-float	atanf(float);
-float	atan2f(float, float);
-float	cosf(float);
-float	sinf(float);
-float	tanf(float);
+float acosf(float __x);
+float asinf(float __x);
+float atanf(float __x);
+float atan2f(float __y, float __x);
+float cosf(float __x);
+float sinf(float __x);
+float tanf(float __x);
 
-float	coshf(float);
-float	sinhf(float);
-float	tanhf(float);
+float coshf(float __x);
+float sinhf(float __x);
+float tanhf(float __x);
 
-float	exp2f(float);
-float	expf(float);
-float	expm1f(float);
-float	frexpf(float, int *);	/* fundamentally !__attribute_const__ */
-int	ilogbf(float) __attribute_const__;
-float	ldexpf(float, int);
-float	log10f(float);
-float	log1pf(float);
-float log2f(float) __INTRODUCED_IN(18);
-float	logf(float);
-float	modff(float, float *);	/* fundamentally !__attribute_const__ */
+float exp2f(float __x);
+float expf(float __x);
+float expm1f(float __x);
+float frexpf(float __x, int* __exponent); /* fundamentally !__attribute_const__ */
+int ilogbf(float __x) __attribute_const__;
+float ldexpf(float __x, int __exponent);
+float log10f(float __x);
+float log1pf(float __x);
+float log2f(float __x) __INTRODUCED_IN(18);
+float logf(float __x);
+float modff(float __x, float* __integral_part); /* fundamentally !__attribute_const__ */
 
-float	powf(float, float);
-float	sqrtf(float);
+float powf(float __x, float __y);
+float sqrtf(float __x);
 
-float	ceilf(float);
-float	fabsf(float) __attribute_const__;
-float	floorf(float);
-float	fmodf(float, float);
-float	roundf(float);
+float ceilf(float __x);
+float fabsf(float __x) __attribute_const__;
+float floorf(float __x);
+float fmodf(float __x, float __y);
+float roundf(float __x);
 
-float	erff(float);
-float	erfcf(float);
-float	hypotf(float, float);
-float	lgammaf(float);
-float tgammaf(float) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
+float erff(float __x);
+float erfcf(float __x);
+float hypotf(float __x, float __y);
+float lgammaf(float __x);
+float tgammaf(float __x) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
 
-float	acoshf(float);
-float	asinhf(float);
-float	atanhf(float);
-float	cbrtf(float);
-float	logbf(float);
-float	copysignf(float, float) __attribute_const__;
-long long llrintf(float);
-long long llroundf(float);
-long	lrintf(float);
-long	lroundf(float);
-float nanf(const char*) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
+float acoshf(float __x);
+float asinhf(float __x);
+float atanhf(float __x);
+float cbrtf(float __x);
+float logbf(float __x);
+float copysignf(float __value, float __sign) __attribute_const__;
+long long llrintf(float __x);
+long long llroundf(float __x);
+long lrintf(float __x);
+long lroundf(float __x);
+float nanf(const char* __kind) __attribute_const__ __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13)
     __INTRODUCED_IN_X86(9);
-float	nearbyintf(float);
-float	nextafterf(float, float);
-float	remainderf(float, float);
-float	remquof(float, float, int *);
-float	rintf(float);
-float	scalblnf(float, long) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
-float scalbnf(float, int);
-float	truncf(float);
+float nearbyintf(float __x);
+float nextafterf(float __x, float __y);
+float remainderf(float __x, float __y);
+float remquof(float __x, float __y, int* __quotient_bits);
+float rintf(float __x);
+float scalblnf(float __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
+float scalbnf(float __x, int __exponent);
+float truncf(float __x);
 
-float	fdimf(float, float);
-float	fmaf(float, float, float);
-float	fmaxf(float, float) __attribute_const__;
-float	fminf(float, float) __attribute_const__;
+float fdimf(float __x, float __y);
+float fmaf(float __x, float __y, float __z);
+float fmaxf(float __x, float __y) __attribute_const__;
+float fminf(float __x, float __y) __attribute_const__;
 
-long double acoshl(long double) __INTRODUCED_IN(21);
-long double acosl(long double) __INTRODUCED_IN(21);
-long double asinhl(long double) __INTRODUCED_IN(21);
-long double asinl(long double) __INTRODUCED_IN(21);
-long double atan2l(long double, long double) __INTRODUCED_IN(21);
-long double atanhl(long double) __INTRODUCED_IN(21);
-long double atanl(long double) __INTRODUCED_IN(21);
-long double cbrtl(long double) __INTRODUCED_IN(21);
-long double ceill(long double);
-long double copysignl(long double, long double) __attribute_const__;
-long double coshl(long double) __INTRODUCED_IN(21);
-long double cosl(long double) __INTRODUCED_IN(21);
-long double erfcl(long double) __INTRODUCED_IN(21);
-long double erfl(long double) __INTRODUCED_IN(21);
-long double exp2l(long double) __INTRODUCED_IN(21);
-long double expl(long double) __INTRODUCED_IN(21);
-long double expm1l(long double) __INTRODUCED_IN(21);
-long double fabsl(long double) __attribute_const__;
-long double fdiml(long double, long double);
-long double floorl(long double);
-long double fmal(long double, long double, long double) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
-long double fmaxl(long double, long double) __attribute_const__;
-long double fminl(long double, long double) __attribute_const__;
-long double fmodl(long double, long double) __INTRODUCED_IN(21);
-long double frexpl(long double value, int*)
+long double acoshl(long double __x) __INTRODUCED_IN(21);
+long double acosl(long double __x) __INTRODUCED_IN(21);
+long double asinhl(long double __x) __INTRODUCED_IN(21);
+long double asinl(long double __x) __INTRODUCED_IN(21);
+long double atan2l(long double __y, long double __x) __INTRODUCED_IN(21);
+long double atanhl(long double __x) __INTRODUCED_IN(21);
+long double atanl(long double __x) __INTRODUCED_IN(21);
+long double cbrtl(long double __x) __INTRODUCED_IN(21);
+long double ceill(long double __x);
+long double copysignl(long double __value, long double __sign) __attribute_const__;
+long double coshl(long double __x) __INTRODUCED_IN(21);
+long double cosl(long double __x) __INTRODUCED_IN(21);
+long double erfcl(long double __x) __INTRODUCED_IN(21);
+long double erfl(long double __x) __INTRODUCED_IN(21);
+long double exp2l(long double __x) __INTRODUCED_IN(21);
+long double expl(long double __x) __INTRODUCED_IN(21);
+long double expm1l(long double __x) __INTRODUCED_IN(21);
+long double fabsl(long double __x) __attribute_const__;
+long double fdiml(long double __x, long double __y);
+long double floorl(long double __x);
+long double fmal(long double __x, long double __y, long double __z) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
+long double fmaxl(long double __x, long double __y) __attribute_const__;
+long double fminl(long double __x, long double __y) __attribute_const__;
+long double fmodl(long double __x, long double __y) __INTRODUCED_IN(21);
+long double frexpl(long double __x, int* __exponent)
     __INTRODUCED_IN(21) __VERSIONER_NO_GUARD; /* fundamentally !__attribute_const__ */
-long double hypotl(long double, long double) __INTRODUCED_IN(21);
-int ilogbl(long double) __attribute_const__;
-long double ldexpl(long double, int);
-long double lgammal(long double) __INTRODUCED_IN(21);
-long long llrintl(long double) __INTRODUCED_IN(21);
-long long llroundl(long double);
-long double log10l(long double) __INTRODUCED_IN(21);
-long double log1pl(long double) __INTRODUCED_IN(21);
-long double log2l(long double) __INTRODUCED_IN(18);
-long double logbl(long double) __INTRODUCED_IN(18);
-long double logl(long double) __INTRODUCED_IN(21);
-long lrintl(long double) __INTRODUCED_IN(21);
-long lroundl(long double);
-long double modfl(long double, long double*) __INTRODUCED_IN(21); /* fundamentally !__attribute_const__ */
-long double nanl(const char*) __attribute_const__ __INTRODUCED_IN(13);
-long double nearbyintl(long double) __INTRODUCED_IN(21);
-long double nextafterl(long double, long double) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
-double nexttoward(double, long double) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
-float nexttowardf(float, long double);
-long double nexttowardl(long double, long double) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
-long double powl(long double, long double) __INTRODUCED_IN(21);
-long double remainderl(long double, long double) __INTRODUCED_IN(21);
-long double remquol(long double, long double, int*) __INTRODUCED_IN(21);
-long double rintl(long double) __INTRODUCED_IN(21);
-long double roundl(long double);
-long double scalblnl(long double, long) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
-long double scalbnl(long double, int);
-long double sinhl(long double) __INTRODUCED_IN(21);
-long double sinl(long double) __INTRODUCED_IN(21);
-long double sqrtl(long double) __INTRODUCED_IN(21);
-long double tanhl(long double) __INTRODUCED_IN(21);
-long double tanl(long double) __INTRODUCED_IN(21);
-long double tgammal(long double) __INTRODUCED_IN(21);
-long double truncl(long double);
+long double hypotl(long double __x, long double __y) __INTRODUCED_IN(21);
+int ilogbl(long double __x) __attribute_const__;
+long double ldexpl(long double __x, int __exponent);
+long double lgammal(long double __x) __INTRODUCED_IN(21);
+long long llrintl(long double __x) __INTRODUCED_IN(21);
+long long llroundl(long double __x);
+long double log10l(long double __x) __INTRODUCED_IN(21);
+long double log1pl(long double __x) __INTRODUCED_IN(21);
+long double log2l(long double __x) __INTRODUCED_IN(18);
+long double logbl(long double __x) __INTRODUCED_IN(18);
+long double logl(long double __x) __INTRODUCED_IN(21);
+long lrintl(long double __x) __INTRODUCED_IN(21);
+long lroundl(long double __x);
+long double modfl(long double __x, long double* __integral_part) __INTRODUCED_IN(21); /* fundamentally !__attribute_const__ */
+long double nanl(const char* __kind) __attribute_const__ __INTRODUCED_IN(13);
+long double nearbyintl(long double __x) __INTRODUCED_IN(21);
+long double nextafterl(long double __x, long double __y) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
+double nexttoward(double __x, long double __y) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
+float nexttowardf(float __x, long double __y);
+long double nexttowardl(long double __x, long double __y) __INTRODUCED_IN(18) __VERSIONER_NO_GUARD;
+long double powl(long double __x, long double __y) __INTRODUCED_IN(21);
+long double remainderl(long double __x, long double __y) __INTRODUCED_IN(21);
+long double remquol(long double __x, long double __y, int* __quotient_bits) __INTRODUCED_IN(21);
+long double rintl(long double __x) __INTRODUCED_IN(21);
+long double roundl(long double __x);
+long double scalblnl(long double __x, long __exponent) __INTRODUCED_IN_X86(18) __VERSIONER_NO_GUARD;
+long double scalbnl(long double __x, int __exponent);
+long double sinhl(long double __x) __INTRODUCED_IN(21);
+long double sinl(long double __x) __INTRODUCED_IN(21);
+long double sqrtl(long double __x) __INTRODUCED_IN(21);
+long double tanhl(long double __x) __INTRODUCED_IN(21);
+long double tanl(long double __x) __INTRODUCED_IN(21);
+long double tgammal(long double __x) __INTRODUCED_IN(21);
+long double truncl(long double __x);
 
-double j0(double);
-double j1(double);
-double jn(int, double);
-double y0(double);
-double y1(double);
-double yn(int, double);
+double j0(double __x);
+double j1(double __x);
+double jn(int __n, double __x);
+double y0(double __x);
+double y1(double __x);
+double yn(int __n, double __x);
 
 #define M_E		2.7182818284590452354	/* e */
 #define M_LOG2E		1.4426950408889634074	/* log 2e */
@@ -336,29 +336,29 @@
 #define MAXFLOAT	((float)3.40282346638528860e+38)
 
 #if defined(__USE_BSD) || defined(__USE_GNU)
-double gamma(double);
-double scalb(double, double);
-double drem(double, double);
-int finite(double) __attribute_const__;
-int isnanf(float) __attribute_const__;
-double gamma_r(double, int*);
-double lgamma_r(double, int*);
-double significand(double);
-long double lgammal_r(long double, int*) __INTRODUCED_IN(23);
-long double significandl(long double) __INTRODUCED_IN(21);
-float dremf(float, float);
-int finitef(float) __attribute_const__;
-float gammaf(float);
-float j0f(float);
-float j1f(float);
-float jnf(int, float);
-float scalbf(float, float);
-float y0f(float);
-float y1f(float);
-float ynf(int, float);
-float gammaf_r(float, int *);
-float lgammaf_r(float, int *);
-float significandf(float);
+double gamma(double __x);
+double scalb(double __x, double __exponent);
+double drem(double __x, double __y);
+int finite(double __x) __attribute_const__;
+int isnanf(float __x) __attribute_const__;
+double gamma_r(double __x, int* __sign);
+double lgamma_r(double __x, int* __sign);
+double significand(double __x);
+long double lgammal_r(long double __x, int* __sign) __INTRODUCED_IN(23);
+long double significandl(long double __x) __INTRODUCED_IN(21);
+float dremf(float __x, float __y);
+int finitef(float __x) __attribute_const__;
+float gammaf(float __x);
+float j0f(float __x);
+float j1f(float __x);
+float jnf(int __n, float __x);
+float scalbf(float __x, float __exponent);
+float y0f(float __x);
+float y1f(float __x);
+float ynf(int __n, float __x);
+float gammaf_r(float __x, int* __sign);
+float lgammaf_r(float __x, int* __sign);
+float significandf(float __x);
 #endif
 
 #if defined(__USE_GNU)
@@ -375,11 +375,11 @@
 #define M_2_SQRTPIl     1.128379167095512573896158903121545172L /* 2/sqrt(pi) */
 #define M_SQRT2l        1.414213562373095048801688724209698079L /* sqrt(2) */
 #define M_SQRT1_2l      0.707106781186547524400844362104849039L /* 1/sqrt(2) */
-void sincos(double, double*, double*);
-void sincosf(float, float*, float*);
-void sincosl(long double, long double*, long double*);
+void sincos(double __x, double* __sin, double* __cos);
+void sincosf(float __x, float* __sin, float* __cos);
+void sincosl(long double __x, long double* __sin, long double* __cos);
 #endif
 
 __END_DECLS
 
-#endif /* !_MATH_H_ */
+#endif
diff --git a/libc/include/mntent.h b/libc/include/mntent.h
index 551a085..d5987dc 100644
--- a/libc/include/mntent.h
+++ b/libc/include/mntent.h
@@ -57,11 +57,11 @@
 
 __BEGIN_DECLS
 
-int endmntent(FILE*) __INTRODUCED_IN(21);
-struct mntent* getmntent(FILE*);
-struct mntent* getmntent_r(FILE*, struct mntent*, char*, int) __INTRODUCED_IN(21);
-FILE* setmntent(const char*, const char*) __INTRODUCED_IN(21);
-char* hasmntopt(const struct mntent*, const char*) __INTRODUCED_IN(26);
+int endmntent(FILE* __fp) __INTRODUCED_IN(21);
+struct mntent* getmntent(FILE* __fp);
+struct mntent* getmntent_r(FILE* __fp, struct mntent* __entry, char* __buf, int __size) __INTRODUCED_IN(21);
+FILE* setmntent(const char* __filename, const char* __type) __INTRODUCED_IN(21);
+char* hasmntopt(const struct mntent* __entry, const char* __option) __INTRODUCED_IN(26);
 
 __END_DECLS
 
diff --git a/libc/include/net/if.h b/libc/include/net/if.h
index eac7699..f261f71 100644
--- a/libc/include/net/if.h
+++ b/libc/include/net/if.h
@@ -44,10 +44,10 @@
   char* if_name;
 };
 
-char* if_indextoname(unsigned, char*);
-unsigned if_nametoindex(const char*);
+char* if_indextoname(unsigned __index, char* __buf);
+unsigned if_nametoindex(const char* __name);
 struct if_nameindex* if_nameindex(void) __INTRODUCED_IN(24);
-void if_freenameindex(struct if_nameindex*) __INTRODUCED_IN(24);
+void if_freenameindex(struct if_nameindex* __ptr) __INTRODUCED_IN(24);
 
 __END_DECLS
 
diff --git a/libc/include/netdb.h b/libc/include/netdb.h
index 816acc5..66ec8e3 100644
--- a/libc/include/netdb.h
+++ b/libc/include/netdb.h
@@ -196,37 +196,33 @@
 
 __BEGIN_DECLS
 
-/* BIONIC-BEGIN */
-#define  h_errno   (*__get_h_errno())
-int*  __get_h_errno(void);
-/* BIONIC-END */
+#define h_errno (*__get_h_errno())
+int* __get_h_errno(void);
 void endservent(void);
-struct hostent* gethostbyaddr(const void*, socklen_t, int);
-int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**,
-                    int*) __INTRODUCED_IN(23);
-struct hostent* gethostbyname(const char*);
-int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);
-struct hostent* gethostbyname2(const char*, int);
-int gethostbyname2_r(const char*, int, struct hostent*, char*, size_t, struct hostent**, int*)
-  __INTRODUCED_IN(23);
+struct hostent* gethostbyaddr(const void* __addr, socklen_t __length, int __type);
+int gethostbyaddr_r(const void* __addr, socklen_t __length, int __type, struct hostent* __ret, char* __buf, size_t __buf_size, struct hostent** __result, int* __h_errno_ptr) __INTRODUCED_IN(23);
+struct hostent* gethostbyname(const char* __name);
+int gethostbyname_r(const char* __name, struct hostent* __ret, char* __buf, size_t __buf_size, struct hostent** __result, int* __h_errno_ptr);
+struct hostent* gethostbyname2(const char* __name, int __af);
+int gethostbyname2_r(const char* __name, int __af, struct hostent* __ret, char* __buf, size_t __buf_size, struct hostent** __result, int* __h_errno_ptr) __INTRODUCED_IN(23);
 struct hostent* gethostent(void);
-struct netent* getnetbyaddr(uint32_t, int);
-struct netent* getnetbyname(const char*);
-struct protoent* getprotobyname(const char*);
-struct protoent* getprotobynumber(int);
-struct servent* getservbyname(const char*, const char*);
-struct servent* getservbyport(int, const char*);
+struct netent* getnetbyaddr(uint32_t __net, int __type);
+struct netent* getnetbyname(const char* __name);
+struct protoent* getprotobyname(const char* __name);
+struct protoent* getprotobynumber(int __proto);
+struct servent* getservbyname(const char* __name, const char* __proto);
+struct servent* getservbyport(int __port, const char* __proto);
 struct servent* getservent(void);
-void herror(const char*);
-const char* hstrerror(int);
+void herror(const char* __s);
+const char* hstrerror(int __error);
 
-int getaddrinfo(const char*, const char*, const struct addrinfo*, struct addrinfo**);
+int getaddrinfo(const char* __node, const char* __service, const struct addrinfo* __hints, struct addrinfo** __result);
 /* POSIX getnameinfo uses socklen_t, not size_t, but LP64 sizeof(socklen_t) != sizeof(size_t). */
-int getnameinfo(const struct sockaddr*, socklen_t, char*, size_t, char*, size_t, int);
-void freeaddrinfo(struct addrinfo*);
-const char* gai_strerror(int);
-void setservent(int);
+int getnameinfo(const struct sockaddr* __sa, socklen_t __sa_length, char* __host, size_t __host_length, char* __service, size_t __service_length, int __flags);
+void freeaddrinfo(struct addrinfo* __ptr);
+const char* gai_strerror(int __error);
+void setservent(int __stay_open);
 
 __END_DECLS
 
-#endif /* !_NETDB_H_ */
+#endif
diff --git a/libc/include/nl_types.h b/libc/include/nl_types.h
index d478353..b25b7a3 100644
--- a/libc/include/nl_types.h
+++ b/libc/include/nl_types.h
@@ -39,9 +39,9 @@
 typedef void* nl_catd;
 typedef int nl_item;
 
-nl_catd catopen(const char*, int) __INTRODUCED_IN(26);
-char* catgets(nl_catd, int, int, const char*) __INTRODUCED_IN(26);
-int catclose(nl_catd) __INTRODUCED_IN(26);
+nl_catd catopen(const char* __name, int __flag) __INTRODUCED_IN(26);
+char* catgets(nl_catd __catalog, int __set_number, int __msg_number, const char* __msg) __INTRODUCED_IN(26);
+int catclose(nl_catd __catalog) __INTRODUCED_IN(26);
 
 __END_DECLS
 
diff --git a/libc/include/paths.h b/libc/include/paths.h
index b76d045..d2c5956 100644
--- a/libc/include/paths.h
+++ b/libc/include/paths.h
@@ -34,7 +34,9 @@
 
 #include <sys/cdefs.h>
 
+#ifndef _PATH_BSHELL
 #define	_PATH_BSHELL	"/system/bin/sh"
+#endif
 #define	_PATH_CONSOLE	"/dev/console"
 #define	_PATH_DEFPATH	"/sbin:/system/sbin:/system/bin:/system/xbin:/vendor/bin:/vendor/xbin"
 #define	_PATH_DEV	"/dev/"
diff --git a/libc/include/poll.h b/libc/include/poll.h
index 0f5758d..8517dc6 100644
--- a/libc/include/poll.h
+++ b/libc/include/poll.h
@@ -38,9 +38,8 @@
 
 typedef unsigned int nfds_t;
 
-int poll(struct pollfd*, nfds_t, int) __overloadable __RENAME_CLANG(poll);
-int ppoll(struct pollfd*, nfds_t, const struct timespec*, const sigset_t*)
-        __overloadable __RENAME_CLANG(ppoll) __INTRODUCED_IN(21);
+int poll(struct pollfd* __fds, nfds_t __count, int __timeout_ms) __overloadable __RENAME_CLANG(poll);
+int ppoll(struct pollfd* __fds, nfds_t __count, const struct timespec* __timeout, const sigset_t* __mask) __overloadable __RENAME_CLANG(ppoll) __INTRODUCED_IN(21);
 
 #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
 #include <bits/fortify/poll.h>
@@ -48,4 +47,4 @@
 
 __END_DECLS
 
-#endif /* _POLL_H_ */
+#endif
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index ccafd78..32315fe 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -39,14 +39,14 @@
 __BEGIN_DECLS
 
 enum {
-    PTHREAD_MUTEX_NORMAL = 0,
-    PTHREAD_MUTEX_RECURSIVE = 1,
-    PTHREAD_MUTEX_ERRORCHECK = 2,
+  PTHREAD_MUTEX_NORMAL = 0,
+  PTHREAD_MUTEX_RECURSIVE = 1,
+  PTHREAD_MUTEX_ERRORCHECK = 2,
 
-    PTHREAD_MUTEX_ERRORCHECK_NP = PTHREAD_MUTEX_ERRORCHECK,
-    PTHREAD_MUTEX_RECURSIVE_NP  = PTHREAD_MUTEX_RECURSIVE,
+  PTHREAD_MUTEX_ERRORCHECK_NP = PTHREAD_MUTEX_ERRORCHECK,
+  PTHREAD_MUTEX_RECURSIVE_NP  = PTHREAD_MUTEX_RECURSIVE,
 
-    PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
+  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
 };
 
 #define PTHREAD_MUTEX_INITIALIZER { { ((PTHREAD_MUTEX_NORMAL & 3) << 14) } }
@@ -83,74 +83,74 @@
 #define PTHREAD_SCOPE_SYSTEM     0
 #define PTHREAD_SCOPE_PROCESS    1
 
-int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)) __INTRODUCED_IN(12);
+int pthread_atfork(void (*__prepare)(void), void (*__parent)(void), void (*__child)(void)) __INTRODUCED_IN(12);
 
-int pthread_attr_destroy(pthread_attr_t*);
-int pthread_attr_getdetachstate(const pthread_attr_t*, int*);
-int pthread_attr_getguardsize(const pthread_attr_t*, size_t*);
-int pthread_attr_getschedparam(const pthread_attr_t*, struct sched_param*);
-int pthread_attr_getschedpolicy(const pthread_attr_t*, int*);
-int pthread_attr_getscope(const pthread_attr_t*, int*);
-int pthread_attr_getstack(const pthread_attr_t*, void**, size_t*);
-int pthread_attr_getstacksize(const pthread_attr_t*, size_t*);
-int pthread_attr_init(pthread_attr_t*);
-int pthread_attr_setdetachstate(pthread_attr_t*, int);
-int pthread_attr_setguardsize(pthread_attr_t*, size_t);
-int pthread_attr_setschedparam(pthread_attr_t*, const struct sched_param*);
-int pthread_attr_setschedpolicy(pthread_attr_t*, int);
-int pthread_attr_setscope(pthread_attr_t*, int);
-int pthread_attr_setstack(pthread_attr_t*, void*, size_t);
-int pthread_attr_setstacksize(pthread_attr_t*, size_t);
+int pthread_attr_destroy(pthread_attr_t* __attr);
+int pthread_attr_getdetachstate(const pthread_attr_t* __attr, int* __state);
+int pthread_attr_getguardsize(const pthread_attr_t* __attr, size_t* __size);
+int pthread_attr_getschedparam(const pthread_attr_t* __attr, struct sched_param* __param);
+int pthread_attr_getschedpolicy(const pthread_attr_t* __attr, int* __policy);
+int pthread_attr_getscope(const pthread_attr_t* __attr, int* __scope);
+int pthread_attr_getstack(const pthread_attr_t* __attr, void** __addr, size_t* __size);
+int pthread_attr_getstacksize(const pthread_attr_t* __attr, size_t* __size);
+int pthread_attr_init(pthread_attr_t* __attr);
+int pthread_attr_setdetachstate(pthread_attr_t* __attr, int __state);
+int pthread_attr_setguardsize(pthread_attr_t* __attr, size_t __size);
+int pthread_attr_setschedparam(pthread_attr_t* __attr, const struct sched_param* __param);
+int pthread_attr_setschedpolicy(pthread_attr_t* __attr, int __policy);
+int pthread_attr_setscope(pthread_attr_t* __attr, int __scope);
+int pthread_attr_setstack(pthread_attr_t* __attr, void* __addr, size_t __size);
+int pthread_attr_setstacksize(pthread_attr_t* __addr, size_t __size);
 
-int pthread_condattr_destroy(pthread_condattr_t*);
-int pthread_condattr_getclock(const pthread_condattr_t*, clockid_t*) __INTRODUCED_IN(21);
-int pthread_condattr_getpshared(const pthread_condattr_t*, int*);
-int pthread_condattr_init(pthread_condattr_t*);
-int pthread_condattr_setclock(pthread_condattr_t*, clockid_t) __INTRODUCED_IN(21);
-int pthread_condattr_setpshared(pthread_condattr_t*, int);
+int pthread_condattr_destroy(pthread_condattr_t* __attr);
+int pthread_condattr_getclock(const pthread_condattr_t* __attr, clockid_t* __clock) __INTRODUCED_IN(21);
+int pthread_condattr_getpshared(const pthread_condattr_t* __attr, int* __shared);
+int pthread_condattr_init(pthread_condattr_t* __attr);
+int pthread_condattr_setclock(pthread_condattr_t* __attr, clockid_t __clock) __INTRODUCED_IN(21);
+int pthread_condattr_setpshared(pthread_condattr_t* __attr, int __shared);
 
-int pthread_cond_broadcast(pthread_cond_t*);
-int pthread_cond_destroy(pthread_cond_t*);
-int pthread_cond_init(pthread_cond_t*, const pthread_condattr_t*);
-int pthread_cond_signal(pthread_cond_t*);
-int pthread_cond_timedwait(pthread_cond_t*, pthread_mutex_t*, const struct timespec*);
-int pthread_cond_wait(pthread_cond_t*, pthread_mutex_t*);
+int pthread_cond_broadcast(pthread_cond_t* __cond);
+int pthread_cond_destroy(pthread_cond_t* __cond);
+int pthread_cond_init(pthread_cond_t* __cond, const pthread_condattr_t* __attr);
+int pthread_cond_signal(pthread_cond_t* __cond);
+int pthread_cond_timedwait(pthread_cond_t* __cond, pthread_mutex_t* __mutex, const struct timespec* __timeout);
+int pthread_cond_wait(pthread_cond_t* __cond, pthread_mutex_t* __mutex);
 
-int pthread_create(pthread_t*, pthread_attr_t const*, void* (*start_routine)(void*), void*);
-int pthread_detach(pthread_t);
-void pthread_exit(void*) __noreturn;
+int pthread_create(pthread_t* __pthread_ptr, pthread_attr_t const* __attr, void* (*__start_routine)(void*), void*);
+int pthread_detach(pthread_t __pthread);
+void pthread_exit(void* __return_value) __noreturn;
 
-int pthread_equal(pthread_t, pthread_t);
+int pthread_equal(pthread_t __lhs, pthread_t __rhs);
 
-int pthread_getattr_np(pthread_t, pthread_attr_t*);
+int pthread_getattr_np(pthread_t __pthread, pthread_attr_t* __attr);
 
-int pthread_getcpuclockid(pthread_t, clockid_t*);
+int pthread_getcpuclockid(pthread_t __pthread, clockid_t* __clock);
 
-int pthread_getschedparam(pthread_t, int*, struct sched_param*);
+int pthread_getschedparam(pthread_t __pthread, int* __policy, struct sched_param* __param);
 
-void* pthread_getspecific(pthread_key_t);
+void* pthread_getspecific(pthread_key_t __key);
 
-pid_t pthread_gettid_np(pthread_t) __INTRODUCED_IN(21);
+pid_t pthread_gettid_np(pthread_t __pthread) __INTRODUCED_IN(21);
 
-int pthread_join(pthread_t, void**);
+int pthread_join(pthread_t __pthread, void** __return_value_ptr);
 
-int pthread_key_create(pthread_key_t*, void (*)(void*));
-int pthread_key_delete(pthread_key_t);
+int pthread_key_create(pthread_key_t* __key_ptr, void (*__key_destructor)(void*));
+int pthread_key_delete(pthread_key_t __key);
 
-int pthread_mutexattr_destroy(pthread_mutexattr_t*);
-int pthread_mutexattr_getpshared(const pthread_mutexattr_t*, int*);
-int pthread_mutexattr_gettype(const pthread_mutexattr_t*, int*);
-int pthread_mutexattr_init(pthread_mutexattr_t*);
-int pthread_mutexattr_setpshared(pthread_mutexattr_t*, int);
-int pthread_mutexattr_settype(pthread_mutexattr_t*, int);
+int pthread_mutexattr_destroy(pthread_mutexattr_t* __attr);
+int pthread_mutexattr_getpshared(const pthread_mutexattr_t* __attr, int* __shared);
+int pthread_mutexattr_gettype(const pthread_mutexattr_t* __attr, int* __type);
+int pthread_mutexattr_init(pthread_mutexattr_t* __attr);
+int pthread_mutexattr_setpshared(pthread_mutexattr_t* __attr, int __shared);
+int pthread_mutexattr_settype(pthread_mutexattr_t* __attr, int __type);
 
-int pthread_mutex_destroy(pthread_mutex_t*);
-int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
-int pthread_mutex_lock(pthread_mutex_t*);
-int pthread_mutex_timedlock(pthread_mutex_t*, const struct timespec* )
+int pthread_mutex_destroy(pthread_mutex_t* __mutex);
+int pthread_mutex_init(pthread_mutex_t* __mutex, const pthread_mutexattr_t* __attr);
+int pthread_mutex_lock(pthread_mutex_t* __mutex);
+int pthread_mutex_timedlock(pthread_mutex_t* __mutex, const struct timespec* __timeout)
   __INTRODUCED_IN(21);
-int pthread_mutex_trylock(pthread_mutex_t*);
-int pthread_mutex_unlock(pthread_mutex_t*);
+int pthread_mutex_trylock(pthread_mutex_t* __mutex);
+int pthread_mutex_unlock(pthread_mutex_t* __mutex);
 
 #if __ANDROID_API__ < 21
 /*
@@ -164,68 +164,64 @@
  *  * https://github.com/android-ndk/ndk/issues/423
  *  * https://stackoverflow.com/q/44580542/632035
  */
-int pthread_mutex_lock_timeout_np(pthread_mutex_t* mutex, unsigned msecs);
-int pthread_cond_timeout_np(pthread_cond_t* cond, pthread_mutex_t* mutex, unsigned msecs);
-int pthread_cond_timedwait_monotonic_np(pthread_cond_t*, pthread_mutex_t*, const struct timespec*);
-int pthread_cond_timedwait_relative_np(pthread_cond_t* cond, pthread_mutex_t* mutex,
-                                       const struct timespec* reltime);
+int pthread_mutex_lock_timeout_np(pthread_mutex_t* __mutex, unsigned __timeout_ms);
+int pthread_cond_timeout_np(pthread_cond_t* __cond, pthread_mutex_t* __mutex, unsigned __timeout_ms);
+int pthread_cond_timedwait_monotonic_np(pthread_cond_t* __cond, pthread_mutex_t* __mutex, const struct timespec* __timeout);
+int pthread_cond_timedwait_relative_np(pthread_cond_t* __cond, pthread_mutex_t* __mutex, const struct timespec* __relative_timeout);
 #endif
 
-int pthread_once(pthread_once_t*, void (*init_routine)(void));
+int pthread_once(pthread_once_t* __once, void (*__init_routine)(void));
 
-int pthread_rwlockattr_init(pthread_rwlockattr_t*);
-int pthread_rwlockattr_destroy(pthread_rwlockattr_t*);
-int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t*, int*);
-int pthread_rwlockattr_setpshared(pthread_rwlockattr_t*, int);
-int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t*, int*)
+int pthread_rwlockattr_init(pthread_rwlockattr_t* __attr);
+int pthread_rwlockattr_destroy(pthread_rwlockattr_t* __attr);
+int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t* __attr, int* __shared);
+int pthread_rwlockattr_setpshared(pthread_rwlockattr_t* __attr, int __shared);
+int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t* __attr, int* __kind)
   __INTRODUCED_IN(23);
-int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t*, int) __INTRODUCED_IN(23);
+int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t* __attr, int __kind) __INTRODUCED_IN(23);
 
-int pthread_rwlock_destroy(pthread_rwlock_t*);
-int pthread_rwlock_init(pthread_rwlock_t*, const pthread_rwlockattr_t*);
-int pthread_rwlock_rdlock(pthread_rwlock_t*);
-int pthread_rwlock_timedrdlock(pthread_rwlock_t*, const struct timespec*);
-int pthread_rwlock_timedwrlock(pthread_rwlock_t*, const struct timespec*);
-int pthread_rwlock_tryrdlock(pthread_rwlock_t*);
-int pthread_rwlock_trywrlock(pthread_rwlock_t*);
-int pthread_rwlock_unlock(pthread_rwlock_t*);
-int pthread_rwlock_wrlock(pthread_rwlock_t*);
+int pthread_rwlock_destroy(pthread_rwlock_t* __rwlock);
+int pthread_rwlock_init(pthread_rwlock_t* __rwlock, const pthread_rwlockattr_t* __attr);
+int pthread_rwlock_rdlock(pthread_rwlock_t* __rwlock);
+int pthread_rwlock_timedrdlock(pthread_rwlock_t* __rwlock, const struct timespec* __timeout);
+int pthread_rwlock_timedwrlock(pthread_rwlock_t* __rwlock, const struct timespec* __timeout);
+int pthread_rwlock_tryrdlock(pthread_rwlock_t* __rwlock);
+int pthread_rwlock_trywrlock(pthread_rwlock_t* __rwlock);
+int pthread_rwlock_unlock(pthread_rwlock_t* __rwlock);
+int pthread_rwlock_wrlock(pthread_rwlock_t* __rwlock);
 
 #if __ANDROID_API__ >= __ANDROID_API_N__
-int pthread_barrierattr_init(pthread_barrierattr_t* attr) __INTRODUCED_IN(24);
-int pthread_barrierattr_destroy(pthread_barrierattr_t* attr) __INTRODUCED_IN(24);
-int pthread_barrierattr_getpshared(const pthread_barrierattr_t* attr,
-                                   int* pshared) __INTRODUCED_IN(24);
-int pthread_barrierattr_setpshared(pthread_barrierattr_t* attr, int pshared)
-  __INTRODUCED_IN(24);
+int pthread_barrierattr_init(pthread_barrierattr_t* __attr) __INTRODUCED_IN(24);
+int pthread_barrierattr_destroy(pthread_barrierattr_t* __attr) __INTRODUCED_IN(24);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t* __attr, int* __shared) __INTRODUCED_IN(24);
+int pthread_barrierattr_setpshared(pthread_barrierattr_t* __attr, int __shared) __INTRODUCED_IN(24);
 #endif
 
 #if __ANDROID_API__ >= __ANDROID_API_N__
-int pthread_barrier_init(pthread_barrier_t*, const pthread_barrierattr_t*, unsigned)
-  __INTRODUCED_IN(24);
-int pthread_barrier_destroy(pthread_barrier_t*) __INTRODUCED_IN(24);
-int pthread_barrier_wait(pthread_barrier_t*) __INTRODUCED_IN(24);
+int pthread_barrier_init(pthread_barrier_t* __barrier, const pthread_barrierattr_t* __attr, unsigned __count) __INTRODUCED_IN(24);
+int pthread_barrier_destroy(pthread_barrier_t* __barrier) __INTRODUCED_IN(24);
+int pthread_barrier_wait(pthread_barrier_t* __barrier) __INTRODUCED_IN(24);
 #endif
 
 #if __ANDROID_API__ >= __ANDROID_API_N__
-int pthread_spin_destroy(pthread_spinlock_t*) __INTRODUCED_IN(24);
-int pthread_spin_init(pthread_spinlock_t*, int) __INTRODUCED_IN(24);
-int pthread_spin_lock(pthread_spinlock_t*) __INTRODUCED_IN(24);
-int pthread_spin_trylock(pthread_spinlock_t*) __INTRODUCED_IN(24);
-int pthread_spin_unlock(pthread_spinlock_t*) __INTRODUCED_IN(24);
+int pthread_spin_destroy(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
+int pthread_spin_init(pthread_spinlock_t* __spinlock, int __shared) __INTRODUCED_IN(24);
+int pthread_spin_lock(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
+int pthread_spin_trylock(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
+int pthread_spin_unlock(pthread_spinlock_t* __spinlock) __INTRODUCED_IN(24);
 #endif
 
 pthread_t pthread_self(void) __attribute_const__;
 
 #if defined(__USE_GNU)
-int pthread_getname_np(pthread_t, char*, size_t) __INTRODUCED_IN(26);
+int pthread_getname_np(pthread_t __pthread, char* __buf, size_t __n) __INTRODUCED_IN(26);
 #endif
 /* TODO: this should be __USE_GNU too. */
-int pthread_setname_np(pthread_t, const char*);
+int pthread_setname_np(pthread_t __pthread, const char* __name);
 
-int pthread_setschedparam(pthread_t, int, const struct sched_param*);
+int pthread_setschedparam(pthread_t __pthread, int __policy, const struct sched_param* __param);
 
-int pthread_setspecific(pthread_key_t, const void*);
+int pthread_setspecific(pthread_key_t __key, const void* __value);
 
 typedef void (*__pthread_cleanup_func_t)(void*);
 
@@ -255,4 +251,4 @@
 
 __END_DECLS
 
-#endif /* _PTHREAD_H_ */
+#endif
diff --git a/libc/include/pty.h b/libc/include/pty.h
index ec257a5..cf9ccb9 100644
--- a/libc/include/pty.h
+++ b/libc/include/pty.h
@@ -36,9 +36,9 @@
 
 __BEGIN_DECLS
 
-int openpty(int*, int*, char*, const struct termios*, const struct winsize*) __INTRODUCED_IN(23);
-int forkpty(int*, char*, const struct termios*, const struct winsize*) __INTRODUCED_IN(23);
+int openpty(int* __master_fd, int* __slave_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr) __INTRODUCED_IN(23);
+int forkpty(int* __master_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr) __INTRODUCED_IN(23);
 
 __END_DECLS
 
-#endif /* _PTY_H */
+#endif
diff --git a/libc/include/pwd.h b/libc/include/pwd.h
index e37c637..5c516d7 100644
--- a/libc/include/pwd.h
+++ b/libc/include/pwd.h
@@ -80,8 +80,8 @@
   char* pw_shell;
 };
 
-struct passwd* getpwnam(const char*);
-struct passwd* getpwuid(uid_t);
+struct passwd* getpwnam(const char* __name);
+struct passwd* getpwuid(uid_t __uid);
 
 /* Note: Android has thousands and thousands of ids to iterate through */
 struct passwd* getpwent(void) __INTRODUCED_IN(26);
@@ -89,8 +89,8 @@
 void setpwent(void) __INTRODUCED_IN(26);
 void endpwent(void) __INTRODUCED_IN(26);
 
-int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**) __INTRODUCED_IN(12);
-int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**) __INTRODUCED_IN(12);
+int getpwnam_r(const char* __name, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result) __INTRODUCED_IN(12);
+int getpwuid_r(uid_t __uid, struct passwd* __pwd, char* __buf, size_t __n, struct passwd** __result) __INTRODUCED_IN(12);
 
 __END_DECLS
 
diff --git a/libc/include/regex.h b/libc/include/regex.h
index b06a515..c4cc39c 100644
--- a/libc/include/regex.h
+++ b/libc/include/regex.h
@@ -97,10 +97,10 @@
 #define	REG_BACKR	02000	/* force use of backref code */
 
 __BEGIN_DECLS
-int	regcomp(regex_t *, const char *, int);
-size_t	regerror(int, const regex_t *, char *, size_t);
-int	regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
-void	regfree(regex_t *);
+int regcomp(regex_t* __re, const char* __regex, int __flags);
+size_t regerror(int __error_code, const regex_t* __re, char* __buf, size_t __n);
+int regexec(const regex_t* __re, const char* __s, size_t __match_count, regmatch_t __matches[], int __flags);
+void regfree(regex_t* __re);
 __END_DECLS
 
-#endif /* !_REGEX_H_ */
+#endif
diff --git a/libc/include/resolv.h b/libc/include/resolv.h
index 2c12819..d6db4cf 100644
--- a/libc/include/resolv.h
+++ b/libc/include/resolv.h
@@ -40,25 +40,25 @@
 __BEGIN_DECLS
 
 #define b64_ntop __b64_ntop
-int b64_ntop(u_char const*, size_t, char*, size_t);
+int b64_ntop(u_char const* __src, size_t __src_size, char* __dst, size_t __dst_size);
 #define b64_pton __b64_pton
-int b64_pton(char const*, u_char*, size_t);
+int b64_pton(char const* __src, u_char* __dst, size_t __dst_size);
 
 #define dn_comp __dn_comp
-int dn_comp(const char*, u_char*, int, u_char**, u_char**);
+int dn_comp(const char* __src, u_char* __dst, int __dst_size, u_char** __dn_ptrs , u_char** __last_dn_ptr);
 
-int dn_expand(const u_char*, const u_char*, const u_char*, char*, int);
+int dn_expand(const u_char* __msg, const u_char* __eom, const u_char* __src, char* __dst, int __dst_size);
 
 #define p_class __p_class
-const char* p_class(int);
+const char* p_class(int __class);
 #define p_type __p_type
-const char* p_type(int);
+const char* p_type(int __type);
 
 int res_init(void);
-int res_mkquery(int, const char*, int, int, const u_char*, int, const u_char*, u_char*, int);
-int res_query(const char*, int, int, u_char*, int);
-int res_search(const char*, int, int, u_char*, int);
+int res_mkquery(int __opcode, const char* __domain_name, int __class, int __type, const u_char* __data, int __data_size, const u_char* __new_rr_in, u_char* __buf, int __buf_size);
+int res_query(const char* __name, int __class, int __type, u_char* __answer, int __answer_size);
+int res_search(const char* __name, int __class, int __type, u_char* __answer, int __answer_size);
 
 __END_DECLS
 
-#endif /* _RESOLV_H_ */
+#endif
diff --git a/libc/include/search.h b/libc/include/search.h
index 46998d9..0015699 100644
--- a/libc/include/search.h
+++ b/libc/include/search.h
@@ -29,21 +29,20 @@
 
 __BEGIN_DECLS
 
-void insque(void*, void*) __INTRODUCED_IN(21);
-void remque(void*) __INTRODUCED_IN(21);
+void insque(void* __element, void* __previous) __INTRODUCED_IN(21);
+void remque(void* __element) __INTRODUCED_IN(21);
 
-void* lfind(const void*, const void*, size_t*, size_t, int (*)(const void*, const void*))
+void* lfind(const void* __key, const void* __base, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*))
   __INTRODUCED_IN(21);
-void* lsearch(const void*, void*, size_t*, size_t, int (*)(const void*, const void*))
+void* lsearch(const void* __key, void* __base, size_t* __count, size_t __size, int (*__comparator)(const void*, const void*))
   __INTRODUCED_IN(21);
 
-void* tdelete(const void*, void**, int (*)(const void*, const void*))
-  __INTRODUCED_IN(16);
-void tdestroy(void*, void (*)(void*)) __INTRODUCED_IN(16);
-void* tfind(const void*, void* const*, int (*)(const void*, const void*)) __INTRODUCED_IN(16);
-void* tsearch(const void*, void**, int (*)(const void*, const void*)) __INTRODUCED_IN(16);
-void twalk(const void*, void (*)(const void*, VISIT, int)) __INTRODUCED_IN(21);
+void* tdelete(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
+void tdestroy(void* __root, void (*__free_fn)(void*)) __INTRODUCED_IN(16);
+void* tfind(const void* __key, void* const* __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
+void* tsearch(const void* __key, void** __root_ptr, int (*__comparator)(const void*, const void*)) __INTRODUCED_IN(16);
+void twalk(const void* __root, void (*__visitor)(const void*, VISIT, int)) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* !_SEARCH_H_ */
+#endif
diff --git a/libc/include/semaphore.h b/libc/include/semaphore.h
index 218f22a..7e3dc1c 100644
--- a/libc/include/semaphore.h
+++ b/libc/include/semaphore.h
@@ -44,19 +44,19 @@
 
 #define SEM_FAILED __BIONIC_CAST(reinterpret_cast, sem_t*, 0)
 
-int sem_destroy(sem_t*);
-int sem_getvalue(sem_t*, int*);
-int sem_init(sem_t*, int, unsigned int);
-int sem_post(sem_t*);
-int sem_timedwait(sem_t*, const struct timespec*);
-int sem_trywait(sem_t*);
-int sem_wait(sem_t*);
+int sem_destroy(sem_t* __sem);
+int sem_getvalue(sem_t* __sem, int* __value);
+int sem_init(sem_t* __sem, int __shared, unsigned int __value);
+int sem_post(sem_t* __sem);
+int sem_timedwait(sem_t* __sem, const struct timespec* __ts);
+int sem_trywait(sem_t* __sem);
+int sem_wait(sem_t* __sem);
 
 /* These aren't actually implemented. */
-sem_t* sem_open(const char*, int, ...);
-int sem_close(sem_t*);
-int sem_unlink(const char*);
+sem_t* sem_open(const char* __name, int _flags, ...);
+int sem_close(sem_t* __sem);
+int sem_unlink(const char* __name);
 
 __END_DECLS
 
-#endif /* _SEMAPHORE_H */
+#endif
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index 7adeb35..12a3083 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -48,17 +48,17 @@
 
 __BEGIN_DECLS
 
-int     _setjmp(jmp_buf);
-void    _longjmp(jmp_buf, int);
+int _setjmp(jmp_buf __env);
+void _longjmp(jmp_buf __env, int __value);
 
-int     setjmp(jmp_buf);
-void    longjmp(jmp_buf, int);
+int setjmp(jmp_buf __env);
+void longjmp(jmp_buf __env, int __value);
 
-int sigsetjmp(sigjmp_buf, int) __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12)
-    __INTRODUCED_IN_X86(12);
-void siglongjmp(sigjmp_buf, int) __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12)
-    __INTRODUCED_IN_X86(12);
+int sigsetjmp(sigjmp_buf __env, int __save_signal_mask)
+    __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(12);
+void siglongjmp(sigjmp_buf __env, int __value)
+    __INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(12);
 
 __END_DECLS
 
-#endif /* !_SETJMP_H_ */
+#endif
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 4dff48d..559e52a 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -103,48 +103,42 @@
 #define L_tmpnam 4096
 #define TMP_MAX 308915776
 
-/*
- * Functions defined in ANSI C standard.
- */
-void	 clearerr(FILE *);
-int	 fclose(FILE *);
-int	 feof(FILE *);
-int	 ferror(FILE *);
-int	 fflush(FILE *);
-int	 fgetc(FILE *);
-char	*fgets(char *, int, FILE *) __overloadable
-  __RENAME_CLANG(fgets);
-int	 fprintf(FILE * , const char *, ...) __printflike(2, 3);
-int	 fputc(int, FILE *);
-int	 fputs(const char *, FILE *);
-size_t	 fread(void *, size_t, size_t, FILE *)
-      __overloadable __RENAME_CLANG(fread);
-int	 fscanf(FILE *, const char *, ...) __scanflike(2, 3);
-size_t	 fwrite(const void *, size_t, size_t, FILE *)
-    __overloadable __RENAME_CLANG(fwrite);
-int	 getc(FILE *);
-int	 getchar(void);
-ssize_t getdelim(char**, size_t*, int, FILE*) __INTRODUCED_IN(18);
-ssize_t getline(char**, size_t*, FILE*) __INTRODUCED_IN(18);
+void clearerr(FILE* __fp);
+int fclose(FILE* __fp);
+int feof(FILE* __fp);
+int ferror(FILE* __fp);
+int fflush(FILE* __fp);
+int fgetc(FILE* __fp);
+char* fgets(char* __buf, int __size, FILE* __fp) __overloadable __RENAME_CLANG(fgets);
+int fprintf(FILE* __fp , const char* __fmt, ...) __printflike(2, 3);
+int fputc(int __ch, FILE* __fp);
+int fputs(const char* __s, FILE* __fp);
+size_t fread(void* __buf, size_t __size, size_t __count, FILE* __fp) __overloadable __RENAME_CLANG(fread);
+int fscanf(FILE* __fp, const char* __fmt, ...) __scanflike(2, 3);
+size_t fwrite(const void* __buf, size_t __size, size_t __count, FILE* __fp) __overloadable __RENAME_CLANG(fwrite);
+int getc(FILE* __fp);
+int getchar(void);
+ssize_t getdelim(char** __line_ptr, size_t* __line_length_ptr, int __delimiter, FILE* __fp) __INTRODUCED_IN(18);
+ssize_t getline(char** __line_ptr, size_t* __line_length_ptr, FILE* __fp) __INTRODUCED_IN(18);
 
-void	 perror(const char *);
-int	 printf(const char *, ...) __printflike(1, 2);
-int	 putc(int, FILE *);
-int	 putchar(int);
-int	 puts(const char *);
-int	 remove(const char *);
-void	 rewind(FILE *);
-int	 scanf(const char *, ...) __scanflike(1, 2);
-void	 setbuf(FILE *, char *);
-int	 setvbuf(FILE *, char *, int, size_t);
-int	 sscanf(const char *, const char *, ...) __scanflike(2, 3);
-int	 ungetc(int, FILE *);
-int	 vfprintf(FILE *, const char *, va_list) __printflike(2, 0);
-int	 vprintf(const char *, va_list) __printflike(1, 0);
+void perror(const char* __msg);
+int printf(const char* __fmt, ...) __printflike(1, 2);
+int putc(int __ch, FILE* __fp);
+int putchar(int __ch);
+int puts(const char* __s);
+int remove(const char* __path);
+void rewind(FILE* __fp);
+int scanf(const char* __fmt, ...) __scanflike(1, 2);
+void setbuf(FILE* __fp, char* __buf);
+int setvbuf(FILE* __fp, char* __buf, int __mode, size_t __size);
+int sscanf(const char* __s, const char* __fmt, ...) __scanflike(2, 3);
+int ungetc(int __ch, FILE* __fp);
+int vfprintf(FILE* __fp, const char* __fmt, va_list __args) __printflike(2, 0);
+int vprintf(const char* __fp, va_list __args) __printflike(1, 0);
 
 #if __ANDROID_API__ >= 21
-int dprintf(int, const char*, ...) __printflike(2, 3) __INTRODUCED_IN(21);
-int vdprintf(int, const char*, va_list) __printflike(2, 0) __INTRODUCED_IN(21);
+int dprintf(int __fd, const char* __fmt, ...) __printflike(2, 3) __INTRODUCED_IN(21);
+int vdprintf(int __fd, const char* __fmt, va_list __args) __printflike(2, 0) __INTRODUCED_IN(21);
 #else
 /*
  * Old versions of Android called these fdprintf and vfdprintf out of fears that the glibc names
@@ -153,111 +147,113 @@
  * Allow users to just use dprintf and vfdprintf on any version by renaming those calls to their
  * legacy equivalents if needed.
  */
-int dprintf(int, const char*, ...) __RENAME(fdprintf) __printflike(2, 3);
-int vdprintf(int, const char*, va_list) __RENAME(vfdprintf) __printflike(2, 0);
+int dprintf(int __fd, const char* __fmt, ...) __RENAME(fdprintf) __printflike(2, 3);
+int vdprintf(int __fd, const char* __fmt, va_list __args) __RENAME(vfdprintf) __printflike(2, 0);
 #endif
 
 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 201112L) || \
     (defined(__cplusplus) && __cplusplus <= 201103L)
-char* gets(char*) __attribute__((deprecated("gets is unsafe, use fgets instead")));
+char* gets(char* __buf) __attribute__((deprecated("gets is unsafe, use fgets instead")));
 #endif
-int sprintf(char*, const char*, ...)
+int sprintf(char* __s, const char* __fmt, ...)
     __printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf")
     __overloadable __RENAME_CLANG(sprintf);
-int vsprintf(char*, const char*, va_list)
+int vsprintf(char* __s, const char* __fmt, va_list __args)
     __overloadable __printflike(2, 0) __RENAME_CLANG(vsprintf)
     __warnattr_strict("vsprintf is often misused; please use vsnprintf");
-char* tmpnam(char*)
+char* tmpnam(char* __s)
     __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
 #define P_tmpdir "/tmp/" /* deprecated */
-char* tempnam(const char*, const char*)
+char* tempnam(const char* __dir, const char* __prefix)
     __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
 
-int rename(const char*, const char*);
-int renameat(int, const char*, int, const char*);
+int rename(const char* __old_path, const char* __new_path);
+int renameat(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path);
 
-int fseek(FILE*, long, int);
-long ftell(FILE*);
+int fseek(FILE* __fp, long __offset, int __whence);
+long ftell(FILE* __fp);
 
 #if defined(__USE_FILE_OFFSET64)
-int fgetpos(FILE*, fpos_t*) __RENAME(fgetpos64) __INTRODUCED_IN(24);
-int fsetpos(FILE*, const fpos_t*) __RENAME(fsetpos64) __INTRODUCED_IN(24);
-int fseeko(FILE*, off_t, int) __RENAME(fseeko64) __INTRODUCED_IN(24);
-off_t ftello(FILE*) __RENAME(ftello64) __INTRODUCED_IN(24);
+int fgetpos(FILE* __fp, fpos_t* __pos) __RENAME(fgetpos64) __INTRODUCED_IN(24);
+int fsetpos(FILE* __fp, const fpos_t* __pos) __RENAME(fsetpos64) __INTRODUCED_IN(24);
+int fseeko(FILE* __fp, off_t __offset, int __whence) __RENAME(fseeko64) __INTRODUCED_IN(24);
+off_t ftello(FILE* __fp) __RENAME(ftello64) __INTRODUCED_IN(24);
 #  if defined(__USE_BSD)
-FILE* funopen(const void*,
-              int (*)(void*, char*, int),
-              int (*)(void*, const char*, int),
-              fpos_t (*)(void*, fpos_t, int),
-              int (*)(void*)) __RENAME(funopen64) __INTRODUCED_IN(24);
+FILE* funopen(const void* __cookie,
+              int (*__read_fn)(void*, char*, int),
+              int (*__write_fn)(void*, const char*, int),
+              fpos_t (*__seek_fn)(void*, fpos_t, int),
+              int (*__close_fn)(void*)) __RENAME(funopen64) __INTRODUCED_IN(24);
 #  endif
 #else
-int fgetpos(FILE*, fpos_t*);
-int fsetpos(FILE*, const fpos_t*);
-int fseeko(FILE*, off_t, int);
-off_t ftello(FILE*);
+int fgetpos(FILE* __fp, fpos_t* __pos);
+int fsetpos(FILE* __fp, const fpos_t* __pos);
+int fseeko(FILE* __fp, off_t __offset, int __whence);
+off_t ftello(FILE* __fp);
 #  if defined(__USE_BSD)
-FILE* funopen(const void*,
-              int (*)(void*, char*, int),
-              int (*)(void*, const char*, int),
-              fpos_t (*)(void*, fpos_t, int),
-              int (*)(void*));
+FILE* funopen(const void* __cookie,
+              int (*__read_fn)(void*, char*, int),
+              int (*__write_fn)(void*, const char*, int),
+              fpos_t (*__seek_fn)(void*, fpos_t, int),
+              int (*__close_fn)(void*));
 #  endif
 #endif
-int fgetpos64(FILE*, fpos64_t*) __INTRODUCED_IN(24);
-int fsetpos64(FILE*, const fpos64_t*) __INTRODUCED_IN(24);
-int fseeko64(FILE*, off64_t, int) __INTRODUCED_IN(24);
-off64_t ftello64(FILE*) __INTRODUCED_IN(24);
+int fgetpos64(FILE* __fp, fpos64_t* __pos) __INTRODUCED_IN(24);
+int fsetpos64(FILE* __fp, const fpos64_t* __pos) __INTRODUCED_IN(24);
+int fseeko64(FILE* __fp, off64_t __offset, int __whence) __INTRODUCED_IN(24);
+off64_t ftello64(FILE* __fp) __INTRODUCED_IN(24);
 #if defined(__USE_BSD)
-FILE* funopen64(const void*, int (*)(void*, char*, int), int (*)(void*, const char*, int),
-                fpos64_t (*)(void*, fpos64_t, int), int (*)(void*)) __INTRODUCED_IN(24);
+FILE* funopen64(const void* __cookie,
+                int (*__read_fn)(void*, char*, int),
+                int (*__write_fn)(void*, const char*, int),
+                fpos64_t (*__seek_fn)(void*, fpos64_t, int),
+                int (*__close_fn)(void*)) __INTRODUCED_IN(24);
 #endif
 
-FILE* fopen(const char*, const char*);
-FILE* fopen64(const char*, const char*) __INTRODUCED_IN(24);
-FILE* freopen(const char*, const char*, FILE*);
-FILE* freopen64(const char*, const char*, FILE*)
-  __INTRODUCED_IN(24);
+FILE* fopen(const char* __path, const char* __mode);
+FILE* fopen64(const char* __path, const char* __mode) __INTRODUCED_IN(24);
+FILE* freopen(const char* __path, const char* __mode, FILE* __fp);
+FILE* freopen64(const char* __path, const char* __mode, FILE* __fp) __INTRODUCED_IN(24);
 FILE* tmpfile(void);
 FILE* tmpfile64(void) __INTRODUCED_IN(24);
 
-int snprintf(char*, size_t, const char*, ...)
+int snprintf(char* __buf, size_t __size, const char* __fmt, ...)
     __printflike(3, 4) __overloadable __RENAME_CLANG(snprintf);
-int vfscanf(FILE*, const char*, va_list) __scanflike(2, 0);
-int vscanf(const char* , va_list) __scanflike(1, 0);
-int vsnprintf(char*, size_t, const char*, va_list)
+int vfscanf(FILE* __fp, const char* __fmt, va_list __args) __scanflike(2, 0);
+int vscanf(const char* __fmt , va_list __args) __scanflike(1, 0);
+int vsnprintf(char* __buf, size_t __size, const char* __fmt, va_list __args)
     __printflike(3, 0) __overloadable __RENAME_CLANG(vsnprintf);
-int vsscanf(const char*, const char*, va_list) __scanflike(2, 0);
+int vsscanf(const char* __s, const char* __fmt, va_list __args) __scanflike(2, 0);
 
 #define L_ctermid 1024 /* size for ctermid() */
-char* ctermid(char*) __INTRODUCED_IN(26);
+char* ctermid(char* __buf) __INTRODUCED_IN(26);
 
-FILE* fdopen(int, const char*);
-int fileno(FILE*);
-int pclose(FILE*);
-FILE* popen(const char*, const char*);
-void flockfile(FILE*);
-int ftrylockfile(FILE*);
-void funlockfile(FILE*);
-int getc_unlocked(FILE*);
+FILE* fdopen(int __fd, const char* __mode);
+int fileno(FILE* __fp);
+int pclose(FILE* __fp);
+FILE* popen(const char* __command, const char* __mode);
+void flockfile(FILE* __fp);
+int ftrylockfile(FILE* __fp);
+void funlockfile(FILE* __fp);
+int getc_unlocked(FILE* __fp);
 int getchar_unlocked(void);
-int putc_unlocked(int, FILE*);
-int putchar_unlocked(int);
+int putc_unlocked(int __ch, FILE* __fp);
+int putchar_unlocked(int __ch);
 
-FILE* fmemopen(void*, size_t, const char*) __INTRODUCED_IN(23);
-FILE* open_memstream(char**, size_t*) __INTRODUCED_IN(23);
+FILE* fmemopen(void* __buf, size_t __size, const char* __mode) __INTRODUCED_IN(23);
+FILE* open_memstream(char** __ptr, size_t* __size_ptr) __INTRODUCED_IN(23);
 
 #if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
-int  asprintf(char**, const char*, ...) __printflike(2, 3);
-char* fgetln(FILE*, size_t*);
-int fpurge(FILE*);
-void setbuffer(FILE*, char*, int);
-int setlinebuf(FILE*);
-int vasprintf(char**, const char*, va_list) __printflike(2, 0);
-void clearerr_unlocked(FILE*) __INTRODUCED_IN(23);
-int feof_unlocked(FILE*) __INTRODUCED_IN(23);
-int ferror_unlocked(FILE*) __INTRODUCED_IN(23);
-int fileno_unlocked(FILE*) __INTRODUCED_IN(24);
+int  asprintf(char** __s_ptr, const char* __fmt, ...) __printflike(2, 3);
+char* fgetln(FILE* __fp, size_t* __length_ptr);
+int fpurge(FILE* __fp);
+void setbuffer(FILE* __fp, char* __buf, int __size);
+int setlinebuf(FILE* __fp);
+int vasprintf(char** __s_ptr, const char* __fmt, va_list __args) __printflike(2, 0);
+void clearerr_unlocked(FILE* __fp) __INTRODUCED_IN(23);
+int feof_unlocked(FILE* __fp) __INTRODUCED_IN(23);
+int ferror_unlocked(FILE* __fp) __INTRODUCED_IN(23);
+int fileno_unlocked(FILE* __fp) __INTRODUCED_IN(24);
 #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
 #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
 #endif /* __USE_BSD */
@@ -268,4 +264,4 @@
 
 __END_DECLS
 
-#endif /* _STDIO_H_ */
+#endif
diff --git a/libc/include/string.h b/libc/include/string.h
index 631b3dd..33ef468 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -41,80 +41,81 @@
 #include <strings.h>
 #endif
 
-void* memccpy(void*, const void*, int, size_t);
-void* memchr(const void*, int, size_t) __attribute_pure__ __overloadable __RENAME_CLANG(memchr);
-void* memrchr(const void*, int, size_t) __attribute_pure__ __overloadable __RENAME_CLANG(memrchr);
-int memcmp(const void*, const void*, size_t) __attribute_pure__;
+void* memccpy(void* __dst, const void* __src, int __stop_char, size_t __n);
+void* memchr(const void* __s, int __ch, size_t __n) __attribute_pure__ __overloadable __RENAME_CLANG(memchr);
+void* memrchr(const void* __s, int __ch, size_t __n) __attribute_pure__ __overloadable __RENAME_CLANG(memrchr);
+int memcmp(const void* __lhs, const void* __rhs, size_t __n) __attribute_pure__;
 void* memcpy(void*, const void*, size_t)
         __overloadable __RENAME_CLANG(memcpy);
 #if defined(__USE_GNU)
-void* mempcpy(void*, const void*, size_t) __INTRODUCED_IN(23);
+void* mempcpy(void* __dst, const void* __src, size_t __n) __INTRODUCED_IN(23);
 #endif
-void* memmove(void*, const void*, size_t) __overloadable __RENAME_CLANG(memmove);
-void* memset(void*, int, size_t) __overloadable __RENAME_CLANG(memset);
-void* memmem(const void*, size_t, const void*, size_t) __attribute_pure__;
+void* memmove(void* __dst, const void* __src, size_t __n) __overloadable __RENAME_CLANG(memmove);
+void* memset(void* __dst, int __ch, size_t __n) __overloadable __RENAME_CLANG(memset);
+void* memmem(const void* __haystack, size_t __haystack_size, const void* __needle, size_t __needle_size) __attribute_pure__;
 
-char* strchr(const char*, int) __attribute_pure__ __overloadable __RENAME_CLANG(strchr);
-char* __strchr_chk(const char*, int, size_t) __INTRODUCED_IN(18);
+char* strchr(const char* __s, int __ch) __attribute_pure__ __overloadable __RENAME_CLANG(strchr);
+char* __strchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18);
 #if defined(__USE_GNU)
 #if defined(__cplusplus)
-extern "C++" char* strchrnul(char*, int) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
-extern "C++" const char* strchrnul(const char*, int) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
+/* The versioner doesn't handle C++ blocks yet, so manually guarded. */
+#if __ANDROID_API__ >= 24
+extern "C++" char* strchrnul(char* __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
+extern "C++" const char* strchrnul(const char* __s, int __ch) __RENAME(strchrnul) __attribute_pure__ __INTRODUCED_IN(24);
+#endif  /* __ANDROID_API__ >= 24 */
 #else
-char* strchrnul(const char*, int) __attribute_pure__ __INTRODUCED_IN(24);
+char* strchrnul(const char* __s, int __ch) __attribute_pure__ __INTRODUCED_IN(24);
 #endif
 #endif
 
-char* strrchr(const char*, int) __attribute_pure__ __overloadable __RENAME_CLANG(strrchr);
-char* __strrchr_chk(const char*, int, size_t) __INTRODUCED_IN(18);
+char* strrchr(const char* __s, int __ch) __attribute_pure__ __overloadable __RENAME_CLANG(strrchr);
+char* __strrchr_chk(const char* __s, int __ch, size_t __n) __INTRODUCED_IN(18);
 
-size_t strlen(const char*) __attribute_pure__ __overloadable
-        __RENAME_CLANG(strlen);
-size_t __strlen_chk(const char*, size_t) __INTRODUCED_IN(17);
+size_t strlen(const char* __s) __attribute_pure__ __overloadable __RENAME_CLANG(strlen);
+size_t __strlen_chk(const char* __s, size_t __n) __INTRODUCED_IN(17);
 
-int strcmp(const char*, const char*) __attribute_pure__;
-char* stpcpy(char*, const char*) __overloadable __RENAME_CLANG(stpcpy) __INTRODUCED_IN(21);
-char* strcpy(char*, const char*)
-        __overloadable __RENAME_CLANG(strcpy);
-char* strcat(char*, const char*) __overloadable __RENAME_CLANG(strcat);
-char* strdup(const char*);
+int strcmp(const char* __lhs, const char* __rhs) __attribute_pure__;
+char* stpcpy(char* __dst, const char* __src) __overloadable __RENAME_CLANG(stpcpy) __INTRODUCED_IN(21);
+char* strcpy(char* __dst, const char* __src) __overloadable __RENAME_CLANG(strcpy);
+char* strcat(char* __dst, const char* __src) __overloadable __RENAME_CLANG(strcat);
+char* strdup(const char* __s);
 
-char* strstr(const char*, const char*) __attribute_pure__;
-char* strcasestr(const char*, const char*) __attribute_pure__;
-char* strtok(char*, const char*);
-char* strtok_r(char*, const char*, char**);
+char* strstr(const char* __haystack, const char* __needle) __attribute_pure__;
+char* strcasestr(const char* __haystack, const char* __needle) __attribute_pure__;
+char* strtok(char* __s, const char* __delimiter);
+char* strtok_r(char* __s, const char* __delimiter, char** __pos_ptr);
 
-char* strerror(int);
-char* strerror_l(int, locale_t) __INTRODUCED_IN(23);
+char* strerror(int __errno_value);
+char* strerror_l(int __errno_value, locale_t __l) __INTRODUCED_IN(23);
 #if defined(__USE_GNU) && __ANDROID_API__ >= 23
-char* strerror_r(int, char*, size_t) __RENAME(__gnu_strerror_r) __INTRODUCED_IN(23);
+char* strerror_r(int __errno_value, char* __buf, size_t __n) __RENAME(__gnu_strerror_r) __INTRODUCED_IN(23);
 #else /* POSIX */
-int strerror_r(int, char*, size_t);
+int strerror_r(int __errno_value, char* __buf, size_t __n);
 #endif
 
-size_t strnlen(const char*, size_t) __attribute_pure__;
-char* strncat(char*, const char*, size_t) __overloadable __RENAME_CLANG(strncat);
-char* strndup(const char*, size_t);
-int strncmp(const char*, const char*, size_t) __attribute_pure__;
-char* stpncpy(char*, const char*, size_t) __overloadable __RENAME_CLANG(stpncpy) __INTRODUCED_IN(21);
-char* strncpy(char*, const char*, size_t) __overloadable __RENAME_CLANG(strncpy);
+size_t strnlen(const char* __s, size_t __n) __attribute_pure__;
+char* strncat(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strncat);
+char* strndup(const char* __s, size_t __n);
+int strncmp(const char* __lhs, const char* __rhs, size_t __n) __attribute_pure__;
+char* stpncpy(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(stpncpy) __INTRODUCED_IN(21);
+char* strncpy(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strncpy);
 
-size_t strlcat(char*, const char*, size_t) __overloadable __RENAME_CLANG(strlcat);
-size_t strlcpy(char*, const char*, size_t) __overloadable __RENAME_CLANG(strlcpy);
+size_t strlcat(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strlcat);
+size_t strlcpy(char* __dst, const char* __src, size_t __n) __overloadable __RENAME_CLANG(strlcpy);
 
-size_t strcspn(const char*, const char*) __attribute_pure__;
-char* strpbrk(const char*, const char*) __attribute_pure__;
-char* strsep(char**, const char*);
-size_t strspn(const char*, const char*);
+size_t strcspn(const char* __s, const char* __reject) __attribute_pure__;
+char* strpbrk(const char* __s, const char* __accept) __attribute_pure__;
+char* strsep(char** __s_ptr, const char* __delimiter);
+size_t strspn(const char* __s, const char* __accept);
 
-char* strsignal(int);
+char* strsignal(int __signal);
 
-int strcoll(const char*, const char*) __attribute_pure__;
-size_t strxfrm(char*, const char*, size_t);
+int strcoll(const char* __lhs, const char* __rhs) __attribute_pure__;
+size_t strxfrm(char* __dst, const char* __src, size_t __n);
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-int strcoll_l(const char*, const char*, locale_t) __attribute_pure__ __INTRODUCED_IN(21);
-size_t strxfrm_l(char*, const char*, size_t, locale_t) __INTRODUCED_IN(21);
+int strcoll_l(const char* __lhs, const char* __rhs, locale_t __l) __attribute_pure__ __INTRODUCED_IN(21);
+size_t strxfrm_l(char* __dst, const char* __src, size_t __n, locale_t __l) __INTRODUCED_IN(21);
 #else
 // Implemented as static inlines before 21.
 #endif
@@ -125,10 +126,13 @@
  * It doesn't modify its argument, and in C++ it's const-correct.
  */
 #if defined(__cplusplus)
-extern "C++" char* basename(char*) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
-extern "C++" const char* basename(const char*) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+/* The versioner doesn't handle C++ blocks yet, so manually guarded. */
+#if __ANDROID_API__ >= 23
+extern "C++" char* basename(char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+extern "C++" const char* basename(const char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+#endif  /* __ANDROID_API__ >= 23 */
 #else
-char* basename(const char*) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
+char* basename(const char* __path) __RENAME(__gnu_basename) __INTRODUCED_IN(23);
 #endif
 #endif
 
@@ -224,4 +228,4 @@
 
 __END_DECLS
 
-#endif /* _STRING_H */
+#endif
diff --git a/libc/include/strings.h b/libc/include/strings.h
index 11f3213..c2e0a5e 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -55,11 +55,11 @@
 #endif
 
 #if !defined(__i386__) || __ANDROID_API__ >= __ANDROID_API_J_MR2__
-int ffs(int) __INTRODUCED_IN_X86(18);
+int ffs(int __i) __INTRODUCED_IN_X86(18);
 #endif
 
 __END_DECLS
 
 #include <android/legacy_strings_inlines.h>
 
-#endif /* !defined(_STRINGS_H_) */
+#endif
diff --git a/libc/include/sys/_system_properties.h b/libc/include/sys/_system_properties.h
index f8dbd33..67beb9a 100644
--- a/libc/include/sys/_system_properties.h
+++ b/libc/include/sys/_system_properties.h
@@ -61,14 +61,14 @@
 ** Map the property area from the specified filename.  This
 ** method is for testing only.
 */
-int __system_property_set_filename(const char *filename);
+int __system_property_set_filename(const char* __filename);
 
 /*
 ** Initialize the area to be used to store properties.  Can
 ** only be done by a single process that has write access to
 ** the property area.
 */
-int __system_property_area_init();
+int __system_property_area_init(void);
 
 /* Read the global serial number of the system properties
 **
@@ -92,7 +92,7 @@
 **
 ** Returns the serial number on success, -1 on error.
 */
-uint32_t __system_property_area_serial();
+uint32_t __system_property_area_serial(void);
 
 /* Add a new system property.  Can only be done by a single
 ** process that has write access to the property area, and
@@ -102,7 +102,7 @@
 **
 ** Returns 0 on success, -1 if the property area is full.
 */
-int __system_property_add(const char *name, unsigned int namelen, const char *value, unsigned int valuelen);
+int __system_property_add(const char* __name, unsigned int __name_length, const char* __value, unsigned int __value_length);
 
 /* Update the value of a system property returned by
 ** __system_property_find.  Can only be done by a single process
@@ -112,14 +112,14 @@
 **
 ** Returns 0 on success, -1 if the parameters are incorrect.
 */
-int __system_property_update(prop_info *pi, const char *value, unsigned int len);
+int __system_property_update(prop_info* __pi, const char* __value, unsigned int __value_length);
 
 /* Read the serial number of a system property returned by
 ** __system_property_find.
 **
 ** Returns the serial number on success, -1 on error.
 */
-uint32_t __system_property_serial(const prop_info* pi);
+uint32_t __system_property_serial(const prop_info* __pi);
 
 /* Initialize the system properties area in read only mode.
  * Should be done by all processes that need to read system
@@ -127,10 +127,10 @@
  *
  * Returns 0 on success, -1 otherwise.
  */
-int __system_properties_init();
+int __system_properties_init(void);
 
 /* Deprecated: use __system_property_wait instead. */
-uint32_t __system_property_wait_any(uint32_t old_serial);
+uint32_t __system_property_wait_any(uint32_t __old_serial);
 
 __END_DECLS
 
diff --git a/libc/include/sys/auxv.h b/libc/include/sys/auxv.h
index ab5a39d..9251390 100644
--- a/libc/include/sys/auxv.h
+++ b/libc/include/sys/auxv.h
@@ -35,8 +35,8 @@
 
 __BEGIN_DECLS
 
-unsigned long int getauxval(unsigned long int type) __INTRODUCED_IN(18);
+unsigned long int getauxval(unsigned long int __type) __INTRODUCED_IN(18);
 
 __END_DECLS
 
-#endif /* _SYS_AUXV_H_ */
+#endif
diff --git a/libc/include/sys/cachectl.h b/libc/include/sys/cachectl.h
index 5b20c19..9235327 100644
--- a/libc/include/sys/cachectl.h
+++ b/libc/include/sys/cachectl.h
@@ -34,4 +34,4 @@
 #include <asm/cachectl.h>
 #endif
 
-#endif /* sys/cachectl.h */
+#endif
diff --git a/libc/include/sys/capability.h b/libc/include/sys/capability.h
index b9a40b3..637c844 100644
--- a/libc/include/sys/capability.h
+++ b/libc/include/sys/capability.h
@@ -34,9 +34,9 @@
 
 __BEGIN_DECLS
 
-int capget(cap_user_header_t hdrp, cap_user_data_t datap);
-int capset(cap_user_header_t hdrp, const cap_user_data_t datap);
+int capget(cap_user_header_t __hdr_ptr, cap_user_data_t __data_ptr);
+int capset(cap_user_header_t __hdr_ptr, const cap_user_data_t __data_ptr);
 
 __END_DECLS
 
-#endif /* _BIONIC_SYS_CAPABILITY_H */
+#endif
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 9541520..58eebc5 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -239,8 +239,18 @@
 
 #define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
 
-#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
-#  define __BIONIC_FORTIFY 1
+#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
+#  if defined(__clang__)
+/* FORTIFY's _chk functions effectively disable ASAN's stdlib interceptors. */
+#    if !__has_feature(address_sanitizer)
+#      define __BIONIC_FORTIFY 1
+#    endif
+#  elif defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
+#    define __BIONIC_FORTIFY 1
+#  endif
+#endif
+
+#if defined(__BIONIC_FORTIFY)
 #  if _FORTIFY_SOURCE == 2
 #    define __bos_level 1
 #  else
@@ -281,8 +291,7 @@
 #define __pass_object_size __pass_object_size_n(__bos_level)
 #define __pass_object_size0 __pass_object_size_n(0)
 
-/* FIXME: This should be __BIONIC_FORTIFY, but we don't enable FORTIFY in -O0. */
-#if (defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0) || defined(__BIONIC_DECLARE_FORTIFY_HELPERS)
+#if defined(__BIONIC_FORTIFY) || defined(__BIONIC_DECLARE_FORTIFY_HELPERS)
 #  define __BIONIC_INCLUDE_FORTIFY_HEADERS 1
 #endif
 
diff --git a/libc/include/sys/endian.h b/libc/include/sys/endian.h
index de172fe..799a6f2 100644
--- a/libc/include/sys/endian.h
+++ b/libc/include/sys/endian.h
@@ -49,10 +49,10 @@
 
 /* glibc compatibility. */
 __BEGIN_DECLS
-uint32_t htonl(uint32_t) __attribute_const__ __INTRODUCED_IN(21);
-uint16_t htons(uint16_t) __attribute_const__ __INTRODUCED_IN(21);
-uint32_t ntohl(uint32_t) __attribute_const__ __INTRODUCED_IN(21);
-uint16_t ntohs(uint16_t) __attribute_const__ __INTRODUCED_IN(21);
+uint32_t htonl(uint32_t __x) __attribute_const__ __INTRODUCED_IN(21);
+uint16_t htons(uint16_t __x) __attribute_const__ __INTRODUCED_IN(21);
+uint32_t ntohl(uint32_t __x) __attribute_const__ __INTRODUCED_IN(21);
+uint16_t ntohs(uint16_t __x) __attribute_const__ __INTRODUCED_IN(21);
 __END_DECLS
 
 #define htonl(x) __swap32(x)
@@ -103,4 +103,4 @@
 #define le64toh(x) htole64(x)
 #endif /* __USE_BSD */
 
-#endif /* _SYS_ENDIAN_H_ */
+#endif
diff --git a/libc/include/sys/epoll.h b/libc/include/sys/epoll.h
index fcdab43..6ecd93f 100644
--- a/libc/include/sys/epoll.h
+++ b/libc/include/sys/epoll.h
@@ -53,8 +53,8 @@
 #endif
 ;
 
-int epoll_create(int);
-int epoll_create1(int) __INTRODUCED_IN(21);
+int epoll_create(int __size);
+int epoll_create1(int __flags) __INTRODUCED_IN(21);
 
 /*
  * Some third-party code uses the existence of EPOLL_CLOEXEC to detect the
@@ -71,10 +71,10 @@
 #undef EPOLL_CLOEXEC
 #endif
 
-int epoll_ctl(int, int, int, struct epoll_event*);
-int epoll_wait(int, struct epoll_event*, int, int);
-int epoll_pwait(int, struct epoll_event*, int, int, const sigset_t*) __INTRODUCED_IN(21);
+int epoll_ctl(int __epoll_fd, int __op, int __fd, struct epoll_event* __event);
+int epoll_wait(int __epoll_fd, struct epoll_event* __events, int __event_count, int __timeout_ms);
+int epoll_pwait(int __epoll_fd, struct epoll_event* __events, int __event_count, int __timeout_ms, const sigset_t* __mask) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif  /* _SYS_EPOLL_H_ */
+#endif
diff --git a/libc/include/sys/eventfd.h b/libc/include/sys/eventfd.h
index 6b9749a..3cfb5e7 100644
--- a/libc/include/sys/eventfd.h
+++ b/libc/include/sys/eventfd.h
@@ -37,14 +37,13 @@
 #define EFD_CLOEXEC O_CLOEXEC
 #define EFD_NONBLOCK O_NONBLOCK
 
-/* type of event counter */
 typedef uint64_t eventfd_t;
 
-int eventfd(unsigned int initial_value, int flags);
+int eventfd(unsigned int __initial_value, int __flags);
 
-int eventfd_read(int fd, eventfd_t* value);
-int eventfd_write(int fd, eventfd_t value);
+int eventfd_read(int __fd, eventfd_t* __value);
+int eventfd_write(int __fd, eventfd_t __value);
 
 __END_DECLS
 
-#endif /* _SYS_EVENTFD_H */
+#endif
diff --git a/libc/include/sys/file.h b/libc/include/sys/file.h
index f414d34..a420021 100644
--- a/libc/include/sys/file.h
+++ b/libc/include/sys/file.h
@@ -36,8 +36,8 @@
 
 __BEGIN_DECLS
 
-int flock(int, int);
+int flock(int __fd, int __op);
 
 __END_DECLS
 
-#endif /* _SYS_FILE_H_ */
+#endif
diff --git a/libc/include/sys/fsuid.h b/libc/include/sys/fsuid.h
index e4d9ebc..bb7a58d 100644
--- a/libc/include/sys/fsuid.h
+++ b/libc/include/sys/fsuid.h
@@ -34,9 +34,9 @@
 
 __BEGIN_DECLS
 
-int setfsuid(uid_t) __INTRODUCED_IN(21);
-int setfsgid(gid_t) __INTRODUCED_IN(21);
+int setfsuid(uid_t __uid) __INTRODUCED_IN(21);
+int setfsgid(gid_t __gid) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* _SYS_FSUID_H_ */
+#endif
diff --git a/libc/include/sys/inotify.h b/libc/include/sys/inotify.h
index 98f7198..32e16d9 100644
--- a/libc/include/sys/inotify.h
+++ b/libc/include/sys/inotify.h
@@ -54,10 +54,10 @@
 #endif
 
 int inotify_init(void);
-int inotify_init1(int) __INTRODUCED_IN(21);
-int inotify_add_watch(int, const char*, uint32_t);
-int inotify_rm_watch(int, uint32_t);
+int inotify_init1(int __flags) __INTRODUCED_IN(21);
+int inotify_add_watch(int __fd, const char* __path, uint32_t __mask);
+int inotify_rm_watch(int __fd, uint32_t __watch_descriptor);
 
 __END_DECLS
 
-#endif /* _SYS_INOTIFY_H_ */
+#endif
diff --git a/libc/include/sys/ioctl.h b/libc/include/sys/ioctl.h
index efbcb0c..76dc1ff 100644
--- a/libc/include/sys/ioctl.h
+++ b/libc/include/sys/ioctl.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _SYS_IOCTL_H_
 #define _SYS_IOCTL_H_
 
@@ -41,4 +42,4 @@
 
 #include <bits/ioctl.h>
 
-#endif /* _SYS_IOCTL_H_ */
+#endif
diff --git a/libc/include/sys/ipc.h b/libc/include/sys/ipc.h
index 3d6c45f..dee7c8a 100644
--- a/libc/include/sys/ipc.h
+++ b/libc/include/sys/ipc.h
@@ -42,8 +42,8 @@
 
 __BEGIN_DECLS
 
-key_t ftok(const char* path, int id);
+key_t ftok(const char* __path, int __id);
 
 __END_DECLS
 
-#endif /* _SYS_IPC_H */
+#endif
diff --git a/libc/include/sys/klog.h b/libc/include/sys/klog.h
index 47eb3a4..ed746fc 100644
--- a/libc/include/sys/klog.h
+++ b/libc/include/sys/klog.h
@@ -46,8 +46,8 @@
 #define KLOG_SIZE_UNREAD   9
 #define KLOG_SIZE_BUFFER   10
 
-int klogctl(int, char *, int);
+int klogctl(int __type, char* __buf, int __buf_size);
 
 __END_DECLS
 
-#endif /* _SYS_KLOG_H_ */
+#endif
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index 1440dc6..1e752c4 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _SYS_MMAN_H_
 #define _SYS_MMAN_H_
 
@@ -44,27 +45,27 @@
 #define MREMAP_FIXED    2
 
 #if defined(__USE_FILE_OFFSET64)
-void* mmap(void*, size_t, int, int, int, off_t) __RENAME(mmap64) __INTRODUCED_IN(21);
+void* mmap(void* __addr, size_t __size, int __prot, int __flags, int __fd, off_t __offset) __RENAME(mmap64) __INTRODUCED_IN(21);
 #else
-void* mmap(void*, size_t, int, int, int, off_t);
+void* mmap(void* __addr, size_t __size, int __prot, int __flags, int __fd, off_t __offset);
 #endif
 
-void* mmap64(void*, size_t, int, int, int, off64_t) __INTRODUCED_IN(21);
+void* mmap64(void* __addr, size_t __size, int __prot, int __flags, int __fd, off64_t __offset) __INTRODUCED_IN(21);
 
-int munmap(void*, size_t);
-int msync(void*, size_t, int);
-int mprotect(void*, size_t, int);
-void* mremap(void*, size_t, size_t, int, ...);
+int munmap(void* __addr, size_t __size);
+int msync(void* __addr, size_t __size, int __flags);
+int mprotect(void* __addr, size_t __size, int __prot);
+void* mremap(void* __old_addr, size_t __old_size, size_t __new_size, int __flags, ...);
 
-int mlockall(int) __INTRODUCED_IN(17);
+int mlockall(int __flags) __INTRODUCED_IN(17);
 int munlockall(void) __INTRODUCED_IN(17);
 
-int mlock(const void*, size_t);
-int munlock(const void*, size_t);
+int mlock(const void* __addr, size_t __size);
+int munlock(const void* __addr, size_t __size);
 
-int mincore(void*, size_t, unsigned char*);
+int mincore(void* __addr, size_t __size, unsigned char* __vector);
 
-int madvise(void*, size_t, int);
+int madvise(void* __addr, size_t __size, int __advice);
 
 #if __ANDROID_API__ >= __ANDROID_API_M__
 /*
@@ -81,8 +82,8 @@
 #define POSIX_MADV_WILLNEED   MADV_WILLNEED
 #define POSIX_MADV_DONTNEED   MADV_DONTNEED
 #endif
-int posix_madvise(void*, size_t, int) __INTRODUCED_IN(23);
+int posix_madvise(void* __addr, size_t __size, int __advice) __INTRODUCED_IN(23);
 
 __END_DECLS
 
-#endif /* _SYS_MMAN_H_ */
+#endif
diff --git a/libc/include/sys/mount.h b/libc/include/sys/mount.h
index 26c0e0f..c0c084b 100644
--- a/libc/include/sys/mount.h
+++ b/libc/include/sys/mount.h
@@ -41,10 +41,10 @@
 #define MNT_EXPIRE 4
 #define UMOUNT_NOFOLLOW 8
 
-int mount(const char*, const char*, const char*, unsigned long, const void*);
-int umount(const char*);
-int umount2(const char*, int);
+int mount(const char* __source, const char* __target, const char* __fs_type, unsigned long __flags, const void* __data);
+int umount(const char* __target);
+int umount2(const char* __target, int __flags);
 
 __END_DECLS
 
-#endif /* _SYS_MOUNT_H */
+#endif
diff --git a/libc/include/sys/msg.h b/libc/include/sys/msg.h
index ced5a3e..0273499 100644
--- a/libc/include/sys/msg.h
+++ b/libc/include/sys/msg.h
@@ -41,11 +41,11 @@
 typedef __kernel_ulong_t msgqnum_t;
 typedef __kernel_ulong_t msglen_t;
 
-int msgctl(int, int, struct msqid_ds*) __INTRODUCED_IN(26);
-int msgget(key_t, int) __INTRODUCED_IN(26);
-ssize_t msgrcv(int, void*, size_t, long, int) __INTRODUCED_IN(26);
-int msgsnd(int, const void*, size_t, int) __INTRODUCED_IN(26);
+int msgctl(int __msg_id, int __cmd, struct msqid_ds* __buf) __INTRODUCED_IN(26);
+int msgget(key_t __key, int __flags) __INTRODUCED_IN(26);
+ssize_t msgrcv(int __msg_id, void* __msgbuf_ptr, size_t __size, long __type, int __flags) __INTRODUCED_IN(26);
+int msgsnd(int __msg_id, const void* __msgbuf_ptr, size_t __size, int __flags) __INTRODUCED_IN(26);
 
 __END_DECLS
 
-#endif /* _SYS_MSG_H_ */
+#endif
diff --git a/libc/include/sys/param.h b/libc/include/sys/param.h
index d3686e0..ec50da2 100644
--- a/libc/include/sys/param.h
+++ b/libc/include/sys/param.h
@@ -49,4 +49,4 @@
 #define MIN(a,b) (((a)<(b))?(a):(b))
 #define MAX(a,b) (((a)>(b))?(a):(b))
 
-#endif /* _SYS_PARAM_H_ */
+#endif
diff --git a/libc/include/sys/personality.h b/libc/include/sys/personality.h
index 6f3a3c9..51b5cd7 100644
--- a/libc/include/sys/personality.h
+++ b/libc/include/sys/personality.h
@@ -34,8 +34,8 @@
 
 __BEGIN_DECLS
 
-int personality(unsigned int persona) __INTRODUCED_IN(15);
+int personality(unsigned int __persona) __INTRODUCED_IN(15);
 
 __END_DECLS
 
-#endif /* _SYS_PERSONALITY_H_ */
+#endif
diff --git a/libc/include/sys/prctl.h b/libc/include/sys/prctl.h
index 742ed57..64f5954 100644
--- a/libc/include/sys/prctl.h
+++ b/libc/include/sys/prctl.h
@@ -35,8 +35,8 @@
 
 __BEGIN_DECLS
 
-int prctl(int option, ...);
+int prctl(int __option, ...);
 
 __END_DECLS
 
-#endif /* _SYS_PRCTL_H */
+#endif
diff --git a/libc/include/sys/procfs.h b/libc/include/sys/procfs.h
index eff39e2..75a1e98 100644
--- a/libc/include/sys/procfs.h
+++ b/libc/include/sys/procfs.h
@@ -59,4 +59,4 @@
 
 __END_DECLS
 
-#endif /* _SYS_PROCFS_H_ */
+#endif
diff --git a/libc/include/sys/ptrace.h b/libc/include/sys/ptrace.h
index 4b881e7..022fc3a 100644
--- a/libc/include/sys/ptrace.h
+++ b/libc/include/sys/ptrace.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _SYS_PTRACE_H_
 #define _SYS_PTRACE_H_
 
@@ -58,8 +59,8 @@
 #define PT_GETSIGINFO PTRACE_GETSIGINFO
 #define PT_SETSIGINFO PTRACE_SETSIGINFO
 
-long ptrace(int, ...);
+long ptrace(int __request, ...);
 
 __END_DECLS
 
-#endif /* _SYS_PTRACE_H_ */
+#endif
diff --git a/libc/include/sys/quota.h b/libc/include/sys/quota.h
index 51f7675..157c2d9 100644
--- a/libc/include/sys/quota.h
+++ b/libc/include/sys/quota.h
@@ -40,7 +40,7 @@
 
 __BEGIN_DECLS
 
-int quotactl(int, const char*, int, char*) __INTRODUCED_IN(26);
+int quotactl(int __cmd, const char* __special, int __id, char* __addr) __INTRODUCED_IN(26);
 
 __END_DECLS
 
diff --git a/libc/include/sys/reboot.h b/libc/include/sys/reboot.h
index df4739e..c0c4860 100644
--- a/libc/include/sys/reboot.h
+++ b/libc/include/sys/reboot.h
@@ -42,8 +42,8 @@
 #define RB_DISABLE_CAD  LINUX_REBOOT_CMD_CAD_OFF
 #define RB_POWER_OFF    LINUX_REBOOT_CMD_POWER_OFF
 
-int reboot(int reboot_type);
+int reboot(int __cmd);
 
 __END_DECLS
 
-#endif /* _SYS_REBOOT_H_ */
+#endif
diff --git a/libc/include/sys/reg.h b/libc/include/sys/reg.h
index 1066b6d..6c496ba 100644
--- a/libc/include/sys/reg.h
+++ b/libc/include/sys/reg.h
@@ -83,4 +83,4 @@
 
 #endif
 
-#endif /* _SYS_REG_H_ */
+#endif
diff --git a/libc/include/sys/resource.h b/libc/include/sys/resource.h
index 7c43ca3..9181125 100644
--- a/libc/include/sys/resource.h
+++ b/libc/include/sys/resource.h
@@ -42,21 +42,20 @@
 
 typedef unsigned long rlim_t;
 
-int getrlimit(int, struct rlimit*);
-int setrlimit(int, const struct rlimit*);
+int getrlimit(int __resource, struct rlimit* __limit);
+int setrlimit(int __resource, const struct rlimit* __limit);
 
-int getrlimit64(int, struct rlimit64*) __INTRODUCED_IN(21);
-int setrlimit64(int, const struct rlimit64*) __INTRODUCED_IN(21);
+int getrlimit64(int __resource, struct rlimit64* __limit) __INTRODUCED_IN(21);
+int setrlimit64(int __resource, const struct rlimit64* __limit) __INTRODUCED_IN(21);
 
-int getpriority(int, id_t);
-int setpriority(int, id_t, int);
+int getpriority(int __which, id_t __who);
+int setpriority(int __which, id_t __who, int __priority);
 
-int getrusage(int, struct rusage*);
+int getrusage(int __who, struct rusage* __usage);
 
-int prlimit(pid_t, int, const struct rlimit*, struct rlimit*) __INTRODUCED_IN_32(24)
-  __INTRODUCED_IN_64(21);
-int prlimit64(pid_t, int, const struct rlimit64*, struct rlimit64*) __INTRODUCED_IN(21);
+int prlimit(pid_t __pid, int __resource, const struct rlimit* __new_limit, struct rlimit* __old_limit) __INTRODUCED_IN_32(24) __INTRODUCED_IN_64(21);
+int prlimit64(pid_t __pid, int __resource, const struct rlimit64* __new_limit, struct rlimit64* __old_limit) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* _SYS_RESOURCE_H_ */
+#endif
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 40bd32e..e919188 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -72,9 +72,9 @@
 #define FD_ISSET(fd, set) ((__FDS_BITS(set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
 #endif /* defined(__BIONIC_FORTIFY) && __ANDROID_API >= 21 */
 
-int select(int, fd_set*, fd_set*, fd_set*, struct timeval*);
-int pselect(int, fd_set*, fd_set*, fd_set*, const struct timespec*, const sigset_t*);
+int select(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, struct timeval* __timeout);
+int pselect(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set* __exception_fds, const struct timespec* __timeout, const sigset_t* __mask);
 
 __END_DECLS
 
-#endif /* _SYS_SELECT_H_ */
+#endif
diff --git a/libc/include/sys/sem.h b/libc/include/sys/sem.h
index be0e22d..cd62242 100644
--- a/libc/include/sys/sem.h
+++ b/libc/include/sys/sem.h
@@ -51,12 +51,12 @@
   void* __pad;
 };
 
-int semctl(int, int, int, ...) __INTRODUCED_IN(26);
-int semget(key_t, int, int) __INTRODUCED_IN(26);
-int semop(int, struct sembuf*, size_t) __INTRODUCED_IN(26);
+int semctl(int __sem_id, int __sem_num, int __cmd, ...) __INTRODUCED_IN(26);
+int semget(key_t __key, int __sem_count, int __flags) __INTRODUCED_IN(26);
+int semop(int __sem_id, struct sembuf* __ops, size_t __op_count) __INTRODUCED_IN(26);
 
 #if defined(__USE_GNU)
-int semtimedop(int, struct sembuf*, size_t, const struct timespec*) __INTRODUCED_IN(26);
+int semtimedop(int __sem_id, struct sembuf* __ops, size_t __op_count, const struct timespec* __timeout) __INTRODUCED_IN(26);
 #endif
 
 __END_DECLS
diff --git a/libc/include/sys/sendfile.h b/libc/include/sys/sendfile.h
index 43b334c..ecdb76c 100644
--- a/libc/include/sys/sendfile.h
+++ b/libc/include/sys/sendfile.h
@@ -35,12 +35,12 @@
 __BEGIN_DECLS
 
 #if defined(__USE_FILE_OFFSET64)
-ssize_t sendfile(int out_fd, int in_fd, off_t* offset, size_t count) __RENAME(sendfile64) __INTRODUCED_IN(21);
+ssize_t sendfile(int __out_fd, int __in_fd, off_t* __offset, size_t __count) __RENAME(sendfile64) __INTRODUCED_IN(21);
 #else
-ssize_t sendfile(int out_fd, int in_fd, off_t* offset, size_t count);
+ssize_t sendfile(int __out_fd, int __in_fd, off_t* __offset, size_t __count);
 #endif
-ssize_t sendfile64(int out_fd, int in_fd, off64_t* offset, size_t count) __INTRODUCED_IN(21);
+ssize_t sendfile64(int __out_fd, int __in_fd, off64_t* __offset, size_t __count) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* _SYS_SENDFILE_H_ */
+#endif
diff --git a/libc/include/sys/shm.h b/libc/include/sys/shm.h
index ccd3b36..4723eba 100644
--- a/libc/include/sys/shm.h
+++ b/libc/include/sys/shm.h
@@ -42,10 +42,10 @@
 
 typedef unsigned long shmatt_t;
 
-void* shmat(int, const void*, int) __INTRODUCED_IN(26);
-int shmctl(int, int, struct shmid_ds*) __INTRODUCED_IN(26);
-int shmdt(const void*) __INTRODUCED_IN(26);
-int shmget(key_t, size_t, int) __INTRODUCED_IN(26);
+void* shmat(int __shm_id, const void* __addr, int __flags) __INTRODUCED_IN(26);
+int shmctl(int __shm_id, int __cmd, struct shmid_ds* __buf) __INTRODUCED_IN(26);
+int shmdt(const void* __addr) __INTRODUCED_IN(26);
+int shmget(key_t __key, size_t __size, int __flags) __INTRODUCED_IN(26);
 
 __END_DECLS
 
diff --git a/libc/include/sys/signalfd.h b/libc/include/sys/signalfd.h
index 1e4d464..315622c 100644
--- a/libc/include/sys/signalfd.h
+++ b/libc/include/sys/signalfd.h
@@ -36,8 +36,8 @@
 
 __BEGIN_DECLS
 
-int signalfd(int fd, const sigset_t* mask, int flags) __INTRODUCED_IN(18);
+int signalfd(int __fd, const sigset_t* __mask, int __flags) __INTRODUCED_IN(18);
 
 __END_DECLS
 
-#endif /* _SYS_SIGNALFD_H */
+#endif
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 6875d7f..ed851a2 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -115,7 +115,7 @@
 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) &&   (cmsg)->cmsg_len <= (unsigned long)   ((mhdr)->msg_controllen -   ((char*)(cmsg) - (char*)(mhdr)->msg_control)))
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-struct cmsghdr* __cmsg_nxthdr(struct msghdr*, struct cmsghdr*) __INTRODUCED_IN(21);
+struct cmsghdr* __cmsg_nxthdr(struct msghdr* __msg, struct cmsghdr* __cmsg) __INTRODUCED_IN(21);
 #else
 /* TODO(danalbert): Move this into libandroid_support. */
 static inline struct cmsghdr* __cmsg_nxthdr(struct msghdr* msg, struct cmsghdr* cmsg) {
@@ -299,31 +299,30 @@
 # define __socketcall extern
 #endif
 
-__socketcall int accept(int, struct sockaddr*, socklen_t*);
-__socketcall int accept4(int, struct sockaddr*, socklen_t*, int) __INTRODUCED_IN(21);
-__socketcall int bind(int, const struct sockaddr*, socklen_t);
-__socketcall int connect(int, const struct sockaddr*, socklen_t);
-__socketcall int getpeername(int, struct sockaddr*, socklen_t*);
-__socketcall int getsockname(int, struct sockaddr*, socklen_t*);
-__socketcall int getsockopt(int, int, int, void*, socklen_t*);
-__socketcall int listen(int, int);
-__socketcall int recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*)
+__socketcall int accept(int __fd, struct sockaddr* __addr, socklen_t* __addr_length);
+__socketcall int accept4(int __fd, struct sockaddr* __addr, socklen_t* __addr_length, int __flags) __INTRODUCED_IN(21);
+__socketcall int bind(int __fd, const struct sockaddr* __addr, socklen_t __addr_length);
+__socketcall int connect(int __fd, const struct sockaddr* __addr, socklen_t __addr_length);
+__socketcall int getpeername(int __fd, struct sockaddr* __addr, socklen_t* __addr_length);
+__socketcall int getsockname(int __fd, struct sockaddr* __addr, socklen_t* __addr_length);
+__socketcall int getsockopt(int __fd, int __level, int __option, void* __value, socklen_t* __value_length);
+__socketcall int listen(int __fd, int __backlog);
+__socketcall int recvmmsg(int __fd, struct mmsghdr* __msgs, unsigned int __msg_count, int __flags, const struct timespec* __timeout)
   __INTRODUCED_IN(21);
-__socketcall ssize_t recvmsg(int, struct msghdr*, int);
-__socketcall int sendmmsg(int, const struct mmsghdr*, unsigned int, int) __INTRODUCED_IN(21);
-__socketcall ssize_t sendmsg(int, const struct msghdr*, int);
-__socketcall int setsockopt(int, int, int, const void*, socklen_t);
-__socketcall int shutdown(int, int);
-__socketcall int socket(int, int, int);
-__socketcall int socketpair(int, int, int, int*);
+__socketcall ssize_t recvmsg(int __fd, struct msghdr* __msg, int __flags);
+__socketcall int sendmmsg(int __fd, const struct mmsghdr* __msgs, unsigned int __msg_count, int __flags) __INTRODUCED_IN(21);
+__socketcall ssize_t sendmsg(int __fd, const struct msghdr* __msg, int __flags);
+__socketcall int setsockopt(int __fd, int __level, int __option, const void* __value, socklen_t __value_length);
+__socketcall int shutdown(int __fd, int __how);
+__socketcall int socket(int __af, int __type, int __protocol);
+__socketcall int socketpair(int __af, int __type, int __protocol, int __fds[2]);
 
-ssize_t recv(int, void*, size_t, int) __overloadable __RENAME_CLANG(recv);
-ssize_t send(int, const void*, size_t, int) __overloadable __RENAME_CLANG(send);
+ssize_t recv(int __fd, void* __buf, size_t __n, int __flags) __overloadable __RENAME_CLANG(recv);
+ssize_t send(int __fd, const void* __buf, size_t __n, int __flags) __overloadable __RENAME_CLANG(send);
 
-__socketcall ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t)
+__socketcall ssize_t sendto(int __fd, const void* __buf, size_t __n, int __flags, const struct sockaddr* __dst_addr, socklen_t __dst_addr_length)
         __overloadable __RENAME_CLANG(sendto);
-__socketcall ssize_t recvfrom(int, void*, size_t, int, struct sockaddr*,
-        socklen_t*) __overloadable __RENAME_CLANG(recvfrom);
+__socketcall ssize_t recvfrom(int __fd, void* __buf, size_t __n, int __flags, struct sockaddr* __src_addr, socklen_t* __src_addr_length) __overloadable __RENAME_CLANG(recvfrom);
 
 #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
 #include <bits/fortify/socket.h>
@@ -333,4 +332,4 @@
 
 __END_DECLS
 
-#endif /* _SYS_SOCKET_H */
+#endif
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index b8e3cb1..14b5224 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -151,46 +151,46 @@
 #define S_TYPEISSHM(__sb) 0
 #define S_TYPEISTMO(__sb) 0
 
-int chmod(const char*, mode_t);
-int fchmod(int, mode_t);
-int mkdir(const char*, mode_t);
+int chmod(const char* __path, mode_t __mode);
+int fchmod(int __fd, mode_t __mode);
+int mkdir(const char* __path, mode_t __mode);
 
-int fstat(int, struct stat*);
-int fstat64(int, struct stat64*) __INTRODUCED_IN(21);
-int fstatat(int, const char*, struct stat*, int);
-int fstatat64(int, const char*, struct stat64*, int) __INTRODUCED_IN(21);
-int lstat(const char*, struct stat*);
-int lstat64(const char*, struct stat64*) __INTRODUCED_IN(21);
-int stat(const char*, struct stat*);
-int stat64(const char*, struct stat64*) __INTRODUCED_IN(21);
+int fstat(int __fd, struct stat* __buf);
+int fstat64(int __fd, struct stat64* __buf) __INTRODUCED_IN(21);
+int fstatat(int __dir_fd, const char* __path, struct stat* __buf, int __flags);
+int fstatat64(int __dir_fd, const char* __path, struct stat64* __buf, int __flags) __INTRODUCED_IN(21);
+int lstat(const char* __path, struct stat* __buf);
+int lstat64(const char* __path, struct stat64* __buf) __INTRODUCED_IN(21);
+int stat(const char* __path, struct stat* __buf);
+int stat64(const char* __path, struct stat64* __buf) __INTRODUCED_IN(21);
 
-int mknod(const char*, mode_t, dev_t);
-mode_t umask(mode_t) __overloadable __RENAME_CLANG(umask);
+int mknod(const char* __path, mode_t __mode, dev_t __dev);
+mode_t umask(mode_t __mask) __overloadable __RENAME_CLANG(umask);
 
 #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS)
 #include <bits/fortify/stat.h>
 #endif
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-int mkfifo(const char*, mode_t) __INTRODUCED_IN(21);
+int mkfifo(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
 #else
 // Implemented as a static inline before 21.
 #endif
 
-int mkfifoat(int, const char*, mode_t) __INTRODUCED_IN(23);
+int mkfifoat(int __dir_fd, const char* __path, mode_t __mode) __INTRODUCED_IN(23);
 
-int fchmodat(int, const char*, mode_t, int);
-int mkdirat(int, const char*, mode_t);
-int mknodat(int, const char*, mode_t, dev_t) __INTRODUCED_IN(21);
+int fchmodat(int __dir_fd, const char* __path, mode_t __mode, int __flags);
+int mkdirat(int __dir_fd, const char* __path, mode_t __mode);
+int mknodat(int __dir_fd, const char* __path, mode_t __mode, dev_t __dev) __INTRODUCED_IN(21);
 
 #define UTIME_NOW  ((1L << 30) - 1L)
 #define UTIME_OMIT ((1L << 30) - 2L)
-int utimensat(int fd, const char* path, const struct timespec times[2], int flags)
+int utimensat(int __dir_fd, const char* __path, const struct timespec __times[2], int __flags)
   __INTRODUCED_IN(12);
-int futimens(int fd, const struct timespec times[2]) __INTRODUCED_IN(19);
+int futimens(int __dir_fd, const struct timespec __times[2]) __INTRODUCED_IN(19);
 
 __END_DECLS
 
 #include <android/legacy_sys_stat_inlines.h>
 
-#endif /* _SYS_STAT_H_ */
+#endif
diff --git a/libc/include/sys/statvfs.h b/libc/include/sys/statvfs.h
index 0f421a4..e60cadc 100644
--- a/libc/include/sys/statvfs.h
+++ b/libc/include/sys/statvfs.h
@@ -59,11 +59,11 @@
 #define ST_NODIRATIME  0x0800
 #define ST_RELATIME    0x1000
 
-int statvfs(const char*, struct statvfs*) __INTRODUCED_IN(19);
-int statvfs64(const char*, struct statvfs64*) __INTRODUCED_IN(21);
-int fstatvfs(int, struct statvfs*) __INTRODUCED_IN(19);
-int fstatvfs64(int, struct statvfs64*) __INTRODUCED_IN(21);
+int statvfs(const char* __path, struct statvfs* __buf) __INTRODUCED_IN(19);
+int statvfs64(const char* __path, struct statvfs64* __buf) __INTRODUCED_IN(21);
+int fstatvfs(int __fd, struct statvfs* __buf) __INTRODUCED_IN(19);
+int fstatvfs64(int __fd, struct statvfs64* __buf) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* _SYS_STATVFS_H_ */
+#endif
diff --git a/libc/include/sys/swap.h b/libc/include/sys/swap.h
index e79af97..8a30cce 100644
--- a/libc/include/sys/swap.h
+++ b/libc/include/sys/swap.h
@@ -38,9 +38,9 @@
 #define SWAP_FLAG_PRIO_MASK 0x7fff
 #define SWAP_FLAG_PRIO_SHIFT 0
 
-int swapon(const char*, int) __INTRODUCED_IN(19);
-int swapoff(const char*) __INTRODUCED_IN(19);
+int swapon(const char* __path,  int __flags) __INTRODUCED_IN(19);
+int swapoff(const char* __path) __INTRODUCED_IN(19);
 
 __END_DECLS
 
-#endif /* _SYS_SWAP_H_ */
+#endif
diff --git a/libc/include/sys/sysinfo.h b/libc/include/sys/sysinfo.h
index 9a10d64..6da02ee 100644
--- a/libc/include/sys/sysinfo.h
+++ b/libc/include/sys/sysinfo.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _SYS_SYSINFO_H_
 #define _SYS_SYSINFO_H_
 
@@ -33,16 +34,12 @@
 
 __BEGIN_DECLS
 
-int sysinfo(struct sysinfo* info);
-
+int sysinfo(struct sysinfo* __info);
 int get_nprocs_conf(void) __INTRODUCED_IN(23);
-
 int get_nprocs(void) __INTRODUCED_IN(23);
-
 long get_phys_pages(void) __INTRODUCED_IN(23);
-
 long get_avphys_pages(void) __INTRODUCED_IN(23);
 
 __END_DECLS
 
-#endif /* _SYS_SYSINFO_H_ */
+#endif
diff --git a/libc/include/sys/system_properties.h b/libc/include/sys/system_properties.h
index d075859..f469599 100644
--- a/libc/include/sys/system_properties.h
+++ b/libc/include/sys/system_properties.h
@@ -41,9 +41,9 @@
 #define PROP_VALUE_MAX  92
 
 /*
- * Sets system property `key` to `value`, creating the system property if it doesn't already exist.
+ * Sets system property `name` to `value`, creating the system property if it doesn't already exist.
  */
-int __system_property_set(const char* key, const char* value) __INTRODUCED_IN(12);
+int __system_property_set(const char* __name, const char* __value) __INTRODUCED_IN(12);
 
 /*
  * Returns a `prop_info` corresponding system property `name`, or nullptr if it doesn't exist.
@@ -51,14 +51,14 @@
  *
  * Property lookup is expensive, so it can be useful to cache the result of this function.
  */
-const prop_info* __system_property_find(const char* name);
+const prop_info* __system_property_find(const char* __name);
 
 /*
  * Calls `callback` with a consistent trio of name, value, and serial number for property `pi`.
  */
-void __system_property_read_callback(const prop_info *pi,
-    void (*callback)(void* cookie, const char *name, const char *value, uint32_t serial),
-    void* cookie) __INTRODUCED_IN(26);
+void __system_property_read_callback(const prop_info* __pi,
+    void (*__callback)(void* __cookie, const char* __name, const char* __value, uint32_t __serial),
+    void* __cookie) __INTRODUCED_IN(26);
 
 /*
  * Passes a `prop_info` for each system property to the provided
@@ -66,7 +66,7 @@
  *
  * This method is for inspecting and debugging the property system, and not generally useful.
  */
-int __system_property_foreach(void (*propfn)(const prop_info* pi, void* cookie), void* cookie)
+int __system_property_foreach(void (*__callback)(const prop_info* __pi, void* __cookie), void* __cookie)
   __INTRODUCED_IN(19);
 
 /*
@@ -82,20 +82,17 @@
  * timed out.
  */
 struct timespec;
-bool __system_property_wait(const prop_info* pi,
-                            uint32_t old_serial,
-                            uint32_t* new_serial_ptr,
-                            const struct timespec* relative_timeout)
+bool __system_property_wait(const prop_info* __pi, uint32_t __old_serial, uint32_t* __new_serial_ptr, const struct timespec* __relative_timeout)
     __INTRODUCED_IN(26);
 
 /* Deprecated. In Android O and above, there's no limit on property name length. */
 #define PROP_NAME_MAX   32
 /* Deprecated. Use __system_property_read_callback instead. */
-int __system_property_read(const prop_info* pi, char* name, char* value);
+int __system_property_read(const prop_info* __pi, char* __name, char* __value);
 /* Deprecated. Use __system_property_read_callback instead. */
-int __system_property_get(const char* name, char* value);
+int __system_property_get(const char* __name, char* __value);
 /* Deprecated. Use __system_property_foreach instead. */
-const prop_info* __system_property_find_nth(unsigned n);
+const prop_info* __system_property_find_nth(unsigned __n);
 
 __END_DECLS
 
diff --git a/libc/include/sys/time.h b/libc/include/sys/time.h
index 4d477e1..45190c3 100644
--- a/libc/include/sys/time.h
+++ b/libc/include/sys/time.h
@@ -38,21 +38,21 @@
 
 __BEGIN_DECLS
 
-int gettimeofday(struct timeval*, struct timezone*);
-int settimeofday(const struct timeval*, const struct timezone*);
+int gettimeofday(struct timeval* __tv, struct timezone* __tz);
+int settimeofday(const struct timeval* __tv, const struct timezone* __tz);
 
-int getitimer(int, struct itimerval*);
-int setitimer(int, const struct itimerval*, struct itimerval*);
+int getitimer(int __which, struct itimerval* __current_value);
+int setitimer(int __which, const struct itimerval* __new_value, struct itimerval* __old_value);
 
-int utimes(const char*, const struct timeval*);
+int utimes(const char* __path, const struct timeval __times[2]);
 
 #if defined(__USE_BSD)
-int futimes(int, const struct timeval[2]) __INTRODUCED_IN(26);
-int lutimes(const char*, const struct timeval[2]) __INTRODUCED_IN(26);
+int futimes(int __fd, const struct timeval __times[2]) __INTRODUCED_IN(26);
+int lutimes(const char* __path, const struct timeval __times[2]) __INTRODUCED_IN(26);
 #endif
 
 #if defined(__USE_GNU)
-int futimesat(int, const char*, const struct timeval[2]) __INTRODUCED_IN(26);
+int futimesat(int __dir_fd, const char* __path, const struct timeval __times[2]) __INTRODUCED_IN(26);
 #endif
 
 #define timerclear(a)   \
@@ -97,4 +97,4 @@
 
 __END_DECLS
 
-#endif /* _SYS_TIME_H_ */
+#endif
diff --git a/libc/include/sys/timerfd.h b/libc/include/sys/timerfd.h
index a500060..7bf675b 100644
--- a/libc/include/sys/timerfd.h
+++ b/libc/include/sys/timerfd.h
@@ -42,10 +42,10 @@
 #define TFD_CLOEXEC O_CLOEXEC
 #define TFD_NONBLOCK O_NONBLOCK
 
-int timerfd_create(clockid_t, int) __INTRODUCED_IN(19);
-int timerfd_settime(int, int, const struct itimerspec*, struct itimerspec*) __INTRODUCED_IN(19);
-int timerfd_gettime(int, struct itimerspec*) __INTRODUCED_IN(19);
+int timerfd_create(clockid_t __clock, int __flags) __INTRODUCED_IN(19);
+int timerfd_settime(int __fd, int __flags, const struct itimerspec* __new_value, struct itimerspec* __old_value) __INTRODUCED_IN(19);
+int timerfd_gettime(int __fd, struct itimerspec* __current_value) __INTRODUCED_IN(19);
 
 __END_DECLS
 
-#endif /* _SYS_TIMERFD_H */
+#endif
diff --git a/libc/include/sys/times.h b/libc/include/sys/times.h
index f52db1f..3c8a4ef 100644
--- a/libc/include/sys/times.h
+++ b/libc/include/sys/times.h
@@ -35,8 +35,8 @@
 
 __BEGIN_DECLS
 
-clock_t times(struct tms*);
+clock_t times(struct tms* __buf);
 
 __END_DECLS
 
-#endif /* _SYS_TIMES_H_ */
+#endif
diff --git a/libc/include/sys/timex.h b/libc/include/sys/timex.h
index f704ce8..74c8611 100644
--- a/libc/include/sys/timex.h
+++ b/libc/include/sys/timex.h
@@ -35,9 +35,9 @@
 
 __BEGIN_DECLS
 
-int adjtimex(struct timex*) __INTRODUCED_IN(24);
-int clock_adjtime(clockid_t, struct timex*) __INTRODUCED_IN(24);
+int adjtimex(struct timex* __buf) __INTRODUCED_IN(24);
+int clock_adjtime(clockid_t __clock, struct timex* __tx) __INTRODUCED_IN(24);
 
 __END_DECLS
 
-#endif /* _SYS_TIMEX_H_ */
+#endif
diff --git a/libc/include/sys/uio.h b/libc/include/sys/uio.h
index b166277..37961e3 100644
--- a/libc/include/sys/uio.h
+++ b/libc/include/sys/uio.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _SYS_UIO_H_
 #define _SYS_UIO_H_
 
@@ -34,23 +35,21 @@
 
 __BEGIN_DECLS
 
-ssize_t readv(int, const struct iovec*, int);
-ssize_t writev(int, const struct iovec*, int);
+ssize_t readv(int __fd, const struct iovec* __iov, int __count);
+ssize_t writev(int __fd, const struct iovec* __iov, int __count);
 
 #if defined(__USE_GNU)
-ssize_t preadv(int, const struct iovec*, int, off_t) __RENAME_IF_FILE_OFFSET64(preadv64) __INTRODUCED_IN(24);
-ssize_t pwritev(int, const struct iovec*, int, off_t) __RENAME_IF_FILE_OFFSET64(pwritev64) __INTRODUCED_IN(24);
-ssize_t preadv64(int, const struct iovec*, int, off64_t) __INTRODUCED_IN(24);
-ssize_t pwritev64(int, const struct iovec*, int, off64_t) __INTRODUCED_IN(24);
+ssize_t preadv(int __fd, const struct iovec* __iov, int __count, off_t __offset) __RENAME_IF_FILE_OFFSET64(preadv64) __INTRODUCED_IN(24);
+ssize_t pwritev(int __fd, const struct iovec* __iov, int __count, off_t __offset) __RENAME_IF_FILE_OFFSET64(pwritev64) __INTRODUCED_IN(24);
+ssize_t preadv64(int __fd, const struct iovec* __iov, int __count, off64_t __offset) __INTRODUCED_IN(24);
+ssize_t pwritev64(int __fd, const struct iovec* __iov, int __count, off64_t __offset) __INTRODUCED_IN(24);
 #endif
 
 #if defined(__USE_GNU)
-ssize_t process_vm_readv(pid_t, const struct iovec*, unsigned long, const struct iovec*,
-                         unsigned long, unsigned long) __INTRODUCED_IN(23);
-ssize_t process_vm_writev(pid_t, const struct iovec*, unsigned long, const struct iovec*,
-                          unsigned long, unsigned long) __INTRODUCED_IN(23);
+ssize_t process_vm_readv(pid_t __pid, const struct iovec* __local_iov, unsigned long __local_iov_count, const struct iovec* __remote_iov, unsigned long __remote_iov_count, unsigned long __flags) __INTRODUCED_IN(23);
+ssize_t process_vm_writev(pid_t __pid, const struct iovec* __local_iov, unsigned long __local_iov_count, const struct iovec* __remote_iov, unsigned long __remote_iov_count, unsigned long __flags) __INTRODUCED_IN(23);
 #endif
 
 __END_DECLS
 
-#endif /* _SYS_UIO_H_ */
+#endif
diff --git a/libc/include/sys/utsname.h b/libc/include/sys/utsname.h
index b3856a7..2420fb4 100644
--- a/libc/include/sys/utsname.h
+++ b/libc/include/sys/utsname.h
@@ -36,16 +36,16 @@
 #define SYS_NMLN 65
 
 struct utsname {
-    char  sysname   [SYS_NMLN];
-    char  nodename  [SYS_NMLN];
-    char  release   [SYS_NMLN];
-    char  version   [SYS_NMLN];
-    char  machine   [SYS_NMLN];
-    char  domainname[SYS_NMLN];
+  char sysname[SYS_NMLN];
+  char nodename[SYS_NMLN];
+  char release[SYS_NMLN];
+  char version[SYS_NMLN];
+  char machine[SYS_NMLN];
+  char domainname[SYS_NMLN];
 };
 
-int uname(struct utsname*);
+int uname(struct utsname* __buf);
 
 __END_DECLS
 
-#endif /* _SYS_UTSNAME_H_ */
+#endif
diff --git a/libc/include/sys/vfs.h b/libc/include/sys/vfs.h
index 3078683..9237ee6 100644
--- a/libc/include/sys/vfs.h
+++ b/libc/include/sys/vfs.h
@@ -137,11 +137,11 @@
 #define XENIX_SUPER_MAGIC     0x012FF7B4
 #define XFS_SUPER_MAGIC       0x58465342
 
-int statfs(const char*, struct statfs*);
-int statfs64(const char*, struct statfs64*) __INTRODUCED_IN(21);
-int fstatfs(int, struct statfs*);
-int fstatfs64(int, struct statfs64*) __INTRODUCED_IN(21);
+int statfs(const char* __path, struct statfs* __buf);
+int statfs64(const char* __path, struct statfs64* __buf) __INTRODUCED_IN(21);
+int fstatfs(int __fd, struct statfs* __buf);
+int fstatfs64(int __fd, struct statfs64* __buf) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* _SYS_VFS_H_ */
+#endif
diff --git a/libc/include/sys/wait.h b/libc/include/sys/wait.h
index 0247b2b..e259e31 100644
--- a/libc/include/sys/wait.h
+++ b/libc/include/sys/wait.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _SYS_WAIT_H_
 #define _SYS_WAIT_H_
 
@@ -49,10 +50,10 @@
 #define W_EXITCODE(ret, sig)    ((ret) << 8 | (sig))
 #define W_STOPCODE(sig)         ((sig) << 8 | 0x7f)
 
-pid_t wait(int*);
-pid_t waitpid(pid_t, int*, int);
+pid_t wait(int* __status);
+pid_t waitpid(pid_t __pid, int* __status, int __options);
 #if __ANDROID_API__ >= __ANDROID_API_J_MR2__
-pid_t wait4(pid_t, int*, int, struct rusage*) __INTRODUCED_IN(18);
+pid_t wait4(pid_t __pid, int* __status, int __options, struct rusage* __rusage) __INTRODUCED_IN(18);
 #else
 // Implemented as a static inline before 18.
 #endif
@@ -63,10 +64,10 @@
  */
 typedef int idtype_t;
 
-int waitid(idtype_t which, id_t id, siginfo_t* info, int options);
+int waitid(idtype_t __type, id_t __id, siginfo_t* __info, int __options);
 
 __END_DECLS
 
 #include <android/legacy_sys_wait_inlines.h>
 
-#endif /* _SYS_WAIT_H_ */
+#endif
diff --git a/libc/include/sys/xattr.h b/libc/include/sys/xattr.h
index 37e352d..d15b3fc 100644
--- a/libc/include/sys/xattr.h
+++ b/libc/include/sys/xattr.h
@@ -35,25 +35,25 @@
 
 __BEGIN_DECLS
 
-int fsetxattr(int fd, const char* name, const void* value, size_t size, int flags)
+int fsetxattr(int __fd, const char* __name, const void* __value, size_t __size, int __flags)
   __INTRODUCED_IN(16);
-int setxattr(const char* path, const char* name, const void* value, size_t size, int flags)
+int setxattr(const char* __path, const char* __name, const void* __value, size_t __size, int __flags)
   __INTRODUCED_IN(16);
-int lsetxattr(const char* path, const char* name, const void* value, size_t size, int flags)
+int lsetxattr(const char* __path, const char* __name, const void* __value, size_t __size, int __flags)
   __INTRODUCED_IN(16);
 
-ssize_t fgetxattr(int fd, const char* name, void* value, size_t size) __INTRODUCED_IN(16);
-ssize_t getxattr(const char* path, const char* name, void* value, size_t size) __INTRODUCED_IN(16);
-ssize_t lgetxattr(const char* path, const char* name, void* value, size_t size) __INTRODUCED_IN(16);
+ssize_t fgetxattr(int __fd, const char* __name, void* __value, size_t __size) __INTRODUCED_IN(16);
+ssize_t getxattr(const char* __path, const char* __name, void* __value, size_t __size) __INTRODUCED_IN(16);
+ssize_t lgetxattr(const char* __path, const char* __name, void* __value, size_t __size) __INTRODUCED_IN(16);
 
-ssize_t listxattr(const char* path, char* list, size_t size) __INTRODUCED_IN(16);
-ssize_t llistxattr(const char* path, char* list, size_t size) __INTRODUCED_IN(16);
-ssize_t flistxattr(int fd, char* list, size_t size) __INTRODUCED_IN(16);
+ssize_t listxattr(const char* __path, char* __list, size_t __size) __INTRODUCED_IN(16);
+ssize_t llistxattr(const char* __path, char* __list, size_t __size) __INTRODUCED_IN(16);
+ssize_t flistxattr(int __fd, char* __list, size_t __size) __INTRODUCED_IN(16);
 
-int removexattr(const char* path, const char* name) __INTRODUCED_IN(16);
-int lremovexattr(const char* path, const char* name) __INTRODUCED_IN(16);
-int fremovexattr(int fd, const char* name) __INTRODUCED_IN(16);
+int removexattr(const char* __path, const char* __name) __INTRODUCED_IN(16);
+int lremovexattr(const char* __path, const char* __name) __INTRODUCED_IN(16);
+int fremovexattr(int __fd, const char* __name) __INTRODUCED_IN(16);
 
 __END_DECLS
 
-#endif /* _SYS_XATTR_H_ */
+#endif
diff --git a/libc/include/termios.h b/libc/include/termios.h
index 66ae71c..3eaab00 100644
--- a/libc/include/termios.h
+++ b/libc/include/termios.h
@@ -37,23 +37,23 @@
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
 // Implemented as static inlines before 21.
-speed_t cfgetispeed(const struct termios*) __INTRODUCED_IN(21);
-speed_t cfgetospeed(const struct termios*) __INTRODUCED_IN(21);
-void cfmakeraw(struct termios*) __INTRODUCED_IN(21);
-int cfsetspeed(struct termios*, speed_t) __INTRODUCED_IN(21);
-int cfsetispeed(struct termios*, speed_t) __INTRODUCED_IN(21);
-int cfsetospeed(struct termios*, speed_t) __INTRODUCED_IN(21);
-int tcdrain(int) __INTRODUCED_IN(21);
-int tcflow(int, int) __INTRODUCED_IN(21);
-int tcflush(int, int) __INTRODUCED_IN(21);
-int tcgetattr(int, struct termios*) __INTRODUCED_IN(21);
-pid_t tcgetsid(int) __INTRODUCED_IN(21);
-int tcsendbreak(int, int) __INTRODUCED_IN(21);
-int tcsetattr(int, int, const struct termios*) __INTRODUCED_IN(21);
+speed_t cfgetispeed(const struct termios* __t) __INTRODUCED_IN(21);
+speed_t cfgetospeed(const struct termios* __t) __INTRODUCED_IN(21);
+void cfmakeraw(struct termios* __t) __INTRODUCED_IN(21);
+int cfsetspeed(struct termios* __t, speed_t __speed) __INTRODUCED_IN(21);
+int cfsetispeed(struct termios* __t, speed_t __speed) __INTRODUCED_IN(21);
+int cfsetospeed(struct termios* __t, speed_t __speed) __INTRODUCED_IN(21);
+int tcdrain(int __fd) __INTRODUCED_IN(21);
+int tcflow(int __fd, int __action) __INTRODUCED_IN(21);
+int tcflush(int __fd, int __queue) __INTRODUCED_IN(21);
+int tcgetattr(int __fd, struct termios* __t) __INTRODUCED_IN(21);
+pid_t tcgetsid(int __fd) __INTRODUCED_IN(21);
+int tcsendbreak(int __fd, int __duration) __INTRODUCED_IN(21);
+int tcsetattr(int __fd, int __optional_actions, const struct termios* __t) __INTRODUCED_IN(21);
 #endif
 
 __END_DECLS
 
 #include <android/legacy_termios_inlines.h>
 
-#endif /* _TERMIOS_H_ */
+#endif
diff --git a/libc/include/time.h b/libc/include/time.h
index 9fde77e..8e78949 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -59,54 +59,54 @@
 
 #define TM_ZONE tm_zone
 
-time_t time(time_t*);
-int nanosleep(const struct timespec*, struct timespec*);
+time_t time(time_t* __t);
+int nanosleep(const struct timespec* __request, struct timespec* __remainder);
 
-char* asctime(const struct tm*);
-char* asctime_r(const struct tm*, char*);
+char* asctime(const struct tm* __tm);
+char* asctime_r(const struct tm* __tm, char* __buf);
 
-double difftime(time_t, time_t);
-time_t mktime(struct tm*);
+double difftime(time_t __lhs, time_t __rhs);
+time_t mktime(struct tm* __tm);
 
-struct tm* localtime(const time_t*);
-struct tm* localtime_r(const time_t*, struct tm*);
+struct tm* localtime(const time_t* __t);
+struct tm* localtime_r(const time_t* __t, struct tm* __tm);
 
-struct tm* gmtime(const time_t*);
-struct tm* gmtime_r(const time_t*, struct tm*);
+struct tm* gmtime(const time_t* __t);
+struct tm* gmtime_r(const time_t* __t, struct tm* __tm);
 
-char* strptime(const char*, const char*, struct tm*);
-size_t strftime(char*, size_t, const char*, const struct tm*);
+char* strptime(const char* __s, const char* __fmt, struct tm* __tm);
+size_t strftime(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm);
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-size_t strftime_l(char*, size_t, const char*, const struct tm*, locale_t) __INTRODUCED_IN(21);
+size_t strftime_l(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm, locale_t __l) __INTRODUCED_IN(21);
 #else
 // Implemented as static inline before 21.
 #endif
 
-char* ctime(const time_t*);
-char* ctime_r(const time_t*, char*);
+char* ctime(const time_t* __t);
+char* ctime_r(const time_t* __t, char* __buf);
 
 void tzset(void);
 
 clock_t clock(void);
 
-int clock_getcpuclockid(pid_t, clockid_t*) __INTRODUCED_IN(23);
+int clock_getcpuclockid(pid_t __pid, clockid_t* __clock) __INTRODUCED_IN(23);
 
-int clock_getres(clockid_t, struct timespec*);
-int clock_gettime(clockid_t, struct timespec*);
-int clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*);
-int clock_settime(clockid_t, const struct timespec*);
+int clock_getres(clockid_t __clock, struct timespec* __resolution);
+int clock_gettime(clockid_t __clock, struct timespec* __ts);
+int clock_nanosleep(clockid_t __clock, int __flags, const struct timespec* __request, struct timespec* __remainder);
+int clock_settime(clockid_t __clock, const struct timespec* __ts);
 
-int timer_create(int, struct sigevent*, timer_t*);
-int timer_delete(timer_t);
-int timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*);
-int timer_gettime(timer_t, struct itimerspec*);
-int timer_getoverrun(timer_t);
+int timer_create(clockid_t __clock, struct sigevent* __event, timer_t* __timer_ptr);
+int timer_delete(timer_t __timer);
+int timer_settime(timer_t __timer, int __flags, const struct itimerspec* __new_value, struct itimerspec* __old_value);
+int timer_gettime(timer_t __timer, struct itimerspec* __ts);
+int timer_getoverrun(timer_t __timer);
 
 /* Non-standard extensions that are in the BSDs and glibc. */
-time_t timelocal(struct tm*) __INTRODUCED_IN(12);
-time_t timegm(struct tm*) __INTRODUCED_IN(12);
+time_t timelocal(struct tm* __tm) __INTRODUCED_IN(12);
+time_t timegm(struct tm* __tm) __INTRODUCED_IN(12);
 
 __END_DECLS
 
-#endif /* _TIME_H_ */
+#endif
diff --git a/libc/include/uchar.h b/libc/include/uchar.h
index ac0cf1d..e59d6a9 100644
--- a/libc/include/uchar.h
+++ b/libc/include/uchar.h
@@ -43,11 +43,11 @@
 #define __STD_UTF_16__ 1
 #define __STD_UTF_32__ 1
 
-size_t c16rtomb(char*, char16_t, mbstate_t*) __INTRODUCED_IN(21);
-size_t c32rtomb(char*, char32_t, mbstate_t*) __INTRODUCED_IN(21);
-size_t mbrtoc16(char16_t*, const char*, size_t, mbstate_t*) __INTRODUCED_IN(21);
-size_t mbrtoc32(char32_t*, const char*, size_t, mbstate_t*) __INTRODUCED_IN(21);
+size_t c16rtomb(char* __buf, char16_t __ch16, mbstate_t* __ps) __INTRODUCED_IN(21);
+size_t c32rtomb(char* __buf, char32_t __ch32, mbstate_t* __ps) __INTRODUCED_IN(21);
+size_t mbrtoc16(char16_t* __ch16, const char* __s, size_t __n, mbstate_t* __ps) __INTRODUCED_IN(21);
+size_t mbrtoc32(char32_t* __ch32, const char* __s, size_t __n, mbstate_t* __ps) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* _UCHAR_H_ */
+#endif
diff --git a/libc/include/utime.h b/libc/include/utime.h
index 9783859..be6b894 100644
--- a/libc/include/utime.h
+++ b/libc/include/utime.h
@@ -35,8 +35,8 @@
 
 __BEGIN_DECLS
 
-int utime(const char*, const struct utimbuf*);
+int utime(const char* __filename, const struct utimbuf* __times);
 
 __END_DECLS
 
-#endif /* _UTIME_H_ */
+#endif
diff --git a/libc/include/wchar.h b/libc/include/wchar.h
index 4494cb0..1dda4bd 100644
--- a/libc/include/wchar.h
+++ b/libc/include/wchar.h
@@ -25,6 +25,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #ifndef _WCHAR_H_
 #define _WCHAR_H_
 
@@ -42,98 +43,98 @@
 
 __BEGIN_DECLS
 
-wint_t            btowc(int);
-int               fwprintf(FILE *, const wchar_t *, ...);
-int               fwscanf(FILE *, const wchar_t *, ...);
-wint_t            fgetwc(FILE *);
-wchar_t          *fgetws(wchar_t *, int, FILE *);
-wint_t            fputwc(wchar_t, FILE *);
-int               fputws(const wchar_t *, FILE *);
-int               fwide(FILE *, int);
-wint_t            getwc(FILE *);
-wint_t            getwchar(void);
-int               mbsinit(const mbstate_t *);
-size_t            mbrlen(const char *, size_t, mbstate_t *);
-size_t            mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
-size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*);
-size_t mbsnrtowcs(wchar_t*, const char**, size_t, size_t, mbstate_t*) __INTRODUCED_IN(21);
-wint_t            putwc(wchar_t, FILE *);
-wint_t            putwchar(wchar_t);
-int               swprintf(wchar_t *, size_t, const wchar_t *, ...);
-int               swscanf(const wchar_t *, const wchar_t *, ...);
-wint_t            ungetwc(wint_t, FILE *);
-int vfwprintf(FILE*, const wchar_t*, va_list);
-int vfwscanf(FILE*, const wchar_t*, va_list) __INTRODUCED_IN(21);
-int vswprintf(wchar_t*, size_t, const wchar_t*, va_list);
-int vswscanf(const wchar_t*, const wchar_t*, va_list) __INTRODUCED_IN(21);
-int vwprintf(const wchar_t*, va_list);
-int vwscanf(const wchar_t*, va_list) __INTRODUCED_IN(21);
-wchar_t* wcpcpy (wchar_t*, const wchar_t *);
-wchar_t* wcpncpy (wchar_t*, const wchar_t *, size_t);
-size_t            wcrtomb(char *, wchar_t, mbstate_t *);
-int               wcscasecmp(const wchar_t *, const wchar_t *);
-int wcscasecmp_l(const wchar_t*, const wchar_t*, locale_t) __INTRODUCED_IN(23);
-wchar_t          *wcscat(wchar_t *, const wchar_t *);
-wchar_t          *wcschr(const wchar_t *, wchar_t);
-int               wcscmp(const wchar_t *, const wchar_t *);
-int               wcscoll(const wchar_t *, const wchar_t *);
-wchar_t          *wcscpy(wchar_t *, const wchar_t *);
-size_t            wcscspn(const wchar_t *, const wchar_t *);
-size_t            wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
-size_t            wcslen(const wchar_t *);
-int               wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
-int wcsncasecmp_l(const wchar_t*, const wchar_t*, size_t, locale_t) __INTRODUCED_IN(23);
-wchar_t          *wcsncat(wchar_t *, const wchar_t *, size_t);
-int               wcsncmp(const wchar_t *, const wchar_t *, size_t);
-wchar_t          *wcsncpy(wchar_t *, const wchar_t *, size_t);
-size_t wcsnrtombs(char*, const wchar_t**, size_t, size_t, mbstate_t*) __INTRODUCED_IN(21);
-wchar_t          *wcspbrk(const wchar_t *, const wchar_t *);
-wchar_t          *wcsrchr(const wchar_t *, wchar_t);
-size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*);
-size_t            wcsspn(const wchar_t *, const wchar_t *);
-wchar_t          *wcsstr(const wchar_t *, const wchar_t *);
-double wcstod(const wchar_t*, wchar_t**);
-float wcstof(const wchar_t*, wchar_t**) __INTRODUCED_IN(21);
-wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**);
-long wcstol(const wchar_t*, wchar_t**, int);
-long long wcstoll(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21);
-long double wcstold(const wchar_t*, wchar_t**) __INTRODUCED_IN(21);
-unsigned long wcstoul(const wchar_t*, wchar_t**, int);
-unsigned long long wcstoull(const wchar_t*, wchar_t**, int) __INTRODUCED_IN(21);
-int               wcswidth(const wchar_t *, size_t);
-size_t            wcsxfrm(wchar_t *, const wchar_t *, size_t);
-int               wctob(wint_t);
-int               wcwidth(wchar_t);
-wchar_t          *wmemchr(const wchar_t *, wchar_t, size_t);
-int               wmemcmp(const wchar_t *, const wchar_t *, size_t);
-wchar_t          *wmemcpy(wchar_t *, const wchar_t *, size_t);
+wint_t btowc(int __ch);
+int fwprintf(FILE* __fp, const wchar_t* __fmt, ...);
+int fwscanf(FILE* __fp, const wchar_t* __fmt, ...);
+wint_t fgetwc(FILE* __fp);
+wchar_t* fgetws(wchar_t* __buf, int __size, FILE* __fp);
+wint_t fputwc(wchar_t __wc, FILE* __fp);
+int fputws(const wchar_t* __s, FILE* __fp);
+int fwide(FILE* __fp, int __mode);
+wint_t getwc(FILE* __fp);
+wint_t getwchar(void);
+int mbsinit(const mbstate_t* __ps);
+size_t mbrlen(const char* __s, size_t __n, mbstate_t* __ps);
+size_t mbrtowc(wchar_t* __buf, const char* __s, size_t __n, mbstate_t* __ps);
+size_t mbsrtowcs(wchar_t* __dst, const char** __src, size_t __dst_n, mbstate_t* __ps);
+size_t mbsnrtowcs(wchar_t* __dst, const char** __src, size_t __src_n, size_t __dst_n, mbstate_t* __ps) __INTRODUCED_IN(21);
+wint_t putwc(wchar_t __wc, FILE* __fp);
+wint_t putwchar(wchar_t __wc);
+int swprintf(wchar_t* __buf, size_t __n, const wchar_t* __fmt, ...);
+int swscanf(const wchar_t* __s, const wchar_t* __fmt, ...);
+wint_t ungetwc(wint_t __wc, FILE* __fp);
+int vfwprintf(FILE* __fp, const wchar_t* __fmt, va_list __args);
+int vfwscanf(FILE* __fp, const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
+int vswprintf(wchar_t* __buf, size_t __n, const wchar_t* __fmt, va_list __args);
+int vswscanf(const wchar_t* __s, const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
+int vwprintf(const wchar_t* __fmt, va_list __args);
+int vwscanf(const wchar_t* __fmt, va_list __args) __INTRODUCED_IN(21);
+wchar_t* wcpcpy(wchar_t* __dst, const wchar_t* __src);
+wchar_t* wcpncpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
+size_t wcrtomb(char* __buf, wchar_t __wc, mbstate_t* __ps);
+int wcscasecmp(const wchar_t* __lhs, const wchar_t* __rhs);
+int wcscasecmp_l(const wchar_t* __lhs, const wchar_t* __rhs, locale_t __l) __INTRODUCED_IN(23);
+wchar_t* wcscat(wchar_t* __dst, const wchar_t* __src);
+wchar_t* wcschr(const wchar_t* __s, wchar_t __wc);
+int wcscmp(const wchar_t* __lhs, const wchar_t* __rhs);
+int wcscoll(const wchar_t* __lhs, const wchar_t* __rhs);
+wchar_t* wcscpy(wchar_t* __dst, const wchar_t* __src);
+size_t wcscspn(const wchar_t* __s, const wchar_t* __accept);
+size_t wcsftime(wchar_t* __buf, size_t __n, const wchar_t* __fmt, const struct tm* __tm);
+size_t wcslen(const wchar_t* __s);
+int wcsncasecmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
+int wcsncasecmp_l(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n, locale_t __l) __INTRODUCED_IN(23);
+wchar_t* wcsncat(wchar_t* __dst, const wchar_t* __src, size_t __n);
+int wcsncmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
+wchar_t* wcsncpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
+size_t wcsnrtombs(char* __dst, const wchar_t** __src, size_t __src_n, size_t __dst_n, mbstate_t* __ps) __INTRODUCED_IN(21);
+wchar_t* wcspbrk(const wchar_t* __s, const wchar_t* __accept);
+wchar_t* wcsrchr(const wchar_t* __s, wchar_t __wc);
+size_t wcsrtombs(char* __dst, const wchar_t** __src, size_t __dst_n, mbstate_t* __ps);
+size_t wcsspn(const wchar_t* __s, const wchar_t* __accept);
+wchar_t* wcsstr(const wchar_t* __haystack, const wchar_t* __needle);
+double wcstod(const wchar_t* __s, wchar_t** __end_ptr);
+float wcstof(const wchar_t* __s, wchar_t** __end_ptr) __INTRODUCED_IN(21);
+wchar_t* wcstok(wchar_t* __s, const wchar_t* __delimiter, wchar_t** __ptr);
+long wcstol(const wchar_t* __s, wchar_t** __end_ptr, int __base);
+long long wcstoll(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
+long double wcstold(const wchar_t* __s, wchar_t** __end_ptr) __INTRODUCED_IN(21);
+unsigned long wcstoul(const wchar_t* __s, wchar_t** __end_ptr, int __base);
+unsigned long long wcstoull(const wchar_t* __s, wchar_t** __end_ptr, int __base) __INTRODUCED_IN(21);
+int wcswidth(const wchar_t* __s, size_t __n);
+size_t wcsxfrm(wchar_t* __dst, const wchar_t* __src, size_t __n);
+int wctob(wint_t __wc);
+int wcwidth(wchar_t __wc);
+wchar_t* wmemchr(const wchar_t* __src, wchar_t __wc, size_t __n);
+int wmemcmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __n);
+wchar_t* wmemcpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
 #if defined(__USE_GNU)
-wchar_t* wmempcpy(wchar_t*, const wchar_t*, size_t) __INTRODUCED_IN(23);
+wchar_t* wmempcpy(wchar_t* __dst, const wchar_t* __src, size_t __n) __INTRODUCED_IN(23);
 #endif
-wchar_t          *wmemmove(wchar_t *, const wchar_t *, size_t);
-wchar_t          *wmemset(wchar_t *, wchar_t, size_t);
-int               wprintf(const wchar_t *, ...);
-int               wscanf(const wchar_t *, ...);
+wchar_t* wmemmove(wchar_t* __dst, const wchar_t* __src, size_t __n);
+wchar_t* wmemset(wchar_t* __dst, wchar_t __wc, size_t __n);
+int wprintf(const wchar_t* __fmt, ...);
+int wscanf(const wchar_t* __fmt, ...);
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-long long wcstoll_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21);
-unsigned long long wcstoull_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21);
-long double wcstold_l(const wchar_t*, wchar_t**, locale_t) __INTRODUCED_IN(21);
+long long wcstoll_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
+unsigned long long wcstoull_l(const wchar_t* __s, wchar_t** __end_ptr, int __base, locale_t __l) __INTRODUCED_IN(21);
+long double wcstold_l(const wchar_t* __s, wchar_t** __end_ptr, locale_t __l) __INTRODUCED_IN(21);
 
-int wcscoll_l(const wchar_t*, const wchar_t*, locale_t) __attribute_pure__
+int wcscoll_l(const wchar_t* __lhs, const wchar_t* __rhs, locale_t __l) __attribute_pure__
     __INTRODUCED_IN(21);
-size_t wcsxfrm_l(wchar_t*, const wchar_t*, size_t, locale_t) __INTRODUCED_IN(21);
+size_t wcsxfrm_l(wchar_t* __dst, const wchar_t* __src, size_t __n, locale_t __l) __INTRODUCED_IN(21);
 #else
 // Implemented as static inlines before 21.
 #endif
 
-size_t wcslcat(wchar_t*, const wchar_t*, size_t);
-size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
+size_t wcslcat(wchar_t* __dst, const wchar_t* __src, size_t __n);
+size_t wcslcpy(wchar_t* __dst, const wchar_t* __src, size_t __n);
 
-FILE* open_wmemstream(wchar_t**, size_t*) __INTRODUCED_IN(23);
-wchar_t* wcsdup(const wchar_t*);
-size_t wcsnlen(const wchar_t*, size_t);
+FILE* open_wmemstream(wchar_t** __ptr, size_t* __size_ptr) __INTRODUCED_IN(23);
+wchar_t* wcsdup(const wchar_t* __s);
+size_t wcsnlen(const wchar_t* __s, size_t __n);
 
 __END_DECLS
 
-#endif /* _WCHAR_H_ */
+#endif
diff --git a/libc/include/wctype.h b/libc/include/wctype.h
index 39e34f6..18f5c4b 100644
--- a/libc/include/wctype.h
+++ b/libc/include/wctype.h
@@ -36,31 +36,31 @@
 __BEGIN_DECLS
 
 #if __ANDROID_API__ >= __ANDROID_API_L__
-int iswalnum_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswalpha_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswblank_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswcntrl_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswdigit_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswgraph_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswlower_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswprint_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswpunct_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswspace_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswupper_l(wint_t, locale_t) __INTRODUCED_IN(21);
-int iswxdigit_l(wint_t, locale_t) __INTRODUCED_IN(21);
+int iswalnum_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswalpha_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswblank_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswcntrl_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswdigit_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswgraph_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswlower_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswprint_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswpunct_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswspace_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswupper_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+int iswxdigit_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
 
-wint_t towlower_l(wint_t, locale_t) __INTRODUCED_IN(21);
-wint_t towupper_l(wint_t, locale_t) __INTRODUCED_IN(21);
+wint_t towlower_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
+wint_t towupper_l(wint_t __wc, locale_t __l) __INTRODUCED_IN(21);
 #else
 // Implemented as static inlines before 21.
 #endif
 
-wint_t towctrans_l(wint_t, wctrans_t, locale_t) __INTRODUCED_IN(26);
-wctrans_t wctrans_l(const char*, locale_t) __INTRODUCED_IN(26);
+wint_t towctrans_l(wint_t __wc, wctrans_t __transform, locale_t __l) __INTRODUCED_IN(26);
+wctrans_t wctrans_l(const char* __name, locale_t __l) __INTRODUCED_IN(26);
 
-wctype_t wctype_l(const char*, locale_t) __INTRODUCED_IN(21);
-int iswctype_l(wint_t, wctype_t, locale_t) __INTRODUCED_IN(21);
+wctype_t wctype_l(const char* __name, locale_t __l) __INTRODUCED_IN(21);
+int iswctype_l(wint_t __wc, wctype_t __transform, locale_t __l) __INTRODUCED_IN(21);
 
 __END_DECLS
 
-#endif /* _WCTYPE_H_ */
+#endif
diff --git a/libc/malloc_debug/README.md b/libc/malloc_debug/README.md
index b77af6d..03a8a73 100644
--- a/libc/malloc_debug/README.md
+++ b/libc/malloc_debug/README.md
@@ -371,6 +371,9 @@
 
 Examples
 ========
+
+### For platform developers
+
 Enable backtrace tracking of all allocation for all processes:
 
     adb shell stop
@@ -427,17 +430,7 @@
 but, obviously, it must be enabled through the signal before the file will
 contain any data.
 
-To analyze the data produced by the dumpheap command, run this script:
-
-    development/scripts/native_heapdump_viewer.py
-
-In order for the script to properly symbolize the stacks in the file,
-make sure the script is executed from the tree that built the image.
-Below is an example of how to execute the script using the dump created by the
-above command:
-
-    adb shell pull /data/local/tmp/heap.txt .
-    development/scripts/native_heapdump_viewer.py heap.txt > heap_info.txt
+### For app developers
 
 Enable malloc debug for a specific program/application (Android O or later):
 
@@ -453,3 +446,40 @@
 was necessary to truncate the name to fit. On O, property names can be
 an order of magnitude larger, so there should be no need to truncate the name
 at all.
+
+To detect leaks while an app is running:
+
+    adb shell dumpsys meminfo --unreachable <PID_OF_APP>
+
+Without also enabling malloc debug, this command will only tell
+you whether it can detect leaked memory, not where those leaks are
+occurring. If you enable malloc debug with the backtrace option for your
+app before running the dumpsys command, you'll get backtraces showing
+where the memory was allocated.
+
+For backtraces from your app to be useful, you'll want to keep the
+symbols in your app's shared libraries rather than stripping them. That
+way you'll see the location of the leak directly without having to use
+something like the <code>ndk-stack</code> tool.
+
+### Analyzing heap dumps
+
+To analyze the data produced by the dumpheap command, run this script:
+
+    development/scripts/native_heapdump_viewer.py
+
+In order for the script to properly symbolize the stacks in the file,
+make sure the script is executed from the tree that built the image.
+
+To collect, transfer, and analyze a dump:
+
+    adb shell am dumpheap -n <PID_TO_DUMP> /data/local/tmp/heap.txt
+    adb shell pull /data/local/tmp/heap.txt .
+    python development/scripts/native_heapdump_viewer.py --symbols /some/path/to/symbols/ heap.txt > heap_info.txt
+
+At the moment, the script will look for symbols in the given directory,
+using the path the .so file would have on the device. So if your .so file
+is at `/data/app/.../lib/arm/libx.so` on the device, it will need to be at
+`/some/path/to/symbols/data/app/.../lib/arm/libx.so` locally given the
+command line above. That is: you need to mirror the directory structure
+for the app in the symbols directory.
diff --git a/libc/private/CFIShadow.h b/libc/private/CFIShadow.h
index 26351db..1423d86 100644
--- a/libc/private/CFIShadow.h
+++ b/libc/private/CFIShadow.h
@@ -61,10 +61,8 @@
   // Alignment of __cfi_check.
   static constexpr uintptr_t kCfiCheckAlign = 1UL << kCfiCheckGranularity;  // 4K
 
-#if defined(__aarch64__)
-  static constexpr uintptr_t kMaxTargetAddr = 0x7fffffffff;
-#elif defined (__LP64__)
-  static constexpr uintptr_t kMaxTargetAddr = 0x7fffffffffff;
+#if defined (__LP64__)
+  static constexpr uintptr_t kMaxTargetAddr = 0xffffffffffff;
 #else
   static constexpr uintptr_t kMaxTargetAddr = 0xffffffff;
 #endif
diff --git a/libc/private/bionic_futex.h b/libc/private/bionic_futex.h
index 946d9dd..9b89131 100644
--- a/libc/private/bionic_futex.h
+++ b/libc/private/bionic_futex.h
@@ -36,13 +36,10 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-__BEGIN_DECLS
-
 struct timespec;
 
 static inline __always_inline int __futex(volatile void* ftx, int op, int value,
-                                          const struct timespec* timeout,
-                                          int bitset) {
+                                          const timespec* timeout, int bitset) {
   // Our generated syscall assembler sets errno, but our callers (pthread functions) don't want to.
   int saved_errno = errno;
   int result = syscall(__NR_futex, ftx, op, value, timeout, NULL, bitset);
@@ -61,17 +58,16 @@
   return __futex(ftx, shared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE, count, NULL, 0);
 }
 
-static inline int __futex_wait(volatile void* ftx, int value, const struct timespec* timeout) {
+static inline int __futex_wait(volatile void* ftx, int value, const timespec* timeout) {
   return __futex(ftx, FUTEX_WAIT, value, timeout, 0);
 }
 
-static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value,
-                                  bool use_realtime_clock, const struct timespec* abs_timeout) {
-  return __futex(ftx, (shared ? FUTEX_WAIT_BITSET : FUTEX_WAIT_BITSET_PRIVATE) |
-                 (use_realtime_clock ? FUTEX_CLOCK_REALTIME : 0), value, abs_timeout,
+static inline int __futex_wait_ex(volatile void* ftx, bool shared, int value) {
+  return __futex(ftx, (shared ? FUTEX_WAIT_BITSET : FUTEX_WAIT_BITSET_PRIVATE), value, nullptr,
                  FUTEX_BITSET_MATCH_ANY);
 }
 
-__END_DECLS
+__LIBC_HIDDEN__ int __futex_wait_ex(volatile void* ftx, bool shared, int value,
+                                    bool use_realtime_clock, const timespec* abs_timeout);
 
 #endif /* _BIONIC_FUTEX_H */
diff --git a/libc/private/bionic_lock.h b/libc/private/bionic_lock.h
index 3dbafe0..b389247 100644
--- a/libc/private/bionic_lock.h
+++ b/libc/private/bionic_lock.h
@@ -64,7 +64,7 @@
     }
     while (atomic_exchange_explicit(&state, LockedWithWaiter, memory_order_acquire) != Unlocked) {
       // TODO: As the critical section is brief, it is a better choice to spin a few times befor sleeping.
-      __futex_wait_ex(&state, process_shared, LockedWithWaiter, false, nullptr);
+      __futex_wait_ex(&state, process_shared, LockedWithWaiter);
     }
     return;
   }
diff --git a/libc/private/bionic_time_conversions.h b/libc/private/bionic_time_conversions.h
index b9eaad2..fb049f2 100644
--- a/libc/private/bionic_time_conversions.h
+++ b/libc/private/bionic_time_conversions.h
@@ -42,6 +42,9 @@
 
 __LIBC_HIDDEN__ void timeval_from_timespec(timeval& tv, const timespec& ts);
 
+__LIBC_HIDDEN__ void monotonic_time_from_realtime_time(timespec& monotonic_time,
+                                                       const timespec& realtime_time);
+
 __END_DECLS
 
 static inline int check_timespec(const timespec* ts, bool null_allowed) {
diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h
index 45b974a..af5ae29 100644
--- a/libc/upstream-netbsd/android/include/netbsd-compat.h
+++ b/libc/upstream-netbsd/android/include/netbsd-compat.h
@@ -44,4 +44,8 @@
 #include <stddef.h>
 int reallocarr(void*, size_t, size_t);
 
+/* Use appropriate shell depending on process's executable. */
+__LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
+#define _PATH_BSHELL __bionic_get_shell_path()
+
 #endif
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
index baf5057..d831435 100644
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
@@ -71,6 +71,10 @@
  */
 #define _PATH_TMP "/data/local/tmp/"
 
+/* Use appropriate shell depending on process's executable. */
+__LIBC_HIDDEN__ extern const char* __bionic_get_shell_path();
+#define _PATH_BSHELL __bionic_get_shell_path()
+
 /* We have OpenBSD's getentropy_linux.c, but we don't mention getentropy in any header. */
 __LIBC_HIDDEN__ extern int getentropy(void*, size_t);
 
diff --git a/libdl/libdl.arm.map b/libdl/libdl.arm.map
index 292bd97..9fc9d23 100644
--- a/libdl/libdl.arm.map
+++ b/libdl/libdl.arm.map
@@ -36,6 +36,7 @@
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
diff --git a/libdl/libdl.arm64.map b/libdl/libdl.arm64.map
index 2fe2c7b..bde6cab 100644
--- a/libdl/libdl.arm64.map
+++ b/libdl/libdl.arm64.map
@@ -35,6 +35,7 @@
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt
index 408d4dc..d1f4ab8 100644
--- a/libdl/libdl.map.txt
+++ b/libdl/libdl.map.txt
@@ -35,6 +35,7 @@
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
diff --git a/libdl/libdl.mips.map b/libdl/libdl.mips.map
index 2fe2c7b..bde6cab 100644
--- a/libdl/libdl.mips.map
+++ b/libdl/libdl.mips.map
@@ -35,6 +35,7 @@
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
diff --git a/libdl/libdl.mips64.map b/libdl/libdl.mips64.map
index 2fe2c7b..bde6cab 100644
--- a/libdl/libdl.mips64.map
+++ b/libdl/libdl.mips64.map
@@ -35,6 +35,7 @@
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
diff --git a/libdl/libdl.x86.map b/libdl/libdl.x86.map
index 2fe2c7b..bde6cab 100644
--- a/libdl/libdl.x86.map
+++ b/libdl/libdl.x86.map
@@ -35,6 +35,7 @@
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
diff --git a/libdl/libdl.x86_64.map b/libdl/libdl.x86_64.map
index 2fe2c7b..bde6cab 100644
--- a/libdl/libdl.x86_64.map
+++ b/libdl/libdl.x86_64.map
@@ -35,6 +35,7 @@
 
 LIBC_OMR1 { # future
   global:
+    __cfi_shadow_size; # future
     __cfi_slowpath; # future
     __cfi_slowpath_diag; # future
 } LIBC_N;
diff --git a/libdl/libdl_cfi.cpp b/libdl/libdl_cfi.cpp
index 8458564..483364f 100644
--- a/libdl/libdl_cfi.cpp
+++ b/libdl/libdl_cfi.cpp
@@ -38,6 +38,11 @@
   return &shadow_base_storage.v;
 }
 
+// Returns the size of the CFI shadow mapping, or 0 if CFI is not (yet) used in this process.
+extern "C" size_t __cfi_shadow_size() {
+  return shadow_base_storage.v != 0 ? CFIShadow::kShadowSize : 0;
+}
+
 static uint16_t shadow_load(void* p) {
   uintptr_t addr = reinterpret_cast<uintptr_t>(p);
   uintptr_t ofs = CFIShadow::MemToShadowOffset(addr);
diff --git a/linker/linker.cpp b/linker/linker.cpp
index a212624..8aadd14 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3506,6 +3506,9 @@
   g_default_namespace.set_permitted_paths(default_ns_config->permitted_paths());
 
   namespaces[default_ns_config->name()] = &g_default_namespace;
+  if (default_ns_config->visible()) {
+    g_exported_namespaces[default_ns_config->name()] = &g_default_namespace;
+  }
 
   // 2. Initialize other namespaces
 
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index 0a9aeab..2bdde1e 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -371,6 +371,15 @@
                                       bool is_asan,
                                       const Config** config,
                                       std::string* error_msg) {
+  // TODO(b/38114603) Currently, multiple namespaces does not support ASAN mode
+  // where some symbols should be intercepted via LD_PRELOAD; LD_PRELOADed libs
+  // are not being preloaded into the linked namespaces other than the default
+  // namespace. Until we fix the problem, we temporarily disable ld.config.txt
+  // in ASAN mode.
+  if (is_asan) {
+    return false;
+  }
+
   g_config.clear();
 
   std::unordered_map<std::string, PropertyValue> property_map;
diff --git a/linker/tests/linker_config_test.cpp b/linker/tests/linker_config_test.cpp
index c6fade9..87609d0 100644
--- a/linker/tests/linker_config_test.cpp
+++ b/linker/tests/linker_config_test.cpp
@@ -168,6 +168,7 @@
   run_linker_config_smoke_test(false);
 }
 
-TEST(linker_config, asan_smoke) {
-  run_linker_config_smoke_test(true);
-}
+// TODO(b/38114603) revive this test when ld.config.txt is enabled for ASAN mode
+//TEST(linker_config, asan_smoke) {
+//  run_linker_config_smoke_test(true);
+//}
diff --git a/tests/Android.bp b/tests/Android.bp
index 084d393..ea3f39f 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -192,6 +192,26 @@
     },
 }
 
+// If building this fails, then we have both FORTIFY and ASAN enabled, which
+// isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN
+// enabled, but that's not a reality today.) This is meant to be otherwise
+// unused.
+cc_test_library {
+    name: "fortify_disabled_for_asan",
+    cflags: [
+        "-Werror",
+        "-D_FORTIFY_SOURCE=2",
+        // "sanitize: address" doesn't work on platforms where libasan isn't
+        // enabled. Since the intent is just to build this, we can get away with
+        // passing this flag on its own.
+        "-fsanitize=address",
+    ],
+    // Ignore that we don't have ASAN symbols linked in.
+    allow_undefined_symbols: true,
+    srcs: ["fortify_compilation_test.cpp"],
+    clang: true,
+}
+
 cc_test_library {
     name: "libfortify1-tests-clang",
     defaults: ["bionic_fortify_tests_defaults", "bionic_tests_defaults"],
diff --git a/tests/cfi_test.cpp b/tests/cfi_test.cpp
index 5e627a7..088dda6 100644
--- a/tests/cfi_test.cpp
+++ b/tests/cfi_test.cpp
@@ -26,6 +26,7 @@
 extern "C" {
 void __cfi_slowpath(uint64_t CallSiteTypeId, void* Ptr);
 void __cfi_slowpath_diag(uint64_t CallSiteTypeId, void* Ptr, void* DiagData);
+size_t __cfi_shadow_size();
 }
 
 static void f() {}
@@ -36,6 +37,8 @@
   handle = dlopen("libcfi-test.so", RTLD_NOW | RTLD_LOCAL);
   ASSERT_TRUE(handle != nullptr) << dlerror();
 
+  EXPECT_NE(0U, __cfi_shadow_size());
+
 #define SYM(type, name) auto name = reinterpret_cast<type>(dlsym(handle, #name))
   SYM(int (*)(), get_count);
   SYM(uint64_t(*)(), get_last_type_id);
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp
index 4532a4b..7e78830 100644
--- a/tests/fcntl_test.cpp
+++ b/tests/fcntl_test.cpp
@@ -20,6 +20,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/utsname.h>
+#include <sys/vfs.h>
 
 #include "TemporaryFile.h"
 
@@ -28,6 +29,7 @@
 // Glibc v2.19 doesn't include these in fcntl.h so host builds will fail without.
 #if !defined(FALLOC_FL_PUNCH_HOLE) || !defined(FALLOC_FL_KEEP_SIZE)
 #include <linux/falloc.h>
+#include <linux/magic.h>
 #endif
 
 TEST(fcntl, fcntl_smoke) {
@@ -290,8 +292,12 @@
 
   if (major < 4 || (major == 4 && minor < 1)) {
     TemporaryFile tf;
-    ASSERT_EQ(-1, fallocate(tf.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1));
-    ASSERT_EQ(errno, EOPNOTSUPP);
+    struct statfs sfs;
+    ASSERT_EQ(0, fstatfs(tf.fd, &sfs));
+    if (sfs.f_type == EXT4_SUPER_MAGIC) {
+      ASSERT_EQ(-1, fallocate(tf.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1));
+      ASSERT_EQ(errno, EOPNOTSUPP);
+    }
   }
 }
 
diff --git a/tools/versioner/src/Driver.cpp b/tools/versioner/src/Driver.cpp
index a094818..8a8e00a 100644
--- a/tools/versioner/src/Driver.cpp
+++ b/tools/versioner/src/Driver.cpp
@@ -119,7 +119,14 @@
 
   cmd.push_back("-DANDROID");
   cmd.push_back("-D__ANDROID_API__="s + std::to_string(type.api_level));
+  // FIXME: Re-enable FORTIFY properly once our clang in external/ is new enough
+  // to support diagnose_if without giving us syntax errors.
+#if 0
   cmd.push_back("-D_FORTIFY_SOURCE=2");
+#else
+  cmd.push_back("-D_FORTIFY_SOURCE=0");
+  cmd.push_back("-D__BIONIC_DECLARE_FORTIFY_HELPERS");
+#endif
   cmd.push_back("-D_GNU_SOURCE");
   cmd.push_back("-D_FILE_OFFSET_BITS="s + std::to_string(type.file_offset_bits));
 
diff --git a/tools/versioner/src/Preprocessor.cpp b/tools/versioner/src/Preprocessor.cpp
index 757a392..a7f289b 100644
--- a/tools/versioner/src/Preprocessor.cpp
+++ b/tools/versioner/src/Preprocessor.cpp
@@ -300,7 +300,7 @@
     };
 
     auto nextCol = [&file_lines, &current_location, &nextLine]() {
-      if (current_location.column == file_lines[current_location.column - 1].length()) {
+      if (current_location.column == file_lines[current_location.line - 1].length()) {
         nextLine();
       } else {
         ++current_location.column;