From 1500d0e7a9c827ed284593b23117558cbdfed299 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Fri, 8 May 2020 00:08:03 -0700 Subject: [PATCH] Fix mac build. Add an inline for mmap64 to use on mac. Bug: 155662887 Bug: 156053599 Test: Builds. Change-Id: Id02e2c2f40acea2bdef604e9b80b70a85a941927 (cherry picked from commit 8a6dff22dc0cdc9b904072fa9ed2962b1cddb9fa) --- libutils/include/utils/Compat.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libutils/include/utils/Compat.h b/libutils/include/utils/Compat.h index dee577e36..60025678c 100644 --- a/libutils/include/utils/Compat.h +++ b/libutils/include/utils/Compat.h @@ -19,12 +19,20 @@ #include +#if !defined(__MINGW32__) +#include +#endif + #if defined(__APPLE__) /* Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */ - +static_assert(sizeof(off_t) >= 8, "This code requires that Mac OS have at least a 64-bit off_t."); typedef off_t off64_t; +static inline void* mmap64(void* addr, size_t length, int prot, int flags, int fd, off64_t offset) { + return mmap(addr, length, prot, flags, fd, offset); +} + static inline off64_t lseek64(int fd, off64_t offset, int whence) { return lseek(fd, offset, whence); }