From acf61456cc55441a0f09b361a531d628d390031b Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 3 May 2024 03:37:10 +0300 Subject: libcamera: shared_mem_object: Fix compilation with uClibc uClibc doesn't provide a memfd_create() implementation. Fix it by using a direct syscall when the function isn't available. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Stefan Klug --- src/libcamera/shared_mem_object.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/libcamera/shared_mem_object.cpp b/src/libcamera/shared_mem_object.cpp index b018fb3b..e8cb59f7 100644 --- a/src/libcamera/shared_mem_object.cpp +++ b/src/libcamera/shared_mem_object.cpp @@ -12,6 +12,8 @@ #include #include +#include +#include #include #include @@ -56,7 +58,11 @@ SharedMem::SharedMem() = default; */ SharedMem::SharedMem(const std::string &name, std::size_t size) { +#if HAVE_MEMFD_CREATE int fd = memfd_create(name.c_str(), MFD_CLOEXEC); +#else + int fd = syscall(SYS_memfd_create, name.c_str(), MFD_CLOEXEC); +#endif if (fd < 0) return; -- cgit v1.2.1