Update header versions for NDK platform fixes.

Bug: http://b/28178111
Change-Id: Icd638673b409aa43a91490f77c6b4d79c9ea20d9
diff --git a/libc/include/android/legacy_signal_inlines.h b/libc/include/android/legacy_signal_inlines.h
index bf895da..edc6259 100644
--- a/libc/include/android/legacy_signal_inlines.h
+++ b/libc/include/android/legacy_signal_inlines.h
@@ -34,11 +34,12 @@
 #include <string.h>
 #include <sys/cdefs.h>
 
-#if __ANDROID_API__ < 21
 
 __BEGIN_DECLS
 
-extern sighandler_t bsd_signal(int signum, sighandler_t handler);
+extern sighandler_t bsd_signal(int signum, sighandler_t handler) __REMOVED_IN(21);
+
+#if __ANDROID_API__ < 21
 
 static __inline int sigismember(const sigset_t *set, int signum) {
   /* Signal numbers start at 1, but bit positions start at 0. */
@@ -97,7 +98,8 @@
   return bsd_signal(s, f);
 }
 
+#endif /* __ANDROID_API__ < 21 */
+
 __END_DECLS
 
-#endif
 #endif /* _ANDROID_LEGACY_SIGNAL_INLINES_H_ */
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index c8030f1..ee4d5e2 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -87,13 +87,13 @@
 extern int posix_fallocate64(int, off64_t, off64_t) __INTRODUCED_IN(21);
 
 #if defined(__USE_GNU)
-ssize_t readahead(int, off64_t, size_t) __INTRODUCED_IN(21);
+ssize_t readahead(int, off64_t, size_t) __INTRODUCED_IN(16);
 int sync_file_range(int, off64_t, off64_t, unsigned int) __INTRODUCED_IN_FUTURE;
 #endif
 
-extern int __open_2(const char*, int) __INTRODUCED_IN(21);
+extern int __open_2(const char*, int) __INTRODUCED_IN(17);
 extern int __open_real(const char*, int, ...) __RENAME(open);
-extern int __openat_2(int, const char*, int) __INTRODUCED_IN(21);
+extern int __openat_2(int, const char*, int) __INTRODUCED_IN(17);
 extern int __openat_real(int, const char*, int, ...) __RENAME(openat);
 __errordecl(__creat_missing_mode, "called with O_CREAT, but missing mode");
 __errordecl(__creat_too_many_args, "too many arguments");
diff --git a/libc/include/fenv.h b/libc/include/fenv.h
index e51f9b6..d4f6994 100644
--- a/libc/include/fenv.h
+++ b/libc/include/fenv.h
@@ -36,23 +36,27 @@
 __BEGIN_DECLS
 #pragma GCC visibility push(default)
 
-int feclearexcept(int) __INTRODUCED_IN(21);
-int fegetexceptflag(fexcept_t*, int) __INTRODUCED_IN(21);
-int feraiseexcept(int) __INTRODUCED_IN(21);
-int fesetexceptflag(const fexcept_t*, int) __INTRODUCED_IN(21);
-int fetestexcept(int) __INTRODUCED_IN(21);
+// fenv was always available on x86.
+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)
+    __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)
+    __INTRODUCED_IN_X86(9);
+int fetestexcept(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 
-int fegetround(void) __INTRODUCED_IN(21);
-int fesetround(int) __INTRODUCED_IN(21);
+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 fegetenv(fenv_t*) __INTRODUCED_IN(21);
-int feholdexcept(fenv_t*) __INTRODUCED_IN(21);
-int fesetenv(const fenv_t*) __INTRODUCED_IN(21);
-int feupdateenv(const fenv_t*) __INTRODUCED_IN(21);
+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)
+    __INTRODUCED_IN_X86(9);
 
