mesa/util: use DETECT_OS_ANDROID in anon_file.c

glibc based Android build define ANDROID, but don't have
memfd headers.

Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26874>
This commit is contained in:
Gurchetan Singh
2023-10-02 19:42:26 -07:00
committed by Marge Bot
parent 1b133ad446
commit c860935501

View File

@@ -28,6 +28,7 @@
*/ */
#include "anon_file.h" #include "anon_file.h"
#include "detect_os.h"
#ifndef _WIN32 #ifndef _WIN32
@@ -38,7 +39,7 @@
#if defined(HAVE_MEMFD_CREATE) || defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(HAVE_MEMFD_CREATE) || defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/mman.h> #include <sys/mman.h>
#elif defined(ANDROID) #elif DETECT_OS_ANDROID
#include <sys/syscall.h> #include <sys/syscall.h>
#include <linux/memfd.h> #include <linux/memfd.h>
#else #else
@@ -120,7 +121,7 @@ os_create_anonymous_file(int64_t size, const char *debug_name)
if (!debug_name) if (!debug_name)
debug_name = "mesa-shared"; debug_name = "mesa-shared";
fd = memfd_create(debug_name, MFD_CLOEXEC | MFD_ALLOW_SEALING); fd = memfd_create(debug_name, MFD_CLOEXEC | MFD_ALLOW_SEALING);
#elif defined(ANDROID) #elif DETECT_OS_ANDROID
if (!debug_name) if (!debug_name)
debug_name = "mesa-shared"; debug_name = "mesa-shared";
fd = syscall(SYS_memfd_create, debug_name, MFD_CLOEXEC | MFD_ALLOW_SEALING); fd = syscall(SYS_memfd_create, debug_name, MFD_CLOEXEC | MFD_ALLOW_SEALING);