summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-05-03 03:37:10 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-05-03 17:58:44 +0300
commitacf61456cc55441a0f09b361a531d628d390031b (patch)
tree038a9b3dacf5f927ba39756a0c8aae34a2feba20 /src
parente0318c4776549a0db0a06682e906310970c8caf9 (diff)
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/shared_mem_object.cpp6
1 files changed, 6 insertions, 0 deletions
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 <stddef.h>
#include <stdint.h>
+#include <sys/mman.h>
+#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
@@ -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;