-int feenableexcept(int) __INTRODUCED_IN(21);
-int fedisableexcept(int) __INTRODUCED_IN(21);
-int fegetexcept(void) __INTRODUCED_IN(21);
+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 fegetexcept(void) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
 
 /*
  * The following constant represents the default floating-point environment
diff --git a/libc/include/ftw.h b/libc/include/ftw.h
index ebd59f5..ac901cc 100644
--- a/libc/include/ftw.h
+++ b/libc/include/ftw.h
@@ -54,9 +54,9 @@
 };
 
 __BEGIN_DECLS
-int ftw(const char*, int (*)(const char*, const struct stat*, int), int) __INTRODUCED_IN(21);
+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)
-  __INTRODUCED_IN(21);
+  __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)
   __INTRODUCED_IN(21);
diff --git a/libc/include/inttypes.h b/libc/include/inttypes.h
index 4752c52..54b5ee2 100644
--- a/libc/include/inttypes.h
+++ b/libc/include/inttypes.h
@@ -254,8 +254,8 @@
 } imaxdiv_t;
 
 __BEGIN_DECLS
-intmax_t imaxabs(intmax_t) __pure2 __INTRODUCED_IN(21);
-imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2 __INTRODUCED_IN(21);
+intmax_t imaxabs(intmax_t) __pure2 __INTRODUCED_IN(19);
+imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2 __INTRODUCED_IN(19);
 intmax_t	strtoimax(const char *, char **, int);
 uintmax_t	strtoumax(const char *, char **, int);
 intmax_t wcstoimax(const wchar_t* __restrict, wchar_t** __restrict, int) __INTRODUCED_IN(21);
diff --git a/libc/include/malloc.h b/libc/include/malloc.h
index 02e2da7..8e6cef9 100644
--- a/libc/include/malloc.h
+++ b/libc/include/malloc.h
@@ -29,7 +29,7 @@
 extern void free(void* p);
 
 extern void* memalign(size_t alignment, size_t byte_count) __mallocfunc __wur __attribute__((alloc_size(2)));
-extern size_t malloc_usable_size(const void* p) __INTRODUCED_IN(21);
+extern size_t malloc_usable_size(const void* p) __INTRODUCED_IN(17);
 
 #ifndef STRUCT_MALLINFO_DECLARED
 #define STRUCT_MALLINFO_DECLARED 1
diff --git a/libc/include/math.h b/libc/include/math.h
index 97539d7..eae1d3b 100644
--- a/libc/include/math.h
+++ b/libc/include/math.h
@@ -127,13 +127,6 @@
 #endif
 #endif /* __BSD_VISIBLE */
 
