* Based on weston shared/os-compatibility.c
*/
-#ifndef WIN32
+#ifndef _WIN32
#include "anon_file.h"
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <stdlib.h>
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/mman.h>
#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) || defined(ANDROID))
#ifdef __FreeBSD__
(void*)debug_name;
fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0600);
+#elif defined(__OpenBSD__)
+ char template[] = "/tmp/mesa-XXXXXXXXXX";
+ fd = shm_mkstemp(template);
+ if (fd != -1)
+ shm_unlink(template);
#elif defined(HAVE_MEMFD_CREATE) || defined(ANDROID)
if (!debug_name)
debug_name = "mesa-shared";