API guard every post-21 API.
This was generated mechanically by reverting my recent re-hide commits
(except for mempcpy, but versioner cleaned that up for me anyway),
reverting the commits which removed versioner, then:
```
m out/soong/ndk_headers.timestamp
cp -r out/soong/ndk/sysroot/usr/include/* bionic/libc/include
git -C bionic clean -df
```
Effectively, this has restored the `versioner` processed headers, but
I'm checking the results of that in so we don't have to keep
`versioner` around.
For the NDK, this restores r27 behavior by default. Anyone that's
opted into weak APIs will get the new behavior. I think this is our
best option. Anyone writing code with Android in mind should be using
weak APIs, but any code being lightly ported (and thus using the
default configuration) should not be, and it's those ports where we're
having trouble with collisions.
Bug: https://github.com/android/ndk/issues/2081
Test: None
Change-Id: I370079d27566b0c1543fb5890c958c8d09b05006
diff --git a/libc/include/bits/fortify/unistd.h b/libc/include/bits/fortify/unistd.h
index 7eda1a6..9acb942 100644
--- a/libc/include/bits/fortify/unistd.h
+++ b/libc/include/bits/fortify/unistd.h
@@ -29,24 +29,52 @@
#error "Never include this file directly; instead, include <unistd.h>"
#endif
-char* _Nullable __getcwd_chk(char* _Nullable, size_t, size_t) __INTRODUCED_IN(24);
+#if __BIONIC_AVAILABILITY_GUARD(24)
+char* _Nullable __getcwd_chk(char* _Nullable, size_t, size_t) __INTRODUCED_IN(24);
+#endif /* __BIONIC_AVAILABILITY_GUARD(24) */
+
+
+
+#if __BIONIC_AVAILABILITY_GUARD(23)
ssize_t __pread_chk(int, void* _Nonnull, size_t, off_t, size_t) __INTRODUCED_IN(23);
+#endif /* __BIONIC_AVAILABILITY_GUARD(23) */
+
ssize_t __pread_real(int, void* _Nonnull, size_t, off_t) __RENAME(pread);
+
+#if __BIONIC_AVAILABILITY_GUARD(23)
ssize_t __pread64_chk(int, void* _Nonnull, size_t, off64_t, size_t) __INTRODUCED_IN(23);
+#endif /* __BIONIC_AVAILABILITY_GUARD(23) */
+
ssize_t __pread64_real(int, void* _Nonnull, size_t, off64_t) __RENAME(pread64);
+
+#if __BIONIC_AVAILABILITY_GUARD(24)
ssize_t __pwrite_chk(int, const void* _Nonnull, size_t, off_t, size_t) __INTRODUCED_IN(24);
+#endif /* __BIONIC_AVAILABILITY_GUARD(24) */
+
ssize_t __pwrite_real(int, const void* _Nonnull, size_t, off_t) __RENAME(pwrite);
+
+#if __BIONIC_AVAILABILITY_GUARD(24)
ssize_t __pwrite64_chk(int, const void* _Nonnull, size_t, off64_t, size_t) __INTRODUCED_IN(24);
+#endif /* __BIONIC_AVAILABILITY_GUARD(24) */
+
ssize_t __pwrite64_real(int, const void* _Nonnull, size_t, off64_t) __RENAME(pwrite64);
ssize_t __read_chk(int, void* __BIONIC_COMPLICATED_NULLNESS, size_t, size_t);
+
+#if __BIONIC_AVAILABILITY_GUARD(24)
ssize_t __write_chk(int, const void* __BIONIC_COMPLICATED_NULLNESS, size_t, size_t) __INTRODUCED_IN(24);
+#endif /* __BIONIC_AVAILABILITY_GUARD(24) */
+
+
+#if __BIONIC_AVAILABILITY_GUARD(23)
ssize_t __readlink_chk(const char* _Nonnull, char* _Nonnull, size_t, size_t) __INTRODUCED_IN(23);
ssize_t __readlinkat_chk(int dirfd, const char* _Nonnull, char* _Nonnull, size_t, size_t) __INTRODUCED_IN(23);
+#endif /* __BIONIC_AVAILABILITY_GUARD(23) */
+
#if defined(__BIONIC_FORTIFY)