-/* scalbln, scalbnf, and scalblnl were unavailable on x86 until API level 18 */
-#if defined(__i386__)
-#define __INTRODUCED_IN_X86 __INTRODUCED_IN
-#else
-#define __INTRODUCED_IN_X86(x)
-#endif
-
 /*
  * Most of these functions depend on the rounding mode and have the side
  * effect of raising floating-point exceptions, so they are not declared
@@ -212,7 +205,10 @@
 double	logb(double);
 long	lrint(double);
 long	lround(double);
-double nan(const char*) __pure2 __INTRODUCED_IN(13);
+
+double nan(const char*) __pure2 __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 *);
@@ -243,8 +239,8 @@
 double	fmin(double, double) __pure2;
 double	nearbyint(double);
 double	round(double);
-double	scalbln(double, long);
-double scalbn(double, int) __INTRODUCED_IN_X86(18);
+double scalbln(double, long) __INTRODUCED_IN_X86(18);
+double scalbn(double, int);
 double	tgamma(double);
 double	trunc(double);
 #endif
@@ -310,7 +306,7 @@
 float	erfcf(float);
 float	hypotf(float, float);
 float	lgammaf(float);
-float tgammaf(float) __INTRODUCED_IN(13);
+float tgammaf(float) __INTRODUCED_IN_ARM(13) __INTRODUCED_IN_MIPS(13) __INTRODUCED_IN_X86(9);
 
 float	acoshf(float);
 float	asinhf(float);
@@ -322,14 +318,15 @@
 long long llroundf(float);
 long	lrintf(float);
 long	lroundf(float);
-float nanf(const char*) __pure2 __INTRODUCED_IN(13);
+float nanf(const char*) __pure2 __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);
-float scalbnf(float, int) __INTRODUCED_IN_X86(18);
+float	scalblnf(float, long) __INTRODUCED_IN_X86(18);
+float scalbnf(float, int);
 float	truncf(float);
 
 float	fdimf(float, float);
@@ -421,8 +418,8 @@
 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);
-long double scalbnl(long double, int) __INTRODUCED_IN_X86(18);
+long double scalblnl(long double, long) __INTRODUCED_IN_X86(18);
+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);
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index b4a48f0..3262bd1 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -133,7 +133,7 @@
 
 __BEGIN_DECLS
 
-int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)) __INTRODUCED_IN(21);
+int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)) __INTRODUCED_IN(12);
 
 int pthread_attr_destroy(pthread_attr_t* _Nonnull);
 int pthread_attr_getdetachstate(const pthread_attr_t* _Nonnull, int* _Nonnull);
diff --git a/libc/include/pwd.h b/libc/include/pwd.h
index b45780e..e881129 100644
--- a/libc/include/pwd.h
+++ b/libc/include/pwd.h
@@ -122,8 +122,8 @@
 void setpwent(void) __INTRODUCED_IN_FUTURE;
 void endpwent(void) __INTRODUCED_IN_FUTURE;
 
-int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**) __INTRODUCED_IN(21);
-int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**) __INTRODUCED_IN(21);
+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);
 
 __END_DECLS
 
diff --git a/libc/include/sched.h b/libc/include/sched.h
index a1f1dfa..7cb11a7 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -52,9 +52,10 @@
 
 #if defined(__USE_GNU)
 
-extern int clone(int (*)(void*), void*, int, void*, ...);
-extern int unshare(int) __INTRODUCED_IN(21);
-extern int sched_getcpu(void) __INTRODUCED_IN(21);
+extern int clone(int (*)(void*), void*, int, void*, ...) __INTRODUCED_IN_ARM(9)
+    __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(17);
+extern int unshare(int) __INTRODUCED_IN(17);
+extern int sched_getcpu(void) __INTRODUCED_IN(12);
 extern int setns(int, int) __INTRODUCED_IN(21);
 
 #ifdef __LP64__
@@ -72,9 +73,8 @@
   __CPU_BITTYPE  __bits[ CPU_SETSIZE / __CPU_BITS ];
 } cpu_set_t;
 
-extern int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) __INTRODUCED_IN(21);
-
-extern int sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) __INTRODUCED_IN(21);
+extern int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) __INTRODUCED_IN(12);
+extern int sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) __INTRODUCED_IN(12);
 
 #define CPU_ZERO(set)          CPU_ZERO_S(sizeof(cpu_set_t), set)
 #define CPU_SET(cpu, set)      CPU_SET_S(cpu, sizeof(cpu_set_t), set)
@@ -97,8 +97,8 @@
 #define CPU_ALLOC(count)  __sched_cpualloc((count))
 #define CPU_FREE(set)     __sched_cpufree((set))
 
-extern cpu_set_t* __sched_cpualloc(size_t count) __INTRODUCED_IN(21);
-extern void __sched_cpufree(cpu_set_t* set) __INTRODUCED_IN(21);
+extern cpu_set_t* __sched_cpualloc(size_t count) __INTRODUCED_IN(12);
+extern void __sched_cpufree(cpu_set_t* set) __INTRODUCED_IN(12);
 
 #define CPU_ZERO_S(setsize, set)  __builtin_memset(set, 0, setsize)
 
@@ -142,7 +142,7 @@
 
 #define CPU_COUNT_S(setsize, set)  __sched_cpucount((setsize), (set))
 
-extern int __sched_cpucount(size_t setsize, cpu_set_t* set) __INTRODUCED_IN(21);
+extern int __sched_cpucount(size_t setsize, cpu_set_t* set) __INTRODUCED_IN(12);
 
 #endif /* __USE_GNU */
 
diff --git a/libc/include/search.h b/libc/include/search.h
index 1ac6d21..dc160e9 100644
--- a/libc/include/search.h
+++ b/libc/include/search.h
@@ -38,10 +38,10 @@
   __INTRODUCED_IN(21);
 
 void* tdelete(const void* __restrict, void** __restrict, int (*)(const void*, const void*))
-  __INTRODUCED_IN(21);
-void tdestroy(void*, void (*)(void*)) __INTRODUCED_IN(21);
-void* tfind(const void*, void* const*, int (*)(const void*, const void*)) __INTRODUCED_IN(21);
-void* tsearch(const void*, void**, int (*)(const void*, const void*)) __INTRODUCED_IN(21);
+  __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);
 
 __END_DECLS
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index 02b06f5..7adeb35 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -54,8 +54,10 @@
 int     setjmp(jmp_buf);
 void    longjmp(jmp_buf, int);
 
