$OpenBSD: patch-glfw_backend_utils_c,v 1.1 2021/08/23 17:58:45 thfr Exp $

We don't have posix_fallocate.

Index: glfw/backend_utils.c
--- glfw/backend_utils.c.orig
+++ glfw/backend_utils.c
@@ -373,7 +373,7 @@ GLFWAPI char* utf_8_strndup(const char* source, size_t
  * receive SIGBUS on accessing mmap()'ed file contents instead.
  */
 int createAnonymousFile(off_t size) {
-    int ret, fd = -1, shm_anon = 0;
+    int ret, fd = -1;
 #ifdef HAS_MEMFD_CREATE
     fd = glfw_memfd_create("glfw-shared", MFD_CLOEXEC | MFD_ALLOW_SEALING);
     if (fd < 0) return -1;
@@ -383,10 +383,6 @@ int createAnonymousFile(off_t size) {
     // There is also no need to check for the return value, we couldn’t do
     // anything with it anyway.
     fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
-#elif defined(SHM_ANON)
-    fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);
-    if (fd < 0) return -1;
-    shm_anon = 1;
 #else
     static const char template[] = "/glfw-shared-XXXXXX";
     const char* path;
@@ -410,8 +406,7 @@ int createAnonymousFile(off_t size) {
     if (fd < 0)
         return -1;
 #endif
-    // posix_fallocate does not work on SHM descriptors
-    ret = shm_anon ? ftruncate(fd, size) : posix_fallocate(fd, 0, size);
+    ret = ftruncate(fd, size);
     if (ret != 0)
     {
         close(fd);
