{"id":20204,"url":"https://patchwork.libcamera.org/api/patches/20204/?format=json","web_url":"https://patchwork.libcamera.org/patch/20204/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20240605092211.18954-1-laurent.pinchart@ideasonboard.com>","date":"2024-06-05T09:22:11","name":"[v2] libcamera: dma_buf_allocator: Work around lack of file seals in uClibc","commit_ref":"48cb731d72e2bc54d3bf76eb35c6644fa2f924f2","pull_url":null,"state":"accepted","archived":false,"hash":"3316e1988b496f583356b22f1e1b62e8d88d2527","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20204/mbox/","series":[{"id":4362,"url":"https://patchwork.libcamera.org/api/series/4362/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4362","date":"2024-06-05T09:22:11","name":"[v2] libcamera: dma_buf_allocator: Work around lack of file seals in uClibc","version":2,"mbox":"https://patchwork.libcamera.org/series/4362/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20204/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20204/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 40C50BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Jun 2024 09:22:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 42A7D634DB;\n\tWed,  5 Jun 2024 11:22:30 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C98C6634B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jun 2024 11:22:28 +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 4054414B0;\n\tWed,  5 Jun 2024 11:22:20 +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=\"ET7VvZ2j\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1717579340;\n\tbh=lNo3h7nSH6h8TOmyPChAx6fRDDYiUjUd3vsmJLhVP6U=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=ET7VvZ2jsVgsumb/79ktqnisFJ6G/4vN+FLs+aR4xiBhSeT20VwGq2qbJbAPzCUGc\n\tetPMOPn7lAZcvk+kl+k4wQyTi1l8/WioAt7UzacVz91tT/k0F7g3O9AqrEgeXYCVlq\n\t62uADArBEodbIgFl34EQSL28I+NQcK2JKQ+BET54=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Hans de Goede <hdegoede@redhat.com>","Subject":"[PATCH v2] libcamera: dma_buf_allocator: Work around lack of file\n\tseals in uClibc","Date":"Wed,  5 Jun 2024 12:22:11 +0300","Message-ID":"<20240605092211.18954-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 the macros defining parameters for the file\nsealing API. Define them manually as a work around.\n\nFixes: ea4baaacc325 (\"libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf\")\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Silence doxygen warning\n- Move defines before function\n- Add comment\n---\n meson.build                         | 4 ++++\n src/libcamera/dma_buf_allocator.cpp | 8 ++++++++\n 2 files changed, 12 insertions(+)\n\n\nbase-commit: 98071d3109c131820439f61d9380c0bd4cd2119a","diff":"diff --git a/meson.build b/meson.build\nindex 1902ea2fd3ff..0ef4cdaafd76 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -74,6 +74,10 @@ cc = meson.get_compiler('c')\n cxx = meson.get_compiler('cpp')\n config_h = configuration_data()\n \n+if cc.has_header_symbol('fcntl.h', 'F_ADD_SEALS', prefix : '#define _GNU_SOURCE')\n+    config_h.set('HAVE_FILE_SEALS', 1)\n+endif\n+\n if cc.has_header_symbol('unistd.h', 'issetugid')\n     config_h.set('HAVE_ISSETUGID', 1)\n endif\ndiff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp\nindex d7d08e188a62..c06eca7d04ec 100644\n--- a/src/libcamera/dma_buf_allocator.cpp\n+++ b/src/libcamera/dma_buf_allocator.cpp\n@@ -127,6 +127,14 @@ DmaBufAllocator::~DmaBufAllocator() = default;\n  * \\return True if the DmaBufAllocator is valid, false otherwise\n  */\n \n+/* uClibc doesn't provide the file sealing API. */\n+#ifndef __DOXYGEN__\n+#if not HAVE_FILE_SEALS\n+#define F_ADD_SEALS\t\t1033\n+#define F_SEAL_SHRINK\t\t0x0002\n+#endif\n+#endif\n+\n UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size)\n {\n \t/* Size must be a multiple of the page size. Round it up. */\n","prefixes":["v2"]}