-int     sigsetjmp(sigjmp_buf, int);
-void    siglongjmp(sigjmp_buf, int);
+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);
 
 __END_DECLS
 
diff --git a/libc/include/signal.h b/libc/include/signal.h
index d9f43de..3905d86 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -144,8 +144,8 @@
 
 extern int sigaltstack(const stack_t*, stack_t*);
 
-extern void psiginfo(const siginfo_t*, const char*) __INTRODUCED_IN(21);
-extern void psignal(int, const char*) __INTRODUCED_IN(21);
+extern void psiginfo(const siginfo_t*, const char*) __INTRODUCED_IN(17);
+extern void psignal(int, const char*) __INTRODUCED_IN(17);
 
 extern int pthread_kill(pthread_t, int);
 extern int pthread_sigmask(int, const sigset_t*, sigset_t*);
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 05f2d98..83ffc20 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -119,8 +119,8 @@
 size_t	 fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
 int	 getc(FILE *);
 int	 getchar(void);
-ssize_t getdelim(char** __restrict, size_t* __restrict, int, FILE* __restrict) __INTRODUCED_IN(21);
-ssize_t getline(char** __restrict, size_t* __restrict, FILE* __restrict) __INTRODUCED_IN(21);
+ssize_t getdelim(char** __restrict, size_t* __restrict, int, FILE* __restrict) __INTRODUCED_IN(18);
+ssize_t getline(char** __restrict, size_t* __restrict, FILE* __restrict) __INTRODUCED_IN(18);
 
 void	 perror(const char *);
 int	 printf(const char * __restrict, ...)
@@ -280,7 +280,7 @@
 #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
 #endif /* __BSD_VISIBLE */
 
-extern char* __fgets_chk(char*, int, FILE*, size_t) __INTRODUCED_IN(21);
+extern char* __fgets_chk(char*, int, FILE*, size_t) __INTRODUCED_IN(17);
 extern char* __fgets_real(char*, int, FILE*) __RENAME(fgets);
 __errordecl(__fgets_too_big_error, "fgets called with size bigger than buffer");
 __errordecl(__fgets_too_small_error, "fgets called with size less than zero");
diff --git a/libc/include/string.h b/libc/include/string.h
index f39a86b..b3ea9d6 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
@@ -54,7 +54,7 @@
 extern void*  memmem(const void *, size_t, const void *, size_t) __purefunc;
 
 extern char*  strchr(const char *, int) __purefunc;
-extern char* __strchr_chk(const char*, int, size_t) __INTRODUCED_IN(21);
+extern char* __strchr_chk(const char*, int, size_t) __INTRODUCED_IN(18);
 #if defined(__USE_GNU)
 #if defined(__cplusplus)
 extern "C++" char* strchrnul(char*, int) __RENAME(strchrnul) __purefunc;
@@ -65,10 +65,10 @@
 #endif
 
 extern char*  strrchr(const char *, int) __purefunc;
-extern char* __strrchr_chk(const char*, int, size_t) __INTRODUCED_IN(21);
+extern char* __strrchr_chk(const char*, int, size_t) __INTRODUCED_IN(18);
 
 extern size_t strlen(const char *) __purefunc;
-extern size_t __strlen_chk(const char*, size_t) __INTRODUCED_IN(21);
+extern size_t __strlen_chk(const char*, size_t) __INTRODUCED_IN(17);
 extern int    strcmp(const char *, const char *) __purefunc;
 extern char* stpcpy(char* __restrict, const char* __restrict) __INTRODUCED_IN(21);
 extern char*  strcpy(char* __restrict, const char* __restrict);
@@ -139,10 +139,10 @@
 extern char* __strncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t)
   __INTRODUCED_IN(21);
 extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t) __RENAME(strlcpy);
-extern size_t __strlcpy_chk(char*, const char*, size_t, size_t) __INTRODUCED_IN(21);
+extern size_t __strlcpy_chk(char*, const char*, size_t, size_t) __INTRODUCED_IN(17);
 extern size_t __strlcat_real(char* __restrict, const char* __restrict, size_t) __RENAME(strlcat);
 extern size_t __strlcat_chk(char* __restrict, const char* __restrict, size_t, size_t)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(17);
 
 #if defined(__BIONIC_FORTIFY)
 
diff --git a/libc/include/strings.h b/libc/include/strings.h
index ca9f658..021e2b4 100644
--- a/libc/include/strings.h
+++ b/libc/include/strings.h
@@ -54,11 +54,7 @@
 #define bzero(b, len) (void)(__builtin_memset((b), '\0', (len)))
 #endif
 
-#if defined(__i386__)
-int ffs(int) __INTRODUCED_IN(21);
-#else
-int ffs(int);
-#endif
+int ffs(int) __INTRODUCED_IN_X86(18);
 
 __END_DECLS
 
diff --git a/libc/include/sys/auxv.h b/libc/include/sys/auxv.h
index 4611fcc..2fa637e 100644
--- a/libc/include/sys/auxv.h
+++ b/libc/include/sys/auxv.h
@@ -33,7 +33,7 @@
 
 __BEGIN_DECLS
 
-unsigned long int getauxval(unsigned long int type) __INTRODUCED_IN(21);
+unsigned long int getauxval(unsigned long int type) __INTRODUCED_IN(18);
 
 __END_DECLS
 
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 7b06967..fa03207 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -501,6 +501,24 @@
 #define __INTRODUCED_IN_64(api_level)
 #endif
 
+#if defined(__arm__)
+#define __INTRODUCED_IN_ARM __INTRODUCED_IN
+#else
+#define __INTRODUCED_IN_ARM(x)
+#endif
+
+#if defined(__i386__)
+#define __INTRODUCED_IN_X86 __INTRODUCED_IN
+#else
+#define __INTRODUCED_IN_X86(x)
+#endif
+
+#if defined(__mips__)
+#define __INTRODUCED_IN_MIPS __INTRODUCED_IN
+#else
+#define __INTRODUCED_IN_MIPS(x)
+#endif
+
 #if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5
 #if __LP64__
 #define __size_mul_overflow(a, b, result) __builtin_umull_overflow(a, b, result)
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index af96eff..7a8aa89 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -61,8 +61,8 @@
 extern int mprotect(const void*, size_t, int);
 extern void* mremap(void*, size_t, size_t, int, ...);
 
-extern int mlockall(int) __INTRODUCED_IN(21);
-extern int munlockall(void) __INTRODUCED_IN(21);
+extern int mlockall(int) __INTRODUCED_IN(17);
+extern int munlockall(void) __INTRODUCED_IN(17);
 extern int mlock(const void*, size_t);
 extern int munlock(const void*, size_t);
 
diff --git a/libc/include/sys/personality.h b/libc/include/sys/personality.h
index 68ae77c..15a5e68 100644
--- a/libc/include/sys/personality.h
+++ b/libc/include/sys/personality.h
@@ -34,7 +34,7 @@
 
 __BEGIN_DECLS
 
-extern int personality(unsigned int persona) __INTRODUCED_IN(21);
+extern int personality(unsigned int persona) __INTRODUCED_IN(15);
 
 __END_DECLS
 
diff --git a/libc/include/sys/signalfd.h b/libc/include/sys/signalfd.h
index 084a528..41036b0 100644
--- a/libc/include/sys/signalfd.h
+++ b/libc/include/sys/signalfd.h
@@ -35,7 +35,7 @@
 
 __BEGIN_DECLS
 
-extern int signalfd(int fd, const sigset_t* _Nonnull mask, int flags) __INTRODUCED_IN(21);
+extern int signalfd(int fd, const sigset_t* _Nonnull mask, int flags) __INTRODUCED_IN(18);
 
 __END_DECLS
 
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index 46eec96..f26a492 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -157,7 +157,7 @@
 extern int mknod(const char*, mode_t, dev_t);
 extern mode_t umask(mode_t);
 
-extern mode_t __umask_chk(mode_t) __INTRODUCED_IN(21);
+extern mode_t __umask_chk(mode_t) __INTRODUCED_IN(18);
 extern mode_t __umask_real(mode_t) __RENAME(umask);
 __errordecl(__umask_invalid_mode, "umask called with invalid mode");
 
