Merge "Stop using the __ANDROID_API_x__ constants."
This commit is contained in:
commit
5e2ac29165
56 changed files with 157 additions and 179 deletions
|
@ -72,7 +72,7 @@ __asm__(PRE "movq %rsp,%rdi; andq $~0xf,%rsp; callq _start_main" POST);
|
|||
// To ensure that the .tdata input section isn't deleted (e.g. by
|
||||
// --gc-sections), the .text input section (which contains _start) has a
|
||||
// relocation to the .tdata input section.
|
||||
#if __ANDROID_API__ >= __ANDROID_API_Q__
|
||||
#if __ANDROID_API__ >= 29
|
||||
#if defined(__arm__)
|
||||
asm(" .section .tdata,\"awT\",%progbits\n"
|
||||
" .p2align 5\n"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
// __register_atfork wasn't available until android-23. When using libc.a, we're
|
||||
// using the latest library regardless of target API level.
|
||||
#if defined(_FORCE_CRT_ATFORK) || __ANDROID_API__ >= __ANDROID_API_M__
|
||||
#if defined(_FORCE_CRT_ATFORK) || __ANDROID_API__ >= 23
|
||||
|
||||
extern void* __dso_handle;
|
||||
|
||||
|
@ -33,4 +33,4 @@ int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(vo
|
|||
return __register_atfork(prepare, parent, child, &__dso_handle);
|
||||
}
|
||||
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
|
||||
#endif
|
||||
|
|
|
@ -100,8 +100,8 @@ pthread_internal_t* __pthread_internal_find(pthread_t thread_id, const char* cal
|
|||
}
|
||||
}
|
||||
|
||||
// Historically we'd return null, but
|
||||
if (android_get_application_target_sdk_version() >= __ANDROID_API_O__) {
|
||||
// Historically we'd return null, but from API level 26 we catch this error.
|
||||
if (android_get_application_target_sdk_version() >= 26) {
|
||||
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
|
||||
|
|
|
@ -799,7 +799,7 @@ static inline __always_inline bool IsMutexDestroyed(uint16_t mutex_state) {
|
|||
// ARM64. So make it noinline.
|
||||
static int __attribute__((noinline)) HandleUsingDestroyedMutex(pthread_mutex_t* mutex,
|
||||
const char* function_name) {
|
||||
if (android_get_application_target_sdk_version() >= __ANDROID_API_P__) {
|
||||
if (android_get_application_target_sdk_version() >= 28) {
|
||||
__fortify_fatal("%s called on a destroyed mutex (%p)", function_name, mutex);
|
||||
}
|
||||
return EBUSY;
|
||||
|
|
|
@ -221,7 +221,7 @@ int sem_wait(sem_t* sem) {
|
|||
}
|
||||
|
||||
int result = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, false, nullptr);
|
||||
if (android_get_application_target_sdk_version() >= __ANDROID_API_N__) {
|
||||
if (android_get_application_target_sdk_version() >= 24) {
|
||||
if (result ==-EINTR) {
|
||||
errno = EINTR;
|
||||
return -1;
|
||||
|
|
|
@ -124,7 +124,7 @@ __BEGIN_DECLS
|
|||
*/
|
||||
int android_get_application_target_sdk_version() __INTRODUCED_IN(24);
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_Q__
|
||||
#if __ANDROID_API__ < 29
|
||||
|
||||
// android_get_device_api_level is a static inline before API level 29.
|
||||
#define __BIONIC_GET_DEVICE_API_LEVEL_INLINE static __inline
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_LEGACY_ERRNO_INLINES_H
|
||||
#define _ANDROID_LEGACY_ERRNO_INLINES_H
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
#if __ANDROID_API__ < 21
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -45,4 +44,3 @@ static __inline int __attribute__((deprecated)) __set_errno(int n) {
|
|||
__END_DECLS
|
||||
|
||||
#endif
|
||||
#endif /* _ANDROID_LEGACY_ERRNO_INLINES_H */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__ && defined(__arm__)
|
||||
#if __ANDROID_API__ < 21 && defined(__arm__)
|
||||
|
||||
#define __BIONIC_FENV_INLINE static __inline
|
||||
#include <bits/fenv_inlines_arm.h>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__ && (defined(__mips__) && !defined(__LP64__))
|
||||
#if __ANDROID_API__ < 21 && (defined(__mips__) && !defined(__LP64__))
|
||||
|
||||
#define __BIONIC_FENV_INLINE static __inline
|
||||
#include <bits/fenv_inlines_mips.h>
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_LEGACY_SIGNAL_INLINES_H_
|
||||
#define _ANDROID_LEGACY_SIGNAL_INLINES_H_
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
#if __ANDROID_API__ < 21
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
@ -119,6 +118,4 @@ static __inline sighandler_t signal(int s, sighandler_t f) {
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_L__ */
|
||||
|
||||
#endif /* _ANDROID_LEGACY_SIGNAL_INLINES_H_ */
|
||||
#endif
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_LEGACY_STDLIB_INLINES_H_
|
||||
#define _ANDROID_LEGACY_STDLIB_INLINES_H_
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_K__
|
||||
#if __ANDROID_API__ < 19
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -45,9 +44,11 @@ static __inline long long llabs(long long __n) {
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_K__ */
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
|
||||
|
||||
#if __ANDROID_API__ < 21
|
||||
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
|
@ -83,9 +84,11 @@ static __inline int grantpt(int __fd __attribute((unused))) {
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_L__ */
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_O__
|
||||
|
||||
|
||||
#if __ANDROID_API__ < 26
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <xlocale.h>
|
||||
|
@ -106,6 +109,4 @@ static __inline long strtol_l(const char* __s, char** __end_ptr, int __base, loc
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_O__ */
|
||||
|
||||
#endif /* _ANDROID_LEGACY_STDLIB_INLINES_H_ */
|
||||
#endif
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_LEGACY_STRINGS_INLINES_H_
|
||||
#define _ANDROID_LEGACY_STRINGS_INLINES_H_
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if defined(__i386__) && __ANDROID_API__ < __ANDROID_API_J_MR2__
|
||||
#if defined(__i386__) && __ANDROID_API__ < 18
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
|
@ -43,5 +42,3 @@ static __inline int ffs(int __n) { return __builtin_ffs(__n); }
|
|||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
#if __ANDROID_API__ < 21
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
|
@ -68,4 +68,4 @@ static __inline void* mmap64(void* __addr, size_t __size, int __prot, int __flag
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_L__ */
|
||||
#endif
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_LEGACY_SYS_STAT_INLINES_H_
|
||||
#define _ANDROID_LEGACY_SYS_STAT_INLINES_H_
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
#if __ANDROID_API__ < 21
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
@ -44,4 +43,3 @@ static __inline int mkfifo(const char* __path, mode_t __mode) {
|
|||
__END_DECLS
|
||||
|
||||
#endif
|
||||
#endif /* _ANDROID_LEGACY_SYS_STAT_INLINES_H_ */
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_LEGACY_SYS_WAIT_INLINES_H_
|
||||
#define _ANDROID_LEGACY_SYS_WAIT_INLINES_H_
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_J_MR2__
|
||||
#if __ANDROID_API__ < 18
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -45,6 +44,4 @@ static __inline pid_t wait4(pid_t pid, int* status, int options, struct rusage*
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_J_MR2__ */
|
||||
|
||||
#endif /* _ANDROID_LEGACY_SYS_WAIT_INLINES_H_ */
|
||||
#endif
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ANDROID_LEGACY_TERMIOS_INLINES_H_
|
||||
#define _ANDROID_LEGACY_TERMIOS_INLINES_H_
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
#if __ANDROID_API__ < 21
|
||||
|
||||
#include <linux/termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -41,5 +40,3 @@
|
|||
#include <bits/termios_inlines.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _ANDROID_LEGACY_TERMIOS_INLINES_H_ */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_R__
|
||||
#if __ANDROID_API__ < 30
|
||||
|
||||
#define __BIONIC_THREADS_INLINE static __inline
|
||||
#include <bits/threads_inlines.h>
|
||||
|
|
|
@ -59,7 +59,7 @@ __BIONIC_FORTIFY_INLINE
|
|||
int open(const char* const __pass_object_size pathname, int flags)
|
||||
__overloadable
|
||||
__clang_error_if(__open_modes_useful(flags), "'open' " __open_too_few_args_error) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
return __open_2(pathname, flags);
|
||||
#else
|
||||
return __open_real(pathname, flags);
|
||||
|
@ -83,7 +83,7 @@ __BIONIC_FORTIFY_INLINE
|
|||
int openat(int dirfd, const char* const __pass_object_size pathname, int flags)
|
||||
__overloadable
|
||||
__clang_error_if(__open_modes_useful(flags), "'openat' " __open_too_few_args_error) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
return __openat_2(dirfd, pathname, flags);
|
||||
#else
|
||||
return __openat_real(dirfd, pathname, flags);
|
||||
|
@ -98,7 +98,7 @@ int openat(int dirfd, const char* const __pass_object_size pathname, int flags,
|
|||
return __openat_real(dirfd, pathname, flags, modes);
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
/* Note that open == open64, so we reuse those bits in the open64 variants below. */
|
||||
|
||||
__BIONIC_ERROR_FUNCTION_VISIBILITY
|
||||
|
@ -139,7 +139,7 @@ int openat64(int dirfd, const char* const __pass_object_size pathname, int flags
|
|||
"'openat64' " __open_useless_modes_warning) {
|
||||
return openat(dirfd, pathname, flags, modes);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
#endif /* __ANDROID_API__ >= 21 */
|
||||
|
||||
#undef __open_too_many_args_error
|
||||
#undef __open_too_few_args_error
|
||||
|
|
|
@ -44,7 +44,7 @@ int poll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, int timeo
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos(fds), sizeof(*fds) * fd_count),
|
||||
"in call to 'poll', fd_count is larger than the given buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos_fds = __bos(fds);
|
||||
|
||||
if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
|
||||
|
@ -54,13 +54,13 @@ int poll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, int timeo
|
|||
return __call_bypassing_fortify(poll)(fds, fd_count, timeout);
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
int ppoll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const struct timespec* timeout, const sigset_t* mask)
|
||||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos(fds), sizeof(*fds) * fd_count),
|
||||
"in call to 'ppoll', fd_count is larger than the given buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos_fds = __bos(fds);
|
||||
|
||||
if (!__bos_fd_count_trivially_safe(bos_fds, fds, fd_count)) {
|
||||
|
@ -69,9 +69,9 @@ int ppoll(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const st
|
|||
#endif
|
||||
return __call_bypassing_fortify(ppoll)(fds, fd_count, timeout, mask);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
#endif /* __ANDROID_API__ >= 21 */
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_P__
|
||||
#if __ANDROID_API__ >= 28
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
int ppoll64(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const struct timespec* timeout, const sigset64_t* mask)
|
||||
__overloadable
|
||||
|
@ -86,7 +86,7 @@ int ppoll64(struct pollfd* const fds __pass_object_size, nfds_t fd_count, const
|
|||
#endif
|
||||
return __call_bypassing_fortify(ppoll64)(fds, fd_count, timeout, mask);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_P__ */
|
||||
#endif /* __ANDROID_API__ >= 28 */
|
||||
|
||||
#undef __bos_fd_count_trivially_safe
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int fl
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
|
||||
"'recvfrom' called with size bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge(bos, len)) {
|
||||
|
@ -57,7 +57,7 @@ ssize_t sendto(int fd, const void* const buf __pass_object_size0, size_t len, in
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), len),
|
||||
"'sendto' called with size bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 25 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge(bos, len)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ mode_t umask(mode_t mode)
|
|||
__overloadable
|
||||
__enable_if(1, "")
|
||||
__clang_error_if(mode & ~0777, "'umask' called with invalid mode") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR2__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
return __umask_chk(mode);
|
||||
#else
|
||||
return __umask_real(mode);
|
||||
|
|
|
@ -36,7 +36,7 @@ size_t __fwrite_chk(const void*, size_t, size_t, FILE*, size_t) __INTRODUCED_IN(
|
|||
|
||||
#if defined(__BIONIC_FORTIFY) && !defined(__BIONIC_NO_STDIO_FORTIFY)
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
/* No diag -- clang diagnoses misuses of this on its own. */
|
||||
__BIONIC_FORTIFY_INLINE __printflike(3, 0)
|
||||
int vsnprintf(char* const __pass_object_size dest, size_t size, const char* format, va_list ap)
|
||||
|
@ -57,7 +57,7 @@ int sprintf(char* dest, const char* format)
|
|||
"format string will always overflow destination buffer")
|
||||
__errorattr("format string will always overflow destination buffer");
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
__BIONIC_FORTIFY_VARIADIC __printflike(2, 3)
|
||||
int sprintf(char* const __pass_object_size dest, const char* format, ...) __overloadable {
|
||||
va_list va;
|
||||
|
@ -90,7 +90,7 @@ size_t fread(void* const __pass_object_size0 buf, size_t size, size_t count, FIL
|
|||
"in call to 'fread', size * count overflows")
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
|
||||
"in call to 'fread', size * count is too large for the given buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_mul(bos, size, count)) {
|
||||
|
@ -107,7 +107,7 @@ size_t fwrite(const void* const __pass_object_size0 buf, size_t size, size_t cou
|
|||
"in call to 'fwrite', size * count overflows")
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos0(buf), size * count),
|
||||
"in call to 'fwrite', size * count is too large for the given buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_mul(bos, size, count)) {
|
||||
|
@ -124,7 +124,7 @@ char* fgets(char* const __pass_object_size dest, int size, FILE* stream)
|
|||
__clang_error_if(size < 0, "in call to 'fgets', size should not be negative")
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos(dest), size),
|
||||
"in call to 'fgets', size is larger than the destination buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(dest);
|
||||
|
||||
if (!__bos_dynamic_check_impl_and(bos, >=, (size_t)size, size >= 0)) {
|
||||
|
|
|
@ -40,7 +40,7 @@ size_t __strlcat_chk(char*, const char*, size_t, size_t) __INTRODUCED_IN(17);
|
|||
#if defined(__BIONIC_FORTIFY)
|
||||
extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr);
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
/* No diag -- clang diagnoses misuses of this on its own. */
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* memcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
|
||||
|
@ -64,7 +64,7 @@ void* memmove(void* const dst __pass_object_size0, const void* src, size_t len)
|
|||
#endif
|
||||
|
||||
#if defined(__USE_GNU)
|
||||
#if __ANDROID_API__ >= __ANDROID_API_R__
|
||||
#if __ANDROID_API__ >= 30
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* mempcpy(void* const dst __pass_object_size0, const void* src, size_t copy_amount)
|
||||
__overloadable
|
||||
|
@ -78,7 +78,7 @@ void* mempcpy(void* const dst __pass_object_size0, const void* src, size_t copy_
|
|||
#endif
|
||||
return __builtin_mempcpy(dst, src, copy_amount);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_R__ */
|
||||
#endif /* __ANDROID_API__ >= 30 */
|
||||
#endif /* __USE_GNU */
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
|
@ -86,7 +86,7 @@ char* stpcpy(char* const dst __pass_object_size, const char* src)
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
|
||||
"'stpcpy' called with string bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos_dst = __bos(dst);
|
||||
if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
|
||||
return __builtin___stpcpy_chk(dst, src, bos_dst);
|
||||
|
@ -100,7 +100,7 @@ char* strcpy(char* const dst __pass_object_size, const char* src)
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
|
||||
"'strcpy' called with string bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos_dst = __bos(dst);
|
||||
if (!__bos_trivially_gt(bos_dst, __builtin_strlen(src))) {
|
||||
return __builtin___strcpy_chk(dst, src, bos_dst);
|
||||
|
@ -114,14 +114,14 @@ char* strcat(char* const dst __pass_object_size, const char* src)
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_le(__bos(dst), __builtin_strlen(src)),
|
||||
"'strcat' called with string bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
return __builtin___strcat_chk(dst, src, __bos(dst));
|
||||
#else
|
||||
return __builtin_strcat(dst, src);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
/* No diag -- clang diagnoses misuses of this on its own. */
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* strncat(char* const dst __pass_object_size, const char* src, size_t n) __overloadable {
|
||||
|
@ -134,7 +134,7 @@ __BIONIC_FORTIFY_INLINE
|
|||
void* memset(void* const s __pass_object_size0, int c, size_t n) __overloadable
|
||||
/* If you're a user who wants this warning to go away: use `(&memset)(foo, bar, baz)`. */
|
||||
__clang_warning_if(c && !n, "'memset' will set 0 bytes; maybe the arguments got flipped?") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(s);
|
||||
if (!__bos_trivially_ge(bos, n)) {
|
||||
return __builtin___memset_chk(s, c, n, bos);
|
||||
|
@ -143,7 +143,7 @@ void* memset(void* const s __pass_object_size0, int c, size_t n) __overloadable
|
|||
return __builtin_memset(s, c, n);
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* memchr(const void* const s __pass_object_size, int c, size_t n) __overloadable {
|
||||
size_t bos = __bos(s);
|
||||
|
@ -167,7 +167,7 @@ void* __memrchr_fortify(const void* const __pass_object_size s, int c, size_t n)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
/* No diag -- clang diagnoses misuses of this on its own. */
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* stpncpy(char* const dst __pass_object_size, const char* const src __pass_object_size, size_t n)
|
||||
|
@ -204,7 +204,7 @@ size_t strlcpy(char* const dst __pass_object_size, const char* src, size_t size)
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
|
||||
"'strlcpy' called with size bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(dst);
|
||||
|
||||
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
|
||||
|
@ -219,7 +219,7 @@ size_t strlcat(char* const dst __pass_object_size, const char* src, size_t size)
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos(dst), size),
|
||||
"'strlcat' called with size bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(dst);
|
||||
|
||||
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
|
||||
|
@ -231,7 +231,7 @@ size_t strlcat(char* const dst __pass_object_size, const char* src, size_t size)
|
|||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
size_t strlen(const char* const s __pass_object_size0) __overloadable {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(s);
|
||||
|
||||
if (!__bos_trivially_gt(bos, __builtin_strlen(s))) {
|
||||
|
@ -243,7 +243,7 @@ size_t strlen(const char* const s __pass_object_size0) __overloadable {
|
|||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* strchr(const char* const s __pass_object_size, int c) __overloadable {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR2__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(s);
|
||||
|
||||
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
|
||||
|
@ -255,7 +255,7 @@ char* strchr(const char* const s __pass_object_size, int c) __overloadable {
|
|||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* strrchr(const char* const s __pass_object_size, int c) __overloadable {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR2__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 18 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(s);
|
||||
|
||||
if (bos != __BIONIC_FORTIFY_UNKNOWN_SIZE) {
|
||||
|
@ -265,7 +265,7 @@ char* strrchr(const char* const s __pass_object_size, int c) __overloadable {
|
|||
return __builtin_strrchr(s, c);
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if defined(__cplusplus)
|
||||
extern "C++" {
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
|
@ -284,6 +284,6 @@ void* memrchr(const void* const __pass_object_size s, int c, size_t n) __overloa
|
|||
return __memrchr_fortify(s, c, n);
|
||||
}
|
||||
#endif
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
|
||||
#endif /* __ANDROID_API__ >= 23 */
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
|
|
@ -33,7 +33,7 @@ void __bionic_bcopy(const void *src, void* const dst __pass_object_size0, size_t
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos0(dst), len),
|
||||
"'bcopy' called with size bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(dst);
|
||||
if (!__bos_trivially_ge(bos, len)) {
|
||||
__builtin___memmove_chk(dst, src, len, bos);
|
||||
|
@ -48,7 +48,7 @@ void __bionic_bzero(void* const b __pass_object_size0, size_t len)
|
|||
__overloadable
|
||||
__clang_error_if(__bos_unevaluated_lt(__bos0(b), len),
|
||||
"'bzero' called with size bigger than buffer") {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 17 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(b);
|
||||
if (!__bos_trivially_ge(bos, len)) {
|
||||
__builtin___memset_chk(b, 0, len, bos);
|
||||
|
|
|
@ -73,7 +73,7 @@ __BIONIC_FORTIFY_INLINE
|
|||
char* getcwd(char* const __pass_object_size buf, size_t size)
|
||||
__overloadable
|
||||
__error_if_overflows_objectsize(size, __bos(buf), getcwd) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(buf);
|
||||
|
||||
if (!__bos_trivially_ge(bos, size)) {
|
||||
|
@ -89,7 +89,7 @@ ssize_t pread(int fd, void* const __pass_object_size0 buf, size_t count, off_t o
|
|||
__overloadable
|
||||
__error_if_overflows_ssizet(count, pread)
|
||||
__error_if_overflows_objectsize(count, __bos0(buf), pread) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, count)) {
|
||||
|
@ -105,7 +105,7 @@ ssize_t pread64(int fd, void* const __pass_object_size0 buf, size_t count, off64
|
|||
__overloadable
|
||||
__error_if_overflows_ssizet(count, pread64)
|
||||
__error_if_overflows_objectsize(count, __bos0(buf), pread64) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, count)) {
|
||||
|
@ -121,7 +121,7 @@ ssize_t pwrite(int fd, const void* const __pass_object_size0 buf, size_t count,
|
|||
__overloadable
|
||||
__error_if_overflows_ssizet(count, pwrite)
|
||||
__error_if_overflows_objectsize(count, __bos0(buf), pwrite) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, count)) {
|
||||
|
@ -137,7 +137,7 @@ ssize_t pwrite64(int fd, const void* const __pass_object_size0 buf, size_t count
|
|||
__overloadable
|
||||
__error_if_overflows_ssizet(count, pwrite64)
|
||||
__error_if_overflows_objectsize(count, __bos0(buf), pwrite64) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, count)) {
|
||||
|
@ -152,7 +152,7 @@ ssize_t read(int fd, void* const __pass_object_size0 buf, size_t count)
|
|||
__overloadable
|
||||
__error_if_overflows_ssizet(count, read)
|
||||
__error_if_overflows_objectsize(count, __bos0(buf), read) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 21 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, count)) {
|
||||
|
@ -167,7 +167,7 @@ ssize_t write(int fd, const void* const __pass_object_size0 buf, size_t count)
|
|||
__overloadable
|
||||
__error_if_overflows_ssizet(count, write)
|
||||
__error_if_overflows_objectsize(count, __bos0(buf), write) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 24 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos0(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, count)) {
|
||||
|
@ -182,7 +182,7 @@ ssize_t readlink(const char* path, char* const __pass_object_size buf, size_t si
|
|||
__overloadable
|
||||
__error_if_overflows_ssizet(size, readlink)
|
||||
__error_if_overflows_objectsize(size, __bos(buf), readlink) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, size)) {
|
||||
|
@ -192,13 +192,13 @@ ssize_t readlink(const char* path, char* const __pass_object_size buf, size_t si
|
|||
return __call_bypassing_fortify(readlink)(path, buf, size);
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t readlinkat(int dirfd, const char* path, char* const __pass_object_size buf, size_t size)
|
||||
__overloadable
|
||||
__error_if_overflows_ssizet(size, readlinkat)
|
||||
__error_if_overflows_objectsize(size, __bos(buf), readlinkat) {
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__ && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
#if __ANDROID_API__ >= 23 && __BIONIC_FORTIFY_RUNTIME_CHECKS_ENABLED
|
||||
size_t bos = __bos(buf);
|
||||
|
||||
if (!__bos_trivially_ge_no_overflow(bos, size)) {
|
||||
|
@ -207,7 +207,7 @@ ssize_t readlinkat(int dirfd, const char* path, char* const __pass_object_size b
|
|||
#endif
|
||||
return __call_bypassing_fortify(readlinkat)(dirfd, path, buf, size);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
#endif /* __ANDROID_API__ >= 21 */
|
||||
|
||||
#undef __bos_trivially_ge_no_overflow
|
||||
#undef __enable_if_no_overflow_ssizet
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _BITS_PTHREAD_TYPES_H_
|
||||
#define _BITS_PTHREAD_TYPES_H_
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -44,7 +43,7 @@ typedef struct {
|
|||
#endif
|
||||
} pthread_attr_t;
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
#if __ANDROID_API__ >= 24
|
||||
typedef struct {
|
||||
#if defined(__LP64__)
|
||||
int64_t __private[4];
|
||||
|
@ -54,7 +53,7 @@ typedef struct {
|
|||
} pthread_barrier_t;
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
#if __ANDROID_API__ >= 24
|
||||
typedef int pthread_barrierattr_t;
|
||||
#endif
|
||||
|
||||
|
@ -92,7 +91,7 @@ typedef struct {
|
|||
|
||||
typedef long pthread_rwlockattr_t;
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
#if __ANDROID_API__ >= 24
|
||||
typedef struct {
|
||||
#if defined(__LP64__)
|
||||
int64_t __private;
|
||||
|
@ -103,5 +102,3 @@ typedef struct {
|
|||
#endif
|
||||
|
||||
typedef long pthread_t;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -103,7 +103,7 @@ __BIONIC_THREADS_INLINE int mtx_lock(mtx_t* __mtx) {
|
|||
return __bionic_thrd_error(pthread_mutex_lock(__mtx));
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
__BIONIC_THREADS_INLINE int mtx_timedlock(mtx_t* __mtx,
|
||||
const struct timespec* __timeout) {
|
||||
return __bionic_thrd_error(pthread_mutex_timedlock(__mtx, __timeout));
|
||||
|
|
|
@ -124,7 +124,7 @@ int toupper(int __ch);
|
|||
*/
|
||||
int _toupper(int __ch) __INTRODUCED_IN(21);
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
/** Like isalnum but with an ignored `locale_t`. */
|
||||
int isalnum_l(int __ch, locale_t __l) __INTRODUCED_IN(21);
|
||||
/** Like isalpha but with an ignored `locale_t`. */
|
||||
|
|
|
@ -66,7 +66,7 @@ __BEGIN_DECLS
|
|||
/** Flag for open(). */
|
||||
#define O_RSYNC O_SYNC
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
/** Flag for splice(). */
|
||||
#define SPLICE_F_MOVE 1
|
||||
/** Flag for splice(). */
|
||||
|
@ -77,7 +77,7 @@ __BEGIN_DECLS
|
|||
#define SPLICE_F_GIFT 8
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_O__
|
||||
#if __ANDROID_API__ >= 26
|
||||
/** Flag for sync_file_range(). */
|
||||
#define SYNC_FILE_RANGE_WAIT_BEFORE 1
|
||||
/** Flag for sync_file_range(). */
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
// fenv was always available on x86.
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__ || defined(__i386__)
|
||||
#if __ANDROID_API__ >= 21 || defined(__i386__)
|
||||
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 __exceptions) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IN_H_
|
||||
#define _NETINET_IN_H_
|
||||
#pragma once
|
||||
|
||||
#include <endian.h>
|
||||
#include <netinet/in6.h>
|
||||
|
@ -46,14 +45,12 @@ typedef uint16_t in_port_t;
|
|||
|
||||
int bindresvport(int __fd, struct sockaddr_in* __sin);
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
#if __ANDROID_API__ >= 24
|
||||
extern const struct in6_addr in6addr_any __INTRODUCED_IN(24);
|
||||
extern const struct in6_addr in6addr_loopback __INTRODUCED_IN(24);
|
||||
#else
|
||||
static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
|
||||
static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ enum {
|
|||
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP { { ((PTHREAD_MUTEX_ERRORCHECK & 3) << 14) } }
|
||||
|
||||
#define PTHREAD_COND_INITIALIZER { { 0 } }
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
#define PTHREAD_COND_INITIALIZER_MONOTONIC_NP { { 1 << 1 } }
|
||||
#endif
|
||||
|
||||
|
@ -67,7 +67,7 @@ enum {
|
|||
|
||||
#define PTHREAD_ONCE_INIT 0
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
#if __ANDROID_API__ >= 24
|
||||
#define PTHREAD_BARRIER_SERIAL_THREAD -1
|
||||
#endif
|
||||
|
||||
|
@ -254,20 +254,20 @@ 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__
|
||||
#if __ANDROID_API__ >= 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__
|
||||
#if __ANDROID_API__ >= 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__
|
||||
#if __ANDROID_API__ >= 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);
|
||||
|
|
|
@ -64,7 +64,7 @@ int sigaction64(int __signal, const struct sigaction64* __new_action, struct sig
|
|||
|
||||
int siginterrupt(int __signal, int __flag);
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
sighandler_t signal(int __signal, sighandler_t __handler) __INTRODUCED_IN(21);
|
||||
int sigaddset(sigset_t* __set, int __signal) __INTRODUCED_IN(21);
|
||||
int sigaddset64(sigset64_t* __set, int __signal) __INTRODUCED_IN(28);
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
#include <bits/seek_constants.h>
|
||||
|
||||
#if __ANDROID_API__ < __ANDROID_API_N__
|
||||
#if __ANDROID_API__ < 24
|
||||
#include <bits/struct_file.h>
|
||||
#endif
|
||||
|
||||
|
@ -58,7 +58,7 @@ typedef off64_t fpos64_t;
|
|||
struct __sFILE;
|
||||
typedef struct __sFILE FILE;
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
#if __ANDROID_API__ >= 23
|
||||
extern FILE* stdin __INTRODUCED_IN(23);
|
||||
extern FILE* stdout __INTRODUCED_IN(23);
|
||||
extern FILE* stderr __INTRODUCED_IN(23);
|
||||
|
|
|
@ -43,7 +43,7 @@ __BEGIN_DECLS
|
|||
|
||||
__noreturn void abort(void);
|
||||
__noreturn void exit(int __status);
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
__noreturn void _Exit(int __status) __INTRODUCED_IN(21);
|
||||
#else
|
||||
__noreturn void _Exit(int) __RENAME(_exit);
|
||||
|
@ -167,7 +167,7 @@ int wctomb(char* __dst, wchar_t __wc) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
|
|||
|
||||
size_t wcstombs(char* __dst, const wchar_t* __src, size_t __n);
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21);
|
||||
#define MB_CUR_MAX __ctype_get_mb_cur_max()
|
||||
#else
|
||||
|
@ -183,7 +183,7 @@ size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21);
|
|||
#include <bits/fortify/stdlib.h>
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_K__
|
||||
#if __ANDROID_API__ >= 19
|
||||
int abs(int __x) __attribute_const__ __INTRODUCED_IN(19);
|
||||
long labs(long __x) __attribute_const__ __INTRODUCED_IN(19);
|
||||
long long llabs(long long __x) __attribute_const__ __INTRODUCED_IN(19);
|
||||
|
@ -191,7 +191,7 @@ long long llabs(long long __x) __attribute_const__ __INTRODUCED_IN(19);
|
|||
// Implemented as static inlines before 19.
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
float strtof(const char* __s, char** __end_ptr) __INTRODUCED_IN(21);
|
||||
double atof(const char* __s) __attribute_pure__ __INTRODUCED_IN(21);
|
||||
int rand(void) __INTRODUCED_IN(21);
|
||||
|
@ -207,7 +207,7 @@ long double strtold_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODU
|
|||
// Implemented as static inlines before 21.
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_O__
|
||||
#if __ANDROID_API__ >= 26
|
||||
double strtod_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(26);
|
||||
float strtof_l(const char* __s, char** __end_ptr, locale_t __l) __INTRODUCED_IN(26);
|
||||
long strtol_l(const char* __s, char** __end_ptr, int, locale_t __l) __INTRODUCED_IN(26);
|
||||
|
|
|
@ -119,7 +119,7 @@ char* strsignal(int __signal);
|
|||
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__
|
||||
#if __ANDROID_API__ >= 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
|
||||
|
|
|
@ -63,7 +63,7 @@ static __inline__ __always_inline void __bionic_bzero(void* b, size_t len) {
|
|||
__builtin_memset(b, 0, len);
|
||||
}
|
||||
|
||||
#if !defined(__i386__) || __ANDROID_API__ >= __ANDROID_API_J_MR2__
|
||||
#if !defined(__i386__) || __ANDROID_API__ >= 18
|
||||
/**
|
||||
* [ffs(3)](http://man7.org/linux/man-pages/man3/ffs.3.html) finds the first set bit in `__i`.
|
||||
*
|
||||
|
|
|
@ -51,7 +51,7 @@ int epoll_create1(int __flags) __INTRODUCED_IN(21);
|
|||
* https://github.com/android-ndk/ndk/issues/302
|
||||
* https://github.com/android-ndk/ndk/issues/394
|
||||
*/
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__ && defined(EPOLL_CLOEXEC)
|
||||
#if __ANDROID_API__ < 21 && defined(EPOLL_CLOEXEC)
|
||||
#undef EPOLL_CLOEXEC
|
||||
#endif
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ __BEGIN_DECLS
|
|||
*
|
||||
* https://github.com/android-ndk/ndk/issues/394
|
||||
*/
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
#define IN_CLOEXEC O_CLOEXEC
|
||||
#define IN_NONBLOCK O_NONBLOCK
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ void* mmap(void* __addr, size_t __size, int __prot, int __flags, int __fd, off_t
|
|||
void* mmap(void* __addr, size_t __size, int __prot, int __flags, int __fd, off_t __offset);
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
/**
|
||||
* mmap64() is a variant of mmap() that takes a 64-bit offset even on LP32.
|
||||
*
|
||||
|
@ -173,7 +173,7 @@ int memfd_create(const char* __name, unsigned __flags) __INTRODUCED_IN(30);
|
|||
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
#if __ANDROID_API__ >= 23
|
||||
|
||||
/*
|
||||
* Some third-party code uses the existence of POSIX_MADV_NORMAL to detect the
|
||||
|
|
|
@ -79,7 +79,7 @@ int __FD_ISSET_chk(int, const fd_set*, size_t) __INTRODUCED_IN(21);
|
|||
#define __FD_SET(fd, set) (__FDS_BITS(fd_set*,set)[__FDELT(fd)] |= __FDMASK(fd))
|
||||
#define __FD_ISSET(fd, set) ((__FDS_BITS(const fd_set*,set)[__FDELT(fd)] & __FDMASK(fd)) != 0)
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
|
||||
/** Removes `fd` from the given set. Use <poll.h> instead. */
|
||||
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
|
||||
|
|
|
@ -112,7 +112,7 @@ struct cmsghdr {
|
|||
? (struct cmsghdr*) (msg)->msg_control : (struct cmsghdr*) NULL)
|
||||
#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__
|
||||
#if __ANDROID_API__ >= 21
|
||||
struct cmsghdr* __cmsg_nxthdr(struct msghdr* __msg, struct cmsghdr* __cmsg) __INTRODUCED_IN(21);
|
||||
#else
|
||||
/* TODO(danalbert): Move this into libandroid_support. */
|
||||
|
@ -127,7 +127,7 @@ static inline struct cmsghdr* __cmsg_nxthdr(struct msghdr* msg, struct cmsghdr*
|
|||
}
|
||||
return ptr;
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
#endif
|
||||
|
||||
#define SCM_RIGHTS 0x01
|
||||
#define SCM_CREDENTIALS 0x02
|
||||
|
|
|
@ -171,7 +171,7 @@ mode_t umask(mode_t __mask);
|
|||
#include <bits/fortify/stat.h>
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
int mkfifo(const char* __path, mode_t __mode) __INTRODUCED_IN(21);
|
||||
#else
|
||||
// Implemented as a static inline before 21.
|
||||
|
|
|
@ -40,7 +40,7 @@ __BEGIN_DECLS
|
|||
|
||||
pid_t wait(int* __status);
|
||||
pid_t waitpid(pid_t __pid, int* __status, int __options);
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
|
||||
#if __ANDROID_API__ >= 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.
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
// This file is implemented as static inlines before API level 21.
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,7 +78,7 @@ enum {
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_R__
|
||||
#if __ANDROID_API__ >= 30
|
||||
// This file is implemented as static inlines before API level 30.
|
||||
|
||||
/** Uses `__flag` to ensure that `__function` is called exactly once. */
|
||||
|
|
|
@ -78,7 +78,7 @@ char* strptime(const char* __s, const char* __fmt, struct tm* __tm) __strftimeli
|
|||
char* strptime_l(const char* __s, const char* __fmt, struct tm* __tm, locale_t __l) __strftimelike(2) __INTRODUCED_IN(28);
|
||||
|
||||
size_t strftime(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm) __strftimelike(3);
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
size_t strftime_l(char* __buf, size_t __n, const char* __fmt, const struct tm* __tm, locale_t __l) __strftimelike(3) __INTRODUCED_IN(21);
|
||||
#else
|
||||
// Implemented as static inline before 21.
|
||||
|
|
|
@ -282,7 +282,7 @@ int ttyname_r(int __fd, char* __buf, size_t __buf_size);
|
|||
|
||||
int acct(const char* __path);
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 21
|
||||
int getpagesize(void) __INTRODUCED_IN(21);
|
||||
#else
|
||||
static __inline__ int getpagesize(void) {
|
||||
|
|
|
@ -121,7 +121,7 @@ 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__
|
||||
#if __ANDROID_API__ >= 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);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#if __ANDROID_API__ >= 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);
|
||||
|
|
|
@ -209,7 +209,7 @@ static bool is_greylisted(android_namespace_t* ns, const char* name, const soinf
|
|||
};
|
||||
|
||||
// If you're targeting N, you don't get the greylist.
|
||||
if (g_greylist_disabled || get_application_target_sdk_version() >= __ANDROID_API_N__) {
|
||||
if (g_greylist_disabled || get_application_target_sdk_version() >= 24) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ static bool translateSystemPathToApexPath(const char* name, std::string* out_nam
|
|||
// New mapping for new apex should be added below
|
||||
|
||||
// Nothing to do if target sdk version is Q or above
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_Q__) {
|
||||
if (get_application_target_sdk_version() >= 29) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -943,8 +943,7 @@ static const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns,
|
|||
// Do not skip RTLD_LOCAL libraries in dlsym(RTLD_DEFAULT, ...)
|
||||
// if the library is opened by application with target api level < M.
|
||||
// See http://b/21565766
|
||||
if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 &&
|
||||
si->get_target_sdk_version() >= __ANDROID_API_M__) {
|
||||
if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 && si->get_target_sdk_version() >= 23) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1232,10 +1231,10 @@ const char* fix_dt_needed(const char* dt_needed, const char* sopath __unused) {
|
|||
#if !defined(__LP64__)
|
||||
// Work around incorrect DT_NEEDED entries for old apps: http://b/21364029
|
||||
int app_target_api_level = get_application_target_sdk_version();
|
||||
if (app_target_api_level < __ANDROID_API_M__) {
|
||||
if (app_target_api_level < 23) {
|
||||
const char* bname = basename(dt_needed);
|
||||
if (bname != dt_needed) {
|
||||
DL_WARN_documented_change(__ANDROID_API_M__,
|
||||
DL_WARN_documented_change(23,
|
||||
"invalid-dt_needed-entries-enforced-for-api-level-23",
|
||||
"library \"%s\" has invalid DT_NEEDED entry \"%s\"",
|
||||
sopath, dt_needed, app_target_api_level);
|
||||
|
@ -1384,7 +1383,7 @@ static bool load_library(android_namespace_t* ns,
|
|||
const soinfo* needed_or_dlopened_by = task->get_needed_by();
|
||||
const char* sopath = needed_or_dlopened_by == nullptr ? "(unknown)" :
|
||||
needed_or_dlopened_by->get_realpath();
|
||||
DL_WARN_documented_change(__ANDROID_API_N__,
|
||||
DL_WARN_documented_change(24,
|
||||
"private-api-enforced-for-api-level-24",
|
||||
"library \"%s\" (\"%s\") needed or dlopened by \"%s\" "
|
||||
"is not accessible by namespace \"%s\"",
|
||||
|
@ -3832,9 +3831,9 @@ bool soinfo::prelink_image() {
|
|||
if (soname_ == nullptr &&
|
||||
this != solist_get_somain() &&
|
||||
(flags_ & FLAG_LINKER) == 0 &&
|
||||
get_application_target_sdk_version() < __ANDROID_API_M__) {
|
||||
get_application_target_sdk_version() < 23) {
|
||||
soname_ = basename(realpath_.c_str());
|
||||
DL_WARN_documented_change(__ANDROID_API_M__,
|
||||
DL_WARN_documented_change(23,
|
||||
"missing-soname-enforced-for-api-level-23",
|
||||
"\"%s\" has no DT_SONAME (will use %s instead)",
|
||||
get_realpath(), soname_);
|
||||
|
@ -3875,7 +3874,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
|
|||
if (has_text_relocations) {
|
||||
// Fail if app is targeting M or above.
|
||||
int app_target_api_level = get_application_target_sdk_version();
|
||||
if (app_target_api_level >= __ANDROID_API_M__) {
|
||||
if (app_target_api_level >= 23) {
|
||||
DL_ERR_AND_LOG("\"%s\" has text relocations (https://android.googlesource.com/platform/"
|
||||
"bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-"
|
||||
"Enforced-for-API-level-23)", get_realpath());
|
||||
|
@ -3883,7 +3882,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
|
|||
}
|
||||
// Make segments writable to allow text relocations to work properly. We will later call
|
||||
// phdr_table_protect_segments() after all of them are applied.
|
||||
DL_WARN_documented_change(__ANDROID_API_M__,
|
||||
DL_WARN_documented_change(23,
|
||||
"Text-Relocations-Enforced-for-API-level-23",
|
||||
"\"%s\" has text relocations",
|
||||
get_realpath());
|
||||
|
|
|
@ -264,12 +264,12 @@ bool ElfReader::VerifyElfHeader() {
|
|||
|
||||
if (header_.e_shentsize != sizeof(ElfW(Shdr))) {
|
||||
// Fail if app is targeting Android O or above
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
|
||||
if (get_application_target_sdk_version() >= 26) {
|
||||
DL_ERR_AND_LOG("\"%s\" has unsupported e_shentsize: 0x%x (expected 0x%zx)",
|
||||
name_.c_str(), header_.e_shentsize, sizeof(ElfW(Shdr)));
|
||||
return false;
|
||||
}
|
||||
DL_WARN_documented_change(__ANDROID_API_O__,
|
||||
DL_WARN_documented_change(26,
|
||||
"invalid-elf-header_section-headers-enforced-for-api-level-26",
|
||||
"\"%s\" has unsupported e_shentsize 0x%x (expected 0x%zx)",
|
||||
name_.c_str(), header_.e_shentsize, sizeof(ElfW(Shdr)));
|
||||
|
@ -278,12 +278,12 @@ bool ElfReader::VerifyElfHeader() {
|
|||
|
||||
if (header_.e_shstrndx == 0) {
|
||||
// Fail if app is targeting Android O or above
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
|
||||
if (get_application_target_sdk_version() >= 26) {
|
||||
DL_ERR_AND_LOG("\"%s\" has invalid e_shstrndx", name_.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
DL_WARN_documented_change(__ANDROID_API_O__,
|
||||
DL_WARN_documented_change(26,
|
||||
"invalid-elf-header_section-headers-enforced-for-api-level-26",
|
||||
"\"%s\" has invalid e_shstrndx", name_.c_str());
|
||||
add_dlwarning(name_.c_str(), "has invalid ELF header");
|
||||
|
@ -392,7 +392,7 @@ bool ElfReader::ReadDynamicSection() {
|
|||
}
|
||||
|
||||
if (pt_dynamic_offset != dynamic_shdr->sh_offset) {
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
|
||||
if (get_application_target_sdk_version() >= 26) {
|
||||
DL_ERR_AND_LOG("\"%s\" .dynamic section has invalid offset: 0x%zx, "
|
||||
"expected to match PT_DYNAMIC offset: 0x%zx",
|
||||
name_.c_str(),
|
||||
|
@ -400,7 +400,7 @@ bool ElfReader::ReadDynamicSection() {
|
|||
pt_dynamic_offset);
|
||||
return false;
|
||||
}
|
||||
DL_WARN_documented_change(__ANDROID_API_O__,
|
||||
DL_WARN_documented_change(26,
|
||||
"invalid-elf-header_section-headers-enforced-for-api-level-26",
|
||||
"\"%s\" .dynamic section has invalid offset: 0x%zx "
|
||||
"(expected to match PT_DYNAMIC offset 0x%zx)",
|
||||
|
@ -411,7 +411,7 @@ bool ElfReader::ReadDynamicSection() {
|
|||
}
|
||||
|
||||
if (pt_dynamic_filesz != dynamic_shdr->sh_size) {
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
|
||||
if (get_application_target_sdk_version() >= 26) {
|
||||
DL_ERR_AND_LOG("\"%s\" .dynamic section has invalid size: 0x%zx, "
|
||||
"expected to match PT_DYNAMIC filesz: 0x%zx",
|
||||
name_.c_str(),
|
||||
|
@ -419,7 +419,7 @@ bool ElfReader::ReadDynamicSection() {
|
|||
pt_dynamic_filesz);
|
||||
return false;
|
||||
}
|
||||
DL_WARN_documented_change(__ANDROID_API_O__,
|
||||
DL_WARN_documented_change(26,
|
||||
"invalid-elf-header_section-headers-enforced-for-api-level-26",
|
||||
"\"%s\" .dynamic section has invalid size: 0x%zx "
|
||||
"(expected to match PT_DYNAMIC filesz 0x%zx)",
|
||||
|
@ -635,11 +635,11 @@ bool ElfReader::LoadSegments() {
|
|||
int prot = PFLAGS_TO_PROT(phdr->p_flags);
|
||||
if ((prot & (PROT_EXEC | PROT_WRITE)) == (PROT_EXEC | PROT_WRITE)) {
|
||||
// W + E PT_LOAD segments are not allowed in O.
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
|
||||
if (get_application_target_sdk_version() >= 26) {
|
||||
DL_ERR_AND_LOG("\"%s\": W+E load segments are not allowed", name_.c_str());
|
||||
return false;
|
||||
}
|
||||
DL_WARN_documented_change(__ANDROID_API_O__,
|
||||
DL_WARN_documented_change(26,
|
||||
"writable-and-executable-segments-enforced-for-api-level-26",
|
||||
"\"%s\" has load segments that are both writable and executable",
|
||||
name_.c_str());
|
||||
|
|
|
@ -754,7 +754,7 @@ uintptr_t soinfo::get_handle() const {
|
|||
}
|
||||
|
||||
void* soinfo::to_handle() {
|
||||
if (get_application_target_sdk_version() < __ANDROID_API_N__ || !has_min_version(3)) {
|
||||
if (get_application_target_sdk_version() < 24 || !has_min_version(3)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -230,9 +230,9 @@ TEST(dlext, android_dlopen_ext_force_load_soname_exception) {
|
|||
dlclose(handle);
|
||||
}
|
||||
|
||||
TEST(dlfcn, dlopen_from_nullptr_android_api_level) {
|
||||
TEST(dlfcn, dlopen_from_nullptr_android_api_level_28) {
|
||||
// Regression test for http://b/123972211. Testing dlopen(nullptr) when target sdk is P
|
||||
android_set_application_target_sdk_version(__ANDROID_API_P__);
|
||||
android_set_application_target_sdk_version(28);
|
||||
ASSERT_TRUE(dlopen(nullptr, RTLD_NOW) != nullptr);
|
||||
}
|
||||
|
||||
|
@ -1229,7 +1229,7 @@ TEST(dlext, ns_greylist_enabled) {
|
|||
extinfo.library_namespace = ns;
|
||||
|
||||
// An app targeting M can open libnativehelper.so because it's on the greylist.
|
||||
android_set_application_target_sdk_version(__ANDROID_API_M__);
|
||||
android_set_application_target_sdk_version(23);
|
||||
void* handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
|
||||
ASSERT_TRUE(handle != nullptr) << dlerror();
|
||||
|
||||
|
@ -1241,7 +1241,7 @@ TEST(dlext, ns_greylist_enabled) {
|
|||
dlclose(handle);
|
||||
|
||||
// An app targeting N no longer has the greylist.
|
||||
android_set_application_target_sdk_version(__ANDROID_API_N__);
|
||||
android_set_application_target_sdk_version(24);
|
||||
handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
|
||||
ASSERT_TRUE(handle == nullptr);
|
||||
ASSERT_STREQ("dlopen failed: library \"libnativehelper.so\" not found", dlerror());
|
||||
|
@ -1266,7 +1266,7 @@ TEST(dlext, ns_greylist_disabled_by_default) {
|
|||
extinfo.flags = ANDROID_DLEXT_USE_NAMESPACE;
|
||||
extinfo.library_namespace = ns;
|
||||
|
||||
android_set_application_target_sdk_version(__ANDROID_API_M__);
|
||||
android_set_application_target_sdk_version(23);
|
||||
void* handle = android_dlopen_ext("libnativehelper.so", RTLD_NOW, &extinfo);
|
||||
ASSERT_TRUE(handle == nullptr);
|
||||
ASSERT_STREQ("dlopen failed: library \"libnativehelper.so\" not found", dlerror());
|
||||
|
@ -2063,7 +2063,7 @@ TEST(dlext, dlopen_handle_value_platform) {
|
|||
}
|
||||
|
||||
TEST(dlext, dlopen_handle_value_app_compat) {
|
||||
android_set_application_target_sdk_version(__ANDROID_API_M__);
|
||||
android_set_application_target_sdk_version(23);
|
||||
void* handle = dlopen("libtest_dlsym_from_this.so", RTLD_NOW | RTLD_LOCAL);
|
||||
ASSERT_TRUE(reinterpret_cast<uintptr_t>(handle) % sizeof(uintptr_t) == 0)
|
||||
<< "dlopen should return valid pointer";
|
||||
|
|
|
@ -407,7 +407,7 @@ static void expect_ids(T ids, bool is_group) {
|
|||
|
||||
// TODO(73062966): We still don't have a good way to create vendor AIDs in the system or other
|
||||
// non-vendor partitions, therefore we keep this check disabled.
|
||||
if (android::base::GetIntProperty("ro.product.first_api_level", 0) <= __ANDROID_API_Q__) {
|
||||
if (android::base::GetIntProperty("ro.product.first_api_level", 0) <= 29) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ static void* SemWaitEINTRThreadFn(void* arg) {
|
|||
|
||||
TEST(semaphore, sem_wait_no_EINTR_in_sdk_less_equal_than_23) {
|
||||
#if defined(__BIONIC__)
|
||||
android_set_application_target_sdk_version(__ANDROID_API_M__);
|
||||
android_set_application_target_sdk_version(23);
|
||||
sem_t s;
|
||||
ASSERT_EQ(0, sem_init(&s, 0, 0));
|
||||
ScopedSignalHandler handler(SIGUSR1, sem_wait_test_signal_handler);
|
||||
|
|
Loading…
Reference in a new issue