aboutsummaryrefslogtreecommitdiff
path: root/pgo
diff options
context:
space:
mode:
Diffstat (limited to 'pgo')
-rw-r--r--pgo/pgo.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pgo/pgo.c b/pgo/pgo.c
index 39c20de0..fa95a0ec 100644
--- a/pgo/pgo.c
+++ b/pgo/pgo.c
@@ -257,7 +257,16 @@ main(int argc, const char *const *argv)
close(fd);
+#if defined(MEMFD_CREATE)
int mem_fd = memfd_create("foot-pgo-ptmx", MFD_CLOEXEC);
+#elif defined(__FreeBSD__)
+ // memfd_create on FreeBSD 13 is SHM_ANON without sealing support
+ int mem_fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);
+#else
+ char name[] = "/tmp/foot-pgo-ptmx-XXXXXX";
+ int mem_fd = mkostemp(name, O_CLOEXEC);
+ unlink(name);
+#endif
if (mem_fd < 0) {
fprintf(stderr, "error: failed to create memory FD\n");
goto out;