mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
Only define memfd_create when not already defined
This commit is contained in:
parent
bde1012c5c
commit
2a86814bb8
3 changed files with 7 additions and 0 deletions
|
|
@ -445,3 +445,4 @@
|
||||||
#mesondefine HAVE_ALARM
|
#mesondefine HAVE_ALARM
|
||||||
#mesondefine HAVE_DECL_LOCALTIME_R
|
#mesondefine HAVE_DECL_LOCALTIME_R
|
||||||
#mesondefine HAVE_DECL_STRSIGNAL
|
#mesondefine HAVE_DECL_STRSIGNAL
|
||||||
|
#mesondefine HAVE_MEMFD_CREATE
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,10 @@ if cc.has_function('mkstemp', prefix : '#include <stdlib.h>')
|
||||||
cdata.set('HAVE_MKSTEMP', 1)
|
cdata.set('HAVE_MKSTEMP', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if cc.has_function('memfd_create', prefix : '#include <sys/mman.h>')
|
||||||
|
cdata.set('HAVE_MEMFD_CREATE', 1)
|
||||||
|
endif
|
||||||
|
|
||||||
configure_file(input : 'config.h.meson',
|
configure_file(input : 'config.h.meson',
|
||||||
output : 'config.h',
|
output : 'config.h',
|
||||||
configuration : cdata)
|
configuration : cdata)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifndef HAVE_MEMFD_CREATE
|
||||||
/*
|
/*
|
||||||
* No glibc wrappers exist for memfd_create(2), so provide our own.
|
* 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) {
|
memfd_create(const char *name, unsigned int flags) {
|
||||||
return syscall(SYS_memfd_create, name, flags);
|
return syscall(SYS_memfd_create, name, flags);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* memfd_create(2) flags */
|
/* memfd_create(2) flags */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue