{"id":20202,"url":"https://patchwork.libcamera.org/api/patches/20202/?format=json","web_url":"https://patchwork.libcamera.org/patch/20202/","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":"<20240605083533.30718-1-laurent.pinchart@ideasonboard.com>","date":"2024-06-05T08:35:33","name":"libcamera: dma_buf_allocator: Work around lack of file seals in uClibc","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"5dac4ad9b9af40d440dbe193feb4fe1850cfee57","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/20202/mbox/","series":[{"id":4360,"url":"https://patchwork.libcamera.org/api/series/4360/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4360","date":"2024-06-05T08:35:33","name":"libcamera: dma_buf_allocator: Work around lack of file seals in uClibc","version":1,"mbox":"https://patchwork.libcamera.org/series/4360/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20202/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20202/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 4B3DDBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Jun 2024 08:35:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 637996543A;\n\tWed,  5 Jun 2024 10:35:53 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B631F634DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jun 2024 10:35:51 +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 4C51CEA2;\n\tWed,  5 Jun 2024 10:35:43 +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=\"ReARiLVO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1717576543;\n\tbh=ekGB7iRKPwuG+3OTyABtMofh5S6nZAy7antPo1E04rg=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=ReARiLVOGcffE+jLxWBJlSHb3kaZzH2iM8/bq+wHfITK7krjgknXLEC5FTgOLdnBn\n\tGEjh/N0ksElXh/M50gqUyj6/iynzPm6jKAJB04nOLvezqwuC5kWAEc5H2ezBlPVycJ\n\tz4A4A04jxK9jqBFvs+rqCdoWQwCLfmpI87wwr4nc=","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 file seals\n\tin uClibc","Date":"Wed,  5 Jun 2024 11:35:33 +0300","Message-ID":"<20240605083533.30718-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\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nAn alternative would be to disable udmabuf support on such platforms. I\nthink we can expect someone running libcamera on a uClibc system to be\nable to enable DMA heaps.\n---\n meson.build                         | 4 ++++\n src/libcamera/dma_buf_allocator.cpp | 5 +++++\n 2 files changed, 9 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..1c39441a3415 100644\n--- a/src/libcamera/dma_buf_allocator.cpp\n+++ b/src/libcamera/dma_buf_allocator.cpp\n@@ -157,6 +157,11 @@ UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size)\n \t\treturn {};\n \t}\n \n+#if not HAVE_FILE_SEALS\n+#define F_ADD_SEALS\t1033\n+#define F_SEAL_SHRINK\t0x0002\n+#endif\n+\n \t/* udmabuf dma-buffers *must* have the F_SEAL_SHRINK seal. */\n \tret = fcntl(memfd.get(), F_ADD_SEALS, F_SEAL_SHRINK);\n \tif (ret < 0) {\n","prefixes":[]}