summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-07-28 22:01:54 +0200
committerGitHub <noreply@github.com>2021-07-28 22:01:54 +0200
commitf771d92e443c048bdab26e4f72f4e8e6a931be73 (patch)
tree3bccb083394b222051583082680447d77a23c7aa
parentMerge pull request #6700 from lat9nq/fullscreen-enum (diff)
parenthost_memory: Add workaround for FreeBSD 12 (diff)
downloadyuzu-f771d92e443c048bdab26e4f72f4e8e6a931be73.tar
yuzu-f771d92e443c048bdab26e4f72f4e8e6a931be73.tar.gz
yuzu-f771d92e443c048bdab26e4f72f4e8e6a931be73.tar.bz2
yuzu-f771d92e443c048bdab26e4f72f4e8e6a931be73.tar.lz
yuzu-f771d92e443c048bdab26e4f72f4e8e6a931be73.tar.xz
yuzu-f771d92e443c048bdab26e4f72f4e8e6a931be73.tar.zst
yuzu-f771d92e443c048bdab26e4f72f4e8e6a931be73.zip
-rw-r--r--src/common/host_memory.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index 2a5a7596c..6661244cf 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -6,7 +6,7 @@
#include <windows.h>
#include "common/dynamic_library.h"
-#elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv
+#elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
@@ -343,7 +343,7 @@ private:
std::unordered_map<size_t, size_t> placeholder_host_pointers; ///< Placeholder backing offset
};
-#elif defined(__linux__) // ^^^ Windows ^^^ vvv Linux vvv
+#elif defined(__linux__) || defined(__FreeBSD__) // ^^^ Windows ^^^ vvv Linux vvv
class HostMemory::Impl {
public:
@@ -357,7 +357,12 @@ public:
});
// Backing memory initialization
+#if defined(__FreeBSD__) && __FreeBSD__ < 13
+ // XXX Drop after FreeBSD 12.* reaches EOL on 2024-06-30
+ fd = shm_open(SHM_ANON, O_RDWR, 0600);
+#else
fd = memfd_create("HostMemory", 0);
+#endif
if (fd == -1) {
LOG_CRITICAL(HW_Memory, "memfd_create failed: {}", strerror(errno));
throw std::bad_alloc{};