Stop squatting on `memfd_create`.
We can't add it to libc if you `#include <sys/mman.h>` and define your
own static inline version.
Nothing's setting HAVE_MEMFD_CREATE, and it seems like a lot of OSes are
supposed to be supported by this code, so let's just be direct.
Test: treehugger
Change-Id: I56d89def5ae0468b9a6147f93c64faed8b60ac9a
diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp
index 2663c65..bcef63c 100644
--- a/system/vulkan_enc/ResourceTracker.cpp
+++ b/system/vulkan_enc/ResourceTracker.cpp
@@ -123,9 +123,8 @@
#include "android/utils/tempfile.h"
#endif
-#ifndef HAVE_MEMFD_CREATE
static inline int
-memfd_create(const char *name, unsigned int flags) {
+inline_memfd_create(const char *name, unsigned int flags) {
#ifdef HOST_BUILD
TempFile* tmpFile = tempfile_create();
return open(tempfile_path(tmpFile), O_RDWR);
@@ -134,7 +133,7 @@
return syscall(SYS_memfd_create, name, flags);
#endif
}
-#endif // !HAVE_MEMFD_CREATE
+#define memfd_create inline_memfd_create
#endif // !VK_USE_PLATFORM_ANDROID_KHR
#define RESOURCE_TRACKER_DEBUG 0