summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/AnonymousBuffer.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-01-20 15:17:51 -0500
committerAndreas Kling <kling@serenityos.org>2021-01-20 23:41:38 +0100
commit65570216b406f7f71c96ddbafb10ee766b1a8ee5 (patch)
tree60ab049dc76f3fde919307e0130c7ee676322b5b /Userland/Libraries/LibCore/AnonymousBuffer.cpp
parent57ca15f126ad5886df1f0e1c6771a1fabbc530a2 (diff)
downloadserenity-65570216b406f7f71c96ddbafb10ee766b1a8ee5.zip
oss-fuzz: Try harder to fix build
Apparently memfd_create() is newish in glibc, and oss-fuzz uses Ubuntu 16.04 as base for its docker images, which doens't yet have memfd_create(). But, not to worry, it does have the syscall define and that's all we really need :/
Diffstat (limited to 'Userland/Libraries/LibCore/AnonymousBuffer.cpp')
-rw-r--r--Userland/Libraries/LibCore/AnonymousBuffer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/AnonymousBuffer.cpp b/Userland/Libraries/LibCore/AnonymousBuffer.cpp
index d3087363b2..40853ff732 100644
--- a/Userland/Libraries/LibCore/AnonymousBuffer.cpp
+++ b/Userland/Libraries/LibCore/AnonymousBuffer.cpp
@@ -37,6 +37,16 @@
# include <serenity.h>
#endif
+#if defined(__linux__) && !defined(MFD_CLOEXEC)
+# include <linux/memfd.h>
+# include <sys/syscall.h>
+
+static int memfd_create(const char* name, unsigned int flags)
+{
+ return syscall(SYS_memfd_create, name, flags);
+}
+#endif
+
namespace Core {
AnonymousBuffer AnonymousBuffer::create_with_size(size_t size)