summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRob Herring <[email protected]>2017-05-23 13:54:19 -0500
committerRob Herring <[email protected]>2017-05-25 15:00:34 -0500
commit51f9851753f7605eaa52a7a6982581455e1863ab (patch)
treebea84111b3c515fa1cb1fcff05a526c605390554 /src/gallium
parentd5a9365d460200ad643f1d39e5a47d148112f979 (diff)
gallium/os: use mmap64 for Android
Simplify the handling of mmap for Android by using mmap64 instead. mmap64 may have not existed for Android when this was written, but it's been around since 2013. Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Rob Herring <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/os/os_mman.h21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/gallium/auxiliary/os/os_mman.h b/src/gallium/auxiliary/os/os_mman.h
index 2ae0027c1c2..c7ef9d02170 100644
--- a/src/gallium/auxiliary/os/os_mman.h
+++ b/src/gallium/auxiliary/os/os_mman.h
@@ -45,30 +45,15 @@
# error Unsupported OS
#endif
-#if defined(PIPE_OS_ANDROID)
-# include <errno.h> /* for EINVAL */
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
#if defined(PIPE_OS_ANDROID) && !defined(__LP64__)
-
-extern void *__mmap2(void *, size_t, int, int, int, size_t);
-
-static inline void *os_mmap(void *addr, size_t length, int prot, int flags,
- int fd, loff_t offset)
-{
- /* offset must be aligned to 4096 (not necessarily the page size) */
- if (unlikely(offset & 4095)) {
- errno = EINVAL;
- return MAP_FAILED;
- }
-
- return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12));
-}
+/* 32-bit needs mmap64 for 64-bit offsets */
+# define os_mmap(addr, length, prot, flags, fd, offset) \
+ mmap64(addr, length, prot, flags, fd, offset)
# define os_munmap(addr, length) \
munmap(addr, length)