Make android_get_application_target_sdk_version available to the NDK.
Also move this and android_get_device_api_level into <android/api-level.h>
so that they're always available.
This involves cleaning up <sys/cdefs.h> slightly.
Bug: N/A
Test: builds
Change-Id: I25435c55f3549cd0d827a7581bee75ea8228028b
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index 6b2d86f..fc68b8a 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -137,9 +137,3 @@
args.argv + __libc_shared_globals->initial_linker_arg_count,
args.envp));
}
-
-extern "C" int android_get_application_target_sdk_version();
-
-int bionic_get_application_target_sdk_version() {
- return android_get_application_target_sdk_version();
-}
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index a54840b..ef1c393 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -152,10 +152,6 @@
return g_target_sdk_version;
}
-int bionic_get_application_target_sdk_version() {
- return android_get_application_target_sdk_version();
-}
-
extern "C" void android_set_application_target_sdk_version(int target) {
g_target_sdk_version = target;
}
diff --git a/libc/bionic/pthread_internal.cpp b/libc/bionic/pthread_internal.cpp
index 92786fe..2b7a99a 100644
--- a/libc/bionic/pthread_internal.cpp
+++ b/libc/bionic/pthread_internal.cpp
@@ -36,7 +36,6 @@
#include <async_safe/log.h>
#include "private/bionic_futex.h"
-#include "private/bionic_sdk_version.h"
#include "private/bionic_tls.h"
static pthread_internal_t* g_thread_list = nullptr;
@@ -114,7 +113,7 @@
}
// Historically we'd return null, but
- if (bionic_get_application_target_sdk_version() >= __ANDROID_API_O__) {
+ if (android_get_application_target_sdk_version() >= __ANDROID_API_O__) {
if (thread == nullptr) {
// This seems to be a common mistake, and it's relatively harmless because
// there will never be a valid thread at address 0, whereas other invalid
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index fda0b93..d9ddf10 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -42,7 +42,6 @@
#include "private/bionic_constants.h"
#include "private/bionic_fortify.h"
#include "private/bionic_futex.h"
-#include "private/bionic_sdk_version.h"
#include "private/bionic_systrace.h"
#include "private/bionic_time_conversions.h"
#include "private/bionic_tls.h"
@@ -789,7 +788,7 @@
// ARM64. So make it noinline.
static int __attribute__((noinline)) HandleUsingDestroyedMutex(pthread_mutex_t* mutex,
const char* function_name) {
- if (bionic_get_application_target_sdk_version() >= __ANDROID_API_P__) {
+ if (android_get_application_target_sdk_version() >= __ANDROID_API_P__) {
__fortify_fatal("%s called on a destroyed mutex (%p)", function_name, mutex);
}
return EBUSY;
diff --git a/libc/bionic/semaphore.cpp b/libc/bionic/semaphore.cpp
index d401b66..e0486b4 100644
--- a/libc/bionic/semaphore.cpp
+++ b/libc/bionic/semaphore.cpp
@@ -41,7 +41,6 @@
#include "private/bionic_constants.h"
#include "private/bionic_futex.h"
-#include "private/bionic_sdk_version.h"
#include "private/bionic_time_conversions.h"
// In this implementation, a semaphore contains a
@@ -222,7 +221,7 @@
}
int result = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, false, nullptr);
- if (bionic_get_application_target_sdk_version() >= __ANDROID_API_N__) {
+ if (android_get_application_target_sdk_version() >= __ANDROID_API_N__) {
if (result ==-EINTR) {
errno = EINTR;
return -1;