v3d/tex: don't configure tmu config 1 if not needed
[mesa.git] / src / util / anon_file.c
index c05ed94fdfef5f5556a8d51c082eba7e8e9f84e2..bd415adb647787bd36c7a404fa1724f07dca3653 100644 (file)
@@ -27,7 +27,7 @@
  * Based on weston shared/os-compatibility.c
  */
 
-#ifndef WIN32
+#ifndef _WIN32
 #include "anon_file.h"
 
 #include <unistd.h>
 
 #ifdef __FreeBSD__
 #include <sys/mman.h>
-#elif defined(HAVE_MEMFD_CREATE)
+#elif defined(HAVE_MEMFD_CREATE) || defined(ANDROID)
 #include <sys/syscall.h>
 #include <linux/memfd.h>
+#include <stdlib.h>
 #else
 #include <stdio.h>
 #include <stdlib.h>
 #endif
 
-#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(HAVE_MKOSTEMP))
+#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(HAVE_MKOSTEMP) || defined(ANDROID))
 static int
 set_cloexec_or_close(int fd)
 {
@@ -68,7 +69,7 @@ err:
 }
 #endif
 
-#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE))
+#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(ANDROID))
 static int
 create_tmpfile_cloexec(char *tmpname)
 {
@@ -112,13 +113,13 @@ create_tmpfile_cloexec(char *tmpname)
  * SCM_RIGHTS methods.
  */
 int
-os_create_anonymous_file(off_t size, char *debug_name)
+os_create_anonymous_file(off_t size, const char *debug_name)
 {
    int fd, ret;
 #ifdef __FreeBSD__
    (void*)debug_name;
    fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0600);
-#elif defined(HAVE_MEMFD_CREATE)
+#elif defined(HAVE_MEMFD_CREATE) || defined(ANDROID)
    if (!debug_name)
       debug_name = "mesa-shared";
    fd = syscall(SYS_memfd_create, debug_name, MFD_CLOEXEC);