Add and use constants for the Android API levels.
Test: bionic tests still pass Change-Id: If1b619cfc9db1d3f5d91f14f2ace71058dca0c4a
This commit is contained in:
parent
8945d5e43a
commit
5bc78c8bcd
32 changed files with 97 additions and 87 deletions
|
@ -222,7 +222,7 @@ int sem_wait(sem_t* sem) {
|
|||
}
|
||||
|
||||
int result = __futex_wait_ex(sem_count_ptr, shared, shared | SEMCOUNT_MINUS_ONE, false, nullptr);
|
||||
if (bionic_get_application_target_sdk_version() > 23) {
|
||||
if (bionic_get_application_target_sdk_version() >= __ANDROID_API_N__) {
|
||||
if (result ==-EINTR) {
|
||||
errno = EINTR;
|
||||
return -1;
|
||||
|
|
|
@ -43,4 +43,17 @@
|
|||
#define __ANDROID_API__ __ANDROID_API_FUTURE__
|
||||
#endif
|
||||
|
||||
#define __ANDROID_API_G__ 9
|
||||
#define __ANDROID_API_I__ 14
|
||||
#define __ANDROID_API_J__ 16
|
||||
#define __ANDROID_API_J_MR1__ 17
|
||||
#define __ANDROID_API_J_MR2__ 18
|
||||
#define __ANDROID_API_K__ 19
|
||||
#define __ANDROID_API_L__ 21
|
||||
#define __ANDROID_API_L_MR1__ 22
|
||||
#define __ANDROID_API_M__ 23
|
||||
#define __ANDROID_API_N__ 24
|
||||
#define __ANDROID_API_N_MR1__ 25
|
||||
#define __ANDROID_API_O__ 26
|
||||
|
||||
#endif /* ANDROID_API_LEVEL_H */
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <errno.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < 21
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <fenv.h>
|
||||
|
||||
#if __ANDROID_API__ < 21 && defined(__arm__)
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__ && defined(__arm__)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -149,6 +149,6 @@ static __inline int fegetexcept(void) {
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < 21 && defined(__arm__) */
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_L__ && defined(__arm__) */
|
||||
|
||||
#endif /* ANDROID_LEGACY_FENV_INLINES_ARM_H */
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <fenv.h>
|
||||
|
||||
#if __ANDROID_API__ < 21 && (defined(__mips__) && !defined(__LP64__))
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__ && (defined(__mips__) && !defined(__LP64__))
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -163,6 +163,6 @@ static __inline int fegetexcept(void) {
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < 21 && (defined(__mips__) && !defined(__LP64__)) */
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_L__ && (defined(__mips__) && !defined(__LP64__)) */
|
||||
|
||||
#endif /* ANDROID_LEGACY_FENV_INLINES_MIPS_H */
|
||||
|
|
|
@ -39,7 +39,7 @@ __BEGIN_DECLS
|
|||
|
||||
sighandler_t bsd_signal(int signum, sighandler_t handler) __REMOVED_IN(21);
|
||||
|
||||
#if __ANDROID_API__ < 21
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
|
||||
static __inline int sigismember(const sigset_t *set, int signum) {
|
||||
/* Signal numbers start at 1, but bit positions start at 0. */
|
||||
|
@ -98,7 +98,7 @@ static __inline sighandler_t signal(int s, sighandler_t f) {
|
|||
return bsd_signal(s, f);
|
||||
}
|
||||
|
||||
#endif /* __ANDROID_API__ < 21 */
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_L__ */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __ANDROID_API__ < 21
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if __ANDROID_API__ < 21
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if __ANDROID_API__ < 18
|
||||
#if __ANDROID_API__ < __ANDROID_API_J_MR2__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -44,6 +44,6 @@ static __inline pid_t wait4(pid_t pid, int* status, int options, struct rusage*
|
|||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __ANDROID_API__ < 18 */
|
||||
#endif /* __ANDROID_API__ < __ANDROID_API_J_MR2__ */
|
||||
|
||||
#endif /* _ANDROID_LEGACY_SYS_WAIT_INLINES_H_ */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <linux/termios.h>
|
||||
|
||||
#if __ANDROID_API__ < 21
|
||||
#if __ANDROID_API__ < __ANDROID_API_L__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ int isxdigit(int);
|
|||
int tolower(int);
|
||||
int toupper(int);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
int isalnum_l(int, locale_t) __INTRODUCED_IN(21);
|
||||
int isalpha_l(int, locale_t) __INTRODUCED_IN(21);
|
||||
int isblank_l(int, locale_t) __INTRODUCED_IN(21);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
// fenv was always available on x86.
|
||||
#if __ANDROID_API__ >= 21 || defined(__i386__)
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__ || defined(__i386__)
|
||||
int feclearexcept(int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21) __INTRODUCED_IN_X86(9);
|
||||
int fegetexceptflag(fexcept_t*, int) __INTRODUCED_IN_ARM(21) __INTRODUCED_IN_MIPS(21)
|
||||
__INTRODUCED_IN_X86(9);
|
||||
|
|
|
@ -47,13 +47,13 @@ typedef uint32_t in_addr_t;
|
|||
|
||||
int bindresvport(int, struct sockaddr_in*);
|
||||
|
||||
#if __ANDROID_API__ >= 24
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
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__ >= 24 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ __errordecl(__ppoll_too_small_error, "ppoll: pollfd array smaller than fd count"
|
|||
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
#if __ANDROID_API__ >= 23
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
int poll(struct pollfd* fds, nfds_t fd_count, int timeout) {
|
||||
#if defined(__clang__)
|
||||
|
@ -85,7 +85,7 @@ int ppoll(struct pollfd* fds, nfds_t fd_count, const struct timespec* timeout, c
|
|||
return __ppoll_real(fds, fd_count, timeout, mask);
|
||||
#endif
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 23 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ int sigaction(int, const struct sigaction*, struct sigaction*);
|
|||
|
||||
int siginterrupt(int, int);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
sighandler_t signal(int, sighandler_t) __INTRODUCED_IN(21);
|
||||
int sigaddset(sigset_t*, int) __INTRODUCED_IN(21);
|
||||
int sigdelset(sigset_t*, int) __INTRODUCED_IN(21);
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
#include <bits/seek_constants.h>
|
||||
|
||||
#if __ANDROID_API__ <= 23
|
||||
#if __ANDROID_API__ < __ANDROID_API_N__
|
||||
#include <bits/struct_file.h>
|
||||
#endif
|
||||
|
||||
|
@ -66,7 +66,7 @@ typedef off64_t fpos64_t;
|
|||
struct __sFILE;
|
||||
typedef struct __sFILE FILE;
|
||||
|
||||
#if __ANDROID_API__ >= 23
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
extern FILE* stdin __INTRODUCED_IN(23);
|
||||
extern FILE* stdout __INTRODUCED_IN(23);
|
||||
extern FILE* stderr __INTRODUCED_IN(23);
|
||||
|
@ -268,7 +268,7 @@ __errordecl(__fwrite_overflow, "fwrite called with overflowing size * count");
|
|||
|
||||
#if defined(__BIONIC_FORTIFY) && !defined(__BIONIC_NO_STDIO_FORTIFY)
|
||||
|
||||
#if __ANDROID_API__ >= 17
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
__printflike(3, 0) int vsnprintf(char* dest, size_t size, const char* _Nonnull format, __va_list ap) {
|
||||
return __builtin___vsnprintf_chk(dest, size, 0, __bos(dest), format, ap);
|
||||
|
@ -302,9 +302,9 @@ __printflike(2, 3) int sprintf(char* dest, const char* _Nonnull format, ...) {
|
|||
return __builtin___sprintf_chk(dest, 0, __bos(dest), format, __builtin_va_arg_pack());
|
||||
}
|
||||
#endif
|
||||
#endif /* __ANDROID_API__ >= 17 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
|
||||
|
||||
#if __ANDROID_API__ >= 24
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
size_t fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict stream) {
|
||||
size_t bos = __bos0(buf);
|
||||
|
@ -356,7 +356,7 @@ size_t fwrite(const void * __restrict buf, size_t size, size_t count, FILE * __r
|
|||
|
||||
return __fwrite_chk(buf, size, count, stream, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 24 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
|
||||
#if !defined(__clang__)
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ int wctomb(char*, wchar_t) __INTRODUCED_IN(21) __VERSIONER_NO_GUARD;
|
|||
|
||||
size_t wcstombs(char*, const wchar_t*, size_t);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
size_t __ctype_get_mb_cur_max(void) __INTRODUCED_IN(21);
|
||||
#define MB_CUR_MAX __ctype_get_mb_cur_max()
|
||||
#else
|
||||
|
@ -184,7 +184,7 @@ char* realpath(const char* path, char* resolved) {
|
|||
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
float strtof(const char*, char**) __INTRODUCED_IN(21);
|
||||
double atof(const char*) __attribute_pure__ __INTRODUCED_IN(21);
|
||||
int abs(int) __attribute_const__ __INTRODUCED_IN(21);
|
||||
|
|
|
@ -114,7 +114,7 @@ char* strsignal(int);
|
|||
int strcoll(const char* _Nonnull, const char* _Nonnull) __attribute_pure__;
|
||||
size_t strxfrm(char* __restrict, const char* _Nonnull __restrict, size_t);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
int strcoll_l(const char* _Nonnull, const char* _Nonnull, locale_t) __attribute_pure__ __INTRODUCED_IN(21);
|
||||
size_t strxfrm_l(char* __restrict, const char* _Nonnull __restrict, size_t, locale_t) __INTRODUCED_IN(21);
|
||||
#else
|
||||
|
@ -152,7 +152,7 @@ size_t __strlcat_chk(char* _Nonnull __restrict, const char* _Nonnull __restrict,
|
|||
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
#if __ANDROID_API__ >= 23
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* memchr(const void* s, int c, size_t n) {
|
||||
size_t bos = __bos(s);
|
||||
|
@ -194,9 +194,9 @@ void* memrchr(const void* s, int c, size_t n) {
|
|||
|
||||
return __memrchr_chk(s, c, n, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 23 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
|
||||
|
||||
#if __ANDROID_API__ >= 17
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* memcpy(void* _Nonnull __restrict dst, const void* _Nonnull __restrict src, size_t copy_amount) {
|
||||
return __builtin___memcpy_chk(dst, src, copy_amount, __bos0(dst));
|
||||
|
@ -206,23 +206,23 @@ __BIONIC_FORTIFY_INLINE
|
|||
void* memmove(void* _Nonnull dst, const void* _Nonnull src, size_t len) {
|
||||
return __builtin___memmove_chk(dst, src, len, __bos0(dst));
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 17 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* stpcpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src) {
|
||||
return __builtin___stpcpy_chk(dst, src, __bos(dst));
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 21 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
|
||||
#if __ANDROID_API__ >= 17
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* strcpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src) {
|
||||
return __builtin___strcpy_chk(dst, src, __bos(dst));
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 17 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* stpncpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src, size_t n) {
|
||||
size_t bos_dst = __bos(dst);
|
||||
|
@ -264,9 +264,9 @@ char* strncpy(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src
|
|||
|
||||
return __strncpy_chk2(dst, src, n, bos_dst, bos_src);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 21 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
|
||||
#if __ANDROID_API__ >= 17
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR1__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* strcat(char* _Nonnull __restrict dst, const char* _Nonnull __restrict src) {
|
||||
return __builtin___strcat_chk(dst, src, __bos(dst));
|
||||
|
@ -341,9 +341,9 @@ size_t strlen(const char* _Nonnull s) {
|
|||
|
||||
return __strlen_chk(s, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 17 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR1__ */
|
||||
|
||||
#if __ANDROID_API__ >= 18
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* strchr(const char* _Nonnull s, int c) {
|
||||
size_t bos = __bos(s);
|
||||
|
@ -381,7 +381,7 @@ char* strrchr(const char* _Nonnull s, int c) {
|
|||
|
||||
return __strrchr_chk(s, c, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 18 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ void __FD_CLR_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
|
|||
void __FD_SET_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
|
||||
int __FD_ISSET_chk(int, fd_set*, size_t) __INTRODUCED_IN(21);
|
||||
|
||||
#if defined(__BIONIC_FORTIFY) && __ANDROID_API__ >= 21
|
||||
#if defined(__BIONIC_FORTIFY) && __ANDROID_API__ >= __ANDROID_API_L__
|
||||
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
|
||||
#define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
|
||||
#define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
|
||||
|
|
|
@ -114,7 +114,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__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
struct cmsghdr* __cmsg_nxthdr(struct msghdr*, struct cmsghdr*) __INTRODUCED_IN(21);
|
||||
#else
|
||||
/* TODO(danalbert): Move this into libandroid_support. */
|
||||
|
@ -129,7 +129,7 @@ static inline struct cmsghdr* __cmsg_nxthdr(struct msghdr* msg, struct cmsghdr*
|
|||
}
|
||||
return ptr;
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 21 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
|
||||
#define SCM_RIGHTS 0x01
|
||||
#define SCM_CREDENTIALS 0x02
|
||||
|
@ -315,7 +315,7 @@ ssize_t __recvfrom_real(int, void*, size_t, int, struct sockaddr*, socklen_t*) _
|
|||
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
#if __ANDROID_API__ >= 24
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t recvfrom(int fd, void* buf, size_t len, int flags, struct sockaddr* src_addr, socklen_t* addr_len) {
|
||||
size_t bos = __bos0(buf);
|
||||
|
@ -336,7 +336,7 @@ ssize_t recvfrom(int fd, void* buf, size_t len, int flags, struct sockaddr* src_
|
|||
|
||||
return __recvfrom_chk(fd, buf, len, bos, flags, src_addr, addr_len);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 24 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t recv(int socket, void* buf, size_t len, int flags) {
|
||||
|
|
|
@ -169,7 +169,7 @@ __errordecl(__umask_invalid_mode, "umask called with invalid mode");
|
|||
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
#if __ANDROID_API__ >= 18
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
mode_t umask(mode_t mode) {
|
||||
#if !defined(__clang__)
|
||||
|
@ -182,11 +182,11 @@ mode_t umask(mode_t mode) {
|
|||
#endif
|
||||
return __umask_chk(mode);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 18 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
int mkfifo(const char*, mode_t) __INTRODUCED_IN(21);
|
||||
#else
|
||||
// Implemented as a static inline before 21.
|
||||
|
|
|
@ -51,7 +51,7 @@ __BEGIN_DECLS
|
|||
|
||||
pid_t wait(int*);
|
||||
pid_t waitpid(pid_t, int*, int);
|
||||
#if __ANDROID_API__ >= 18
|
||||
#if __ANDROID_API__ >= __ANDROID_API_J_MR2__
|
||||
pid_t wait4(pid_t, int*, int, struct rusage*) __INTRODUCED_IN(18);
|
||||
#else
|
||||
// Implemented as a static inline before 18.
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
// Implemented as static inlines before 21.
|
||||
speed_t cfgetispeed(const struct termios*) __INTRODUCED_IN(21);
|
||||
speed_t cfgetospeed(const struct termios*) __INTRODUCED_IN(21);
|
||||
|
|
|
@ -77,7 +77,7 @@ struct tm* gmtime_r(const time_t*, struct tm*);
|
|||
char* strptime(const char*, const char*, struct tm*);
|
||||
size_t strftime(char*, size_t, const char*, const struct tm*);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
size_t strftime_l(char*, size_t, const char*, const struct tm*, locale_t) __INTRODUCED_IN(21);
|
||||
#else
|
||||
// Implemented as static inline before 21.
|
||||
|
|
|
@ -169,7 +169,7 @@ off_t lseek(int __fd, off_t __offset, int __whence);
|
|||
|
||||
off64_t lseek64(int __fd, off64_t __offset, int __whence);
|
||||
|
||||
#if defined(__USE_FILE_OFFSET64) && __ANDROID_API__ >= 21
|
||||
#if defined(__USE_FILE_OFFSET64) && __ANDROID_API__ >= __ANDROID_API_L__
|
||||
int truncate(const char* __path, off_t __length) __RENAME(truncate64) __INTRODUCED_IN(21);
|
||||
ssize_t pread(int __fd, void* __buf, size_t __count, off_t __offset) __RENAME(pread64)
|
||||
__INTRODUCED_IN(12);
|
||||
|
@ -206,7 +206,7 @@ int ttyname_r(int __fd, char* __buf, size_t __buflen) __INTRODUCED_IN(8);
|
|||
|
||||
int acct(const char* __filepath);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
int getpagesize(void) __INTRODUCED_IN(21);
|
||||
#else
|
||||
static __inline__ int getpagesize(void) {
|
||||
|
@ -284,7 +284,7 @@ int setdomainname(const char*, size_t) __INTRODUCED_IN_FUTURE;
|
|||
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
#if __ANDROID_API__ >= 24
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* getcwd(char* buf, size_t size) {
|
||||
size_t bos = __bos(buf);
|
||||
|
@ -315,7 +315,7 @@ char* getcwd(char* buf, size_t size) {
|
|||
|
||||
return __getcwd_chk(buf, size, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 24 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
|
||||
#if defined(__USE_FILE_OFFSET64)
|
||||
#define __PREAD_PREFIX(x) __pread64_ ## x
|
||||
|
@ -323,7 +323,7 @@ char* getcwd(char* buf, size_t size) {
|
|||
#define __PREAD_PREFIX(x) __pread_ ## x
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= 23
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t pread(int fd, void* buf, size_t count, off_t offset) {
|
||||
size_t bos = __bos0(buf);
|
||||
|
@ -373,7 +373,7 @@ ssize_t pread64(int fd, void* buf, size_t count, off64_t offset) {
|
|||
|
||||
return __pread64_chk(fd, buf, count, offset, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 23 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
|
||||
|
||||
#if defined(__USE_FILE_OFFSET64)
|
||||
#define __PWRITE_PREFIX(x) __pwrite64_ ## x
|
||||
|
@ -381,7 +381,7 @@ ssize_t pread64(int fd, void* buf, size_t count, off64_t offset) {
|
|||
#define __PWRITE_PREFIX(x) __pwrite_ ## x
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= 24
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset) {
|
||||
size_t bos = __bos0(buf);
|
||||
|
@ -431,9 +431,9 @@ ssize_t pwrite64(int fd, const void* buf, size_t count, off64_t offset) {
|
|||
|
||||
return __pwrite64_chk(fd, buf, count, offset, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 24 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t read(int fd, void* buf, size_t count) {
|
||||
size_t bos = __bos0(buf);
|
||||
|
@ -458,9 +458,9 @@ ssize_t read(int fd, void* buf, size_t count) {
|
|||
|
||||
return __read_chk(fd, buf, count, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 21 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_L__ */
|
||||
|
||||
#if __ANDROID_API__ >= 24
|
||||
#if __ANDROID_API__ >= __ANDROID_API_N__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t write(int fd, const void* buf, size_t count) {
|
||||
size_t bos = __bos0(buf);
|
||||
|
@ -487,9 +487,9 @@ ssize_t write(int fd, const void* buf, size_t count) {
|
|||
|
||||
return __write_chk(fd, buf, count, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 24 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_N__ */
|
||||
|
||||
#if __ANDROID_API__ >= 23
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
ssize_t readlink(const char* path, char* buf, size_t size) {
|
||||
size_t bos = __bos(buf);
|
||||
|
@ -539,7 +539,7 @@ ssize_t readlinkat(int dirfd, const char* path, char* buf, size_t size) {
|
|||
|
||||
return __readlinkat_chk(dirfd, path, buf, size, bos);
|
||||
}
|
||||
#endif /* __ANDROID_API__ >= 23 */
|
||||
#endif /* __ANDROID_API__ >= __ANDROID_API_M__ */
|
||||
|
||||
#endif /* defined(__BIONIC_FORTIFY) */
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ wchar_t *wmemset(wchar_t *, wchar_t, size_t);
|
|||
int wprintf(const wchar_t *, ...);
|
||||
int wscanf(const wchar_t *, ...);
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
long long wcstoll_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21);
|
||||
unsigned long long wcstoull_l(const wchar_t*, wchar_t**, int, locale_t) __INTRODUCED_IN(21);
|
||||
long double wcstold_l(const wchar_t*, wchar_t**, locale_t) __INTRODUCED_IN(21);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __ANDROID_API__ >= 21
|
||||
#if __ANDROID_API__ >= __ANDROID_API_L__
|
||||
int iswalnum_l(wint_t, locale_t) __INTRODUCED_IN(21);
|
||||
int iswalpha_l(wint_t, locale_t) __INTRODUCED_IN(21);
|
||||
int iswblank_l(wint_t, locale_t) __INTRODUCED_IN(21);
|
||||
|
|
|
@ -154,8 +154,8 @@ static bool is_greylisted(const char* name, const soinfo* needed_by) {
|
|||
nullptr
|
||||
};
|
||||
|
||||
// limit greylisting to apps targeting sdk version 23 and below
|
||||
if (get_application_target_sdk_version() > 23) {
|
||||
// If you're targeting N, you don't get the greylist.
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_N__) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -776,9 +776,10 @@ static const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns,
|
|||
for (auto it = start, end = soinfo_list.end(); it != end; ++it) {
|
||||
soinfo* si = *it;
|
||||
// Do not skip RTLD_LOCAL libraries in dlsym(RTLD_DEFAULT, ...)
|
||||
// if the library is opened by application with target api level <= 22
|
||||
// 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() > 22) {
|
||||
if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0 &&
|
||||
si->get_target_sdk_version() >= __ANDROID_API_M__) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1032,7 @@ static int open_library(android_namespace_t* ns,
|
|||
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
|
||||
if (get_application_target_sdk_version() <= 22) {
|
||||
if (get_application_target_sdk_version() < __ANDROID_API_M__) {
|
||||
const char* bname = basename(dt_needed);
|
||||
if (bname != dt_needed) {
|
||||
DL_WARN("library \"%s\" has invalid DT_NEEDED entry \"%s\"", sopath, dt_needed);
|
||||
|
@ -3031,12 +3032,12 @@ bool soinfo::prelink_image() {
|
|||
// In the case when dt_soname is absent some apps stop working
|
||||
// because they can't find dt_needed library by soname.
|
||||
// This workaround should keep them working. (applies only
|
||||
// for apps targeting sdk version <=22). Make an exception for
|
||||
// for apps targeting sdk version < M). Make an exception for
|
||||
// the main executable and linker; they do not need to have dt_soname
|
||||
if (soname_ == nullptr &&
|
||||
this != solist_get_somain() &&
|
||||
(flags_ & FLAG_LINKER) == 0 &&
|
||||
get_application_target_sdk_version() <= 22) {
|
||||
get_application_target_sdk_version() < __ANDROID_API_M__) {
|
||||
soname_ = basename(realpath_.c_str());
|
||||
DL_WARN("%s: is missing DT_SONAME will use basename as a replacement: \"%s\"",
|
||||
get_realpath(), soname_);
|
||||
|
@ -3065,8 +3066,8 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
|
|||
|
||||
#if !defined(__LP64__)
|
||||
if (has_text_relocations) {
|
||||
// Fail if app is targeting sdk version > 22
|
||||
if (get_application_target_sdk_version() > 22) {
|
||||
// Fail if app is targeting M or above.
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_M__) {
|
||||
DL_ERR_AND_LOG("\"%s\" has text relocations", get_realpath());
|
||||
return false;
|
||||
}
|
||||
|
@ -3226,4 +3227,3 @@ void init_default_namespace() {
|
|||
|
||||
g_default_namespace.set_default_library_paths(std::move(ld_default_paths));
|
||||
};
|
||||
|
||||
|
|
|
@ -608,7 +608,7 @@ 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() > 25) {
|
||||
if (get_application_target_sdk_version() >= __ANDROID_API_O__) {
|
||||
DL_ERR_AND_LOG("\"%s\": W + E load segments are not allowed", name_.c_str());
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -726,7 +726,7 @@ uintptr_t soinfo::get_handle() const {
|
|||
}
|
||||
|
||||
void* soinfo::to_handle() {
|
||||
if (get_application_target_sdk_version() <= 23 || !has_min_version(3)) {
|
||||
if (get_application_target_sdk_version() < __ANDROID_API_N__ || !has_min_version(3)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -791,5 +791,3 @@ uint32_t SymbolName::gnu_hash() {
|
|||
|
||||
return gnu_hash_;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1191,10 +1191,9 @@ TEST(dlext, dlopen_handle_value_platform) {
|
|||
}
|
||||
|
||||
TEST(dlext, dlopen_handle_value_app_compat) {
|
||||
android_set_application_target_sdk_version(23);
|
||||
android_set_application_target_sdk_version(__ANDROID_API_M__);
|
||||
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";
|
||||
dlclose(handle);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,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(23U);
|
||||
android_set_application_target_sdk_version(__ANDROID_API_M__);
|
||||
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