diff --git a/libc/include/sys/statvfs.h b/libc/include/sys/statvfs.h
index 1f00b9d..f6b9803 100644
--- a/libc/include/sys/statvfs.h
+++ b/libc/include/sys/statvfs.h
@@ -60,10 +60,10 @@
 #define ST_RELATIME    0x1000
 
 extern int statvfs(const char* __restrict _Nonnull, struct statvfs* __restrict _Nonnull)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(19);
 extern int statvfs64(const char* __restrict _Nonnull, struct statvfs64* __restrict _Nonnull)
   __INTRODUCED_IN(21);
-extern int fstatvfs(int, struct statvfs* _Nonnull) __INTRODUCED_IN(21);
+extern int fstatvfs(int, struct statvfs* _Nonnull) __INTRODUCED_IN(19);
 extern int fstatvfs64(int, struct statvfs64* _Nonnull) __INTRODUCED_IN(21);
 
 __END_DECLS
diff --git a/libc/include/sys/swap.h b/libc/include/sys/swap.h
index fe14a30..2d99df8 100644
--- a/libc/include/sys/swap.h
+++ b/libc/include/sys/swap.h
@@ -38,8 +38,8 @@
 #define SWAP_FLAG_PRIO_MASK 0x7fff
 #define SWAP_FLAG_PRIO_SHIFT 0
 
-extern int swapon(const char* _Nonnull, int) __INTRODUCED_IN(21);
-extern int swapoff(const char* _Nonnull) __INTRODUCED_IN(21);
+extern int swapon(const char* _Nonnull, int) __INTRODUCED_IN(19);
+extern int swapoff(const char* _Nonnull) __INTRODUCED_IN(19);
 
 __END_DECLS
 
diff --git a/libc/include/sys/system_properties.h b/libc/include/sys/system_properties.h
index 99a6e59..d3e0d8d 100644
--- a/libc/include/sys/system_properties.h
+++ b/libc/include/sys/system_properties.h
@@ -48,7 +48,7 @@
 
 /* Set a system property by name.
 **/
-int __system_property_set(const char* key, const char* value) __INTRODUCED_IN(21);
+int __system_property_set(const char* key, const char* value) __INTRODUCED_IN(12);
 
 /* Return a pointer to the system property named name, if it
 ** exists, or NULL if there is no such property.  Use 
@@ -94,7 +94,7 @@
 ** not a bug.
 */
 int __system_property_foreach(void (*propfn)(const prop_info* pi, void* cookie), void* cookie)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(19);
 
 __END_DECLS
 
diff --git a/libc/include/sys/timerfd.h b/libc/include/sys/timerfd.h
index a189742..8311f08 100644
--- a/libc/include/sys/timerfd.h
+++ b/libc/include/sys/timerfd.h
@@ -41,10 +41,10 @@
 #define TFD_CLOEXEC O_CLOEXEC
 #define TFD_NONBLOCK O_NONBLOCK
 
-extern int timerfd_create(clockid_t, int) __INTRODUCED_IN(21);
+extern int timerfd_create(clockid_t, int) __INTRODUCED_IN(19);
 extern int timerfd_settime(int, int, const struct itimerspec*, struct itimerspec*)
-  __INTRODUCED_IN(21);
-extern int timerfd_gettime(int, struct itimerspec*) __INTRODUCED_IN(21);
+  __INTRODUCED_IN(19);
+extern int timerfd_gettime(int, struct itimerspec*) __INTRODUCED_IN(19);
 
 __END_DECLS
 
diff --git a/libc/include/sys/wait.h b/libc/include/sys/wait.h
index aba20e5..e0afabc 100644
--- a/libc/include/sys/wait.h
+++ b/libc/include/sys/wait.h
@@ -51,7 +51,7 @@
 
 extern pid_t  wait(int *);
 extern pid_t  waitpid(pid_t, int *, int);
-extern pid_t wait4(pid_t, int*, int, struct rusage*) __INTRODUCED_IN(19);
+extern pid_t wait4(pid_t, int*, int, struct rusage*) __INTRODUCED_IN(18);
 
 /* Posix states that idtype_t should be an enumeration type, but
  * the kernel headers define P_ALL, P_PID and P_PGID as constant macros
diff --git a/libc/include/sys/xattr.h b/libc/include/sys/xattr.h
index 070913f..63605c5 100644
--- a/libc/include/sys/xattr.h
+++ b/libc/include/sys/xattr.h
@@ -36,25 +36,25 @@
 #define XATTR_REPLACE 2
 
 extern int fsetxattr(int fd, const char* name, const void* value, size_t size, int flags)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(16);
 extern int setxattr(const char* path, const char* name, const void* value, size_t size, int flags)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(16);
 extern int lsetxattr(const char* path, const char* name, const void* value, size_t size, int flags)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(16);
 
-extern ssize_t fgetxattr(int fd, const char* name, void* value, size_t size) __INTRODUCED_IN(21);
+extern ssize_t fgetxattr(int fd, const char* name, void* value, size_t size) __INTRODUCED_IN(16);
 extern ssize_t getxattr(const char* path, const char* name, void* value, size_t size)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(16);
 extern ssize_t lgetxattr(const char* path, const char* name, void* value, size_t size)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(16);
 
-extern ssize_t listxattr(const char* path, char* list, size_t size) __INTRODUCED_IN(21);
-extern ssize_t llistxattr(const char* path, char* list, size_t size) __INTRODUCED_IN(21);
-extern ssize_t flistxattr(int fd, char* list, size_t size) __INTRODUCED_IN(21);
+extern ssize_t listxattr(const char* path, char* list, size_t size) __INTRODUCED_IN(16);
+extern ssize_t llistxattr(const char* path, char* list, size_t size) __INTRODUCED_IN(16);
+extern ssize_t flistxattr(int fd, char* list, size_t size) __INTRODUCED_IN(16);
 
-extern int removexattr(const char* path, const char* name) __INTRODUCED_IN(21);
-extern int lremovexattr(const char* path, const char* name) __INTRODUCED_IN(21);
-extern int fremovexattr(int fd, const char* name) __INTRODUCED_IN(21);
+extern int removexattr(const char* path, const char* name) __INTRODUCED_IN(16);
+extern int lremovexattr(const char* path, const char* name) __INTRODUCED_IN(16);
+extern int fremovexattr(int fd, const char* name) __INTRODUCED_IN(16);
 
 __END_DECLS
 
diff --git a/libc/include/time.h b/libc/include/time.h
index 039608b..ef4ac2f 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
@@ -100,8 +100,8 @@
 extern int timer_getoverrun(timer_t) __LIBC_ABI_PUBLIC__;
 
 /* Non-standard extensions that are in the BSDs and glibc. */
-extern time_t timelocal(struct tm*) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(21);
-extern time_t timegm(struct tm*) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(21);
+extern time_t timelocal(struct tm*) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(12);
+extern time_t timegm(struct tm*) __LIBC_ABI_PUBLIC__ __INTRODUCED_IN(12);
 
 __END_DECLS
 
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index 71764ae..7deca95 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -90,7 +90,7 @@
 extern pid_t  getppid(void);
 extern pid_t  getpgrp(void);
 extern int    setpgrp(void);
-extern pid_t  getsid(pid_t __pid) __INTRODUCED_IN(21);
+extern pid_t  getsid(pid_t __pid) __INTRODUCED_IN(17);
 extern pid_t  setsid(void);
 
 extern int execv(const char* __path, char* const* __argv);
@@ -127,7 +127,7 @@
 
 extern int access(const char* __path, int __mode);
 extern int faccessat(int __dirfd, const char* __path, int __mode, int __flags)
-  __INTRODUCED_IN(21);
+  __INTRODUCED_IN(16);
 extern int link(const char* __oldpath, const char* __newpath);
 extern int linkat(int __olddirfd, const char* __oldpath, int __newdirfd,
                   const char* __newpath, int __flags) __INTRODUCED_IN(21);
@@ -285,7 +285,7 @@
 extern ssize_t __readlinkat_chk(int dirfd, const char*, char*, size_t, size_t) __INTRODUCED_IN(23);
 __errordecl(__readlinkat_dest_size_error, "readlinkat called with size bigger than destination");
 __errordecl(__readlinkat_size_toobig_error, "readlinkat called with size > SSIZE_MAX");
-extern ssize_t __readlinkat_real(int dirfd, const char*, char*, size_t) __RENAME(readlinkat);
+extern ssize_t __readlinkat_real(int dirfd, const char*, char*, size_t) __RENAME(readlinkat) __INTRODUCED_IN(21);
 
 extern int getdomainname(char*, size_t) __INTRODUCED_IN_FUTURE;
 extern int setdomainname(const char*, size_t) __INTRODUCED_IN_FUTURE;