{"id":20203,"url":"https://patchwork.libcamera.org/api/1.1/patches/20203/?format=json","web_url":"https://patchwork.libcamera.org/patch/20203/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240605083757.31553-1-laurent.pinchart@ideasonboard.com>","date":"2024-06-05T08:37:57","name":"libcamera: dma_buf_allocator: Work around lack of memfd_create() in uClibc","commit_ref":"9f0d88695ed6691a3e18c256d9d49862b3af6e34","pull_url":null,"state":"accepted","archived":false,"hash":"09f65bc30e42fdcc35a169706442b9bd41eb09c0","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20203/mbox/","series":[{"id":4361,"url":"https://patchwork.libcamera.org/api/1.1/series/4361/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4361","date":"2024-06-05T08:37:57","name":"libcamera: dma_buf_allocator: Work around lack of memfd_create() in uClibc","version":1,"mbox":"https://patchwork.libcamera.org/series/4361/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20203/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20203/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 786BBBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Jun 2024 08:38:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 319F26543F;\n\tWed,  5 Jun 2024 10:38:17 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AAC096543A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jun 2024 10:38:15 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 30A1AEA2;\n\tWed,  5 Jun 2024 10:38:07 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZkuPjSoz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1717576687;\n\tbh=CKTFWWPqBU2qEfA6DymNQJHIv1XweVs29nexopEjs9g=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=ZkuPjSozsOLhE3t53zs8QTY8mqot7pugwFKN//ycAm7i2wXHGns3cIINeKfCYV+Li\n\tEFzWYWD70noVpUkM80HquTnkYuWsLYZTwQC/lxQlRt4p0XTkV54tpCtvI+4vF7jK7V\n\t4IA8mA65rNW/lmYl95j0PTMWLkAY9o3sfsKlw818=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Hans de Goede <hdegoede@redhat.com>","Subject":"[PATCH] libcamera: dma_buf_allocator: Work around lack of\n\tmemfd_create() in uClibc","Date":"Wed,  5 Jun 2024 11:37:57 +0300","Message-ID":"<20240605083757.31553-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.44.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"uClibc doesn't provide a memfd_create() implementation. Fix it by using\na direct syscall when the function isn't available.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nI should have bundled this in a series with \"[PATCH] libcamera:\ndma_buf_allocator: Work around lack of file seals in uClibc\", sorry\nabout that.\n---\n src/libcamera/dma_buf_allocator.cpp | 5 +++++\n 1 file changed, 5 insertions(+)\n\n\nbase-commit: 98071d3109c131820439f61d9380c0bd4cd2119a","diff":"diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp\nindex 5ec29949c66a..d7d08e188a62 100644\n--- a/src/libcamera/dma_buf_allocator.cpp\n+++ b/src/libcamera/dma_buf_allocator.cpp\n@@ -13,6 +13,7 @@\n #include <sys/ioctl.h>\n #include <sys/mman.h>\n #include <sys/stat.h>\n+#include <sys/syscall.h>\n #include <sys/types.h>\n #include <unistd.h>\n \n@@ -132,7 +133,11 @@ UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size)\n \tstd::size_t pageMask = sysconf(_SC_PAGESIZE) - 1;\n \tsize = (size + pageMask) & ~pageMask;\n \n+#if HAVE_MEMFD_CREATE\n \tint ret = memfd_create(name, MFD_ALLOW_SEALING | MFD_CLOEXEC);\n+#else\n+\tint ret = syscall(SYS_memfd_create, name, MFD_ALLOW_SEALING | MFD_CLOEXEC);\n+#endif\n \tif (ret < 0) {\n \t\tret = errno;\n \t\tLOG(DmaBufAllocator, Error)\n","prefixes":[]}