Fix boost build with unified headers.
boost (1.64.0 at least) assumes that if you have POSIX_MADV_NORMAL, you have posix_madvise. With unified headers, this isn't true. Rather than make life harder for projects that don't use configure, just make it so. We already applied similar workarounds for epoll_create1 and inotify_init1. Bug: https://github.com/android-ndk/ndk/issues/395 Test: built boost (long story!) Change-Id: I5d2d8de7b30921dde913251d35dcd249a2876f94
This commit is contained in:
parent
15eaaddef9
commit
2eab77e503
1 changed files with 18 additions and 6 deletions
|
@ -43,17 +43,12 @@ __BEGIN_DECLS
|
|||
#define MREMAP_MAYMOVE 1
|
||||
#define MREMAP_FIXED 2
|
||||
|
||||
#define POSIX_MADV_NORMAL MADV_NORMAL
|
||||
#define POSIX_MADV_RANDOM MADV_RANDOM
|
||||
#define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
|
||||
#define POSIX_MADV_WILLNEED MADV_WILLNEED
|
||||
#define POSIX_MADV_DONTNEED MADV_DONTNEED
|
||||
|
||||
#if defined(__USE_FILE_OFFSET64) && __ANDROID_API__ >= __ANDROID_API_L__
|
||||
void* mmap(void*, size_t, int, int, int, off_t) __RENAME(mmap64) __INTRODUCED_IN(21);
|
||||
#else
|
||||
void* mmap(void*, size_t, int, int, int, off_t);
|
||||
#endif
|
||||
|
||||
void* mmap64(void*, size_t, int, int, int, off64_t) __INTRODUCED_IN(21);
|
||||
|
||||
int munmap(void*, size_t);
|
||||
|
@ -63,12 +58,29 @@ void* mremap(void*, size_t, size_t, int, ...);
|
|||
|
||||
int mlockall(int) __INTRODUCED_IN(17);
|
||||
int munlockall(void) __INTRODUCED_IN(17);
|
||||
|
||||
int mlock(const void*, size_t);
|
||||
int munlock(const void*, size_t);
|
||||
|
||||
int mincore(void*, size_t, unsigned char*);
|
||||
|
||||
int madvise(void*, size_t, int);
|
||||
|
||||
#if __ANDROID_API__ >= __ANDROID_API_M__
|
||||
/*
|
||||
* Some third-party code uses the existence of POSIX_MADV_NORMAL to detect the
|
||||
* availability of posix_madvise. This is not correct, since having up-to-date
|
||||
* UAPI headers says nothing about the C library, but for the time being we
|
||||
* don't want to harm adoption to the unified headers.
|
||||
*
|
||||
* https://github.com/android-ndk/ndk/issues/395
|
||||
*/
|
||||
#define POSIX_MADV_NORMAL MADV_NORMAL
|
||||
#define POSIX_MADV_RANDOM MADV_RANDOM
|
||||
#define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
|
||||
#define POSIX_MADV_WILLNEED MADV_WILLNEED
|
||||
#define POSIX_MADV_DONTNEED MADV_DONTNEED
|
||||
#endif
|
||||
int posix_madvise(void*, size_t, int) __INTRODUCED_IN(23);
|
||||
|
||||
__END_DECLS
|
||||
|
|
Loading…
Reference in a new issue