57 lines
1.5 KiB
Diff
57 lines
1.5 KiB
Diff
From 6b189642454c56930662140e26bab8f6deb0aec9 Mon Sep 17 00:00:00 2001
|
|
From: Wim Taymans <wtaymans@redhat.com>
|
|
Date: Fri, 24 Nov 2017 17:23:40 +0100
|
|
Subject: [PATCH] Only define memfd_create when not already defined
|
|
|
|
---
|
|
config.h.meson | 1 +
|
|
meson.build | 2 ++
|
|
src/pipewire/memfd-wrappers.h | 2 ++
|
|
3 files changed, 5 insertions(+)
|
|
|
|
diff --git a/config.h.meson b/config.h.meson
|
|
index 0d5add7..e0ff4f6 100644
|
|
--- a/config.h.meson
|
|
+++ b/config.h.meson
|
|
@@ -445,3 +445,4 @@
|
|
#mesondefine HAVE_ALARM
|
|
#mesondefine HAVE_DECL_LOCALTIME_R
|
|
#mesondefine HAVE_DECL_STRSIGNAL
|
|
+#mesondefine HAVE_MEMFD_CREATE
|
|
diff --git a/meson.build b/meson.build
|
|
index de73426..59f6242 100644
|
|
--- a/meson.build
|
|
+++ b/meson.build
|
|
@@ -117,6 +117,8 @@ if cc.has_function('mkstemp', prefix : '#include <stdlib.h>')
|
|
cdata.set('HAVE_MKSTEMP', 1)
|
|
endif
|
|
|
|
+cdata.set('HAVE_MEMFD_CREATE', 1)
|
|
+
|
|
configure_file(input : 'config.h.meson',
|
|
output : 'config.h',
|
|
configuration : cdata)
|
|
diff --git a/src/pipewire/memfd-wrappers.h b/src/pipewire/memfd-wrappers.h
|
|
index 05958fe..860e396 100644
|
|
--- a/src/pipewire/memfd-wrappers.h
|
|
+++ b/src/pipewire/memfd-wrappers.h
|
|
@@ -20,6 +20,7 @@
|
|
#include <sys/syscall.h>
|
|
#include <fcntl.h>
|
|
|
|
+#ifndef HAVE_MEMFD_CREATE
|
|
/*
|
|
* No glibc wrappers exist for memfd_create(2), so provide our own.
|
|
*
|
|
@@ -32,6 +33,7 @@ static inline int
|
|
memfd_create(const char *name, unsigned int flags) {
|
|
return syscall(SYS_memfd_create, name, flags);
|
|
}
|
|
+#endif
|
|
|
|
/* memfd_create(2) flags */
|
|
|
|
--
|
|
2.14.3
|
|
|