[{"id":24649,"web_url":"https://patchwork.libcamera.org/comment/24649/","msgid":"<20220818142546.4jvwsy5h7dywtzca@uno.localdomain>","date":"2022-08-18T14:25:46","subject":"Re: [libcamera-devel] [PATCH v3 07/17] py: Set EFD_CLOEXEC on\n\teventfd to avoid fd leaking","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Tomi\n\nOn Fri, Jul 01, 2022 at 11:45:11AM +0300, Tomi Valkeinen wrote:\n> Set EFD_CLOEXEC on eventfd to avoid fd leaking.\n>\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  src/py/libcamera/py_camera_manager.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp\n> index 51a890c8..3d422c9e 100644\n> --- a/src/py/libcamera/py_camera_manager.cpp\n> +++ b/src/py/libcamera/py_camera_manager.cpp\n> @@ -22,7 +22,7 @@ PyCameraManager::PyCameraManager()\n>\n>  \tcameraManager_ = std::make_unique<CameraManager>();\n>\n> -\tint fd = eventfd(0, 0);\n> +\tint fd = eventfd(0, EFD_CLOEXEC);\n\nOr you could\n\n        eventfd_ = UniqueFd(eventfd((0, EFD_CLOEXEC));\n        if (!eventfd_.isValid())\n\nAnd squash with the previous ones\n\n>  \tif (fd == -1)\n>  \t\tthrow std::system_error(errno, std::generic_category(),\n>  \t\t\t\t\t\"Failed to create eventfd\");\n> --\n> 2.34.1\n>","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 2FC1DC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 14:25:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A799F61FC0;\n\tThu, 18 Aug 2022 16:25:51 +0200 (CEST)","from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::222])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8EBEA61FA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 16:25:49 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 1E9EB4000B;\n\tThu, 18 Aug 2022 14:25:47 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660832751;\n\tbh=p1G59sm9CS1+bnbUDBbmJJfL98gYx2Qd5EFqoB55R1g=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=H3pekmhZOwHVTY1fD1BXse4//L+JOdvjydgEJKafuBVs+kqzawnDxPCPiZNKlvOTJ\n\tEKPHDASmHdsJnLdr9sw4YRCrvHvlNPDr19GjQiBK/NkXA62leq9Ce/ihtFsNHxym1o\n\tE2t1QjzgEynCsDXlpLwAbkoy2ROSJ8ntX+/LGmbE4czD5BXBxZEw463qcUS+KdxHGx\n\tMshfXWDD6MHFTYmjT6PuOghTJdwxpEAvhp6+2GXP0bIMRRvt6aLk+CvwjAS8OFk+Hh\n\tGqe5AWJ6R3GCnZLGTLe4qjcIWM7FeGoTd0c8HRjv0kTOl76NFTYbJYP9l+BtN5mhj8\n\tDEnDMysn8Fx7A==","Date":"Thu, 18 Aug 2022 16:25:46 +0200","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<20220818142546.4jvwsy5h7dywtzca@uno.localdomain>","References":"<20220701084521.31831-1-tomi.valkeinen@ideasonboard.com>\n\t<20220701084521.31831-8-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220701084521.31831-8-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] py: Set EFD_CLOEXEC on\n\teventfd to avoid fd leaking","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>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24659,"web_url":"https://patchwork.libcamera.org/comment/24659/","msgid":"<45bbfb86-2044-c9e0-e9ac-9c4cb582b54a@ideasonboard.com>","date":"2022-08-18T14:52:03","subject":"Re: [libcamera-devel] [PATCH v3 07/17] py: Set EFD_CLOEXEC on\n\teventfd to avoid fd leaking","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 18/08/2022 17:25, Jacopo Mondi wrote:\n> Hi Tomi\n> \n> On Fri, Jul 01, 2022 at 11:45:11AM +0300, Tomi Valkeinen wrote:\n>> Set EFD_CLOEXEC on eventfd to avoid fd leaking.\n>>\n>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n>> ---\n>>   src/py/libcamera/py_camera_manager.cpp | 2 +-\n>>   1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp\n>> index 51a890c8..3d422c9e 100644\n>> --- a/src/py/libcamera/py_camera_manager.cpp\n>> +++ b/src/py/libcamera/py_camera_manager.cpp\n>> @@ -22,7 +22,7 @@ PyCameraManager::PyCameraManager()\n>>\n>>   \tcameraManager_ = std::make_unique<CameraManager>();\n>>\n>> -\tint fd = eventfd(0, 0);\n>> +\tint fd = eventfd(0, EFD_CLOEXEC);\n> \n> Or you could\n> \n>          eventfd_ = UniqueFd(eventfd((0, EFD_CLOEXEC));\n>          if (!eventfd_.isValid())\n\nYes... But that hides the eventfd() a bit there. And makes the line \nlonger, especially after we add the EFD_NONBLOCK. Nothing big, but I do \nlike the current style better.\n\n  Tomi","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 87F82C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 14:52:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3EE6E61FC0;\n\tThu, 18 Aug 2022 16:52:08 +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 B221F61FA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 16:52:06 +0200 (CEST)","from [192.168.1.111] (91-158-154-79.elisa-laajakaista.fi\n\t[91.158.154.79])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E18C18B;\n\tThu, 18 Aug 2022 16:52:05 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660834328;\n\tbh=kRTdV4gaxPqzSAW3iMPRuiho6h7/9vIBWcLHRxgcAXM=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=OfsFBn5QwoK1l9ZHoveoR91s20jL1ToS9CW4WOS0epzWu3meUJGQrx98A/svzW0SO\n\tQfNxF1QgwbInGJ9mA5MYVnRkaZl17FsDeB/yx2gfCTcjzicCwZkrRju+Tf1uEHYx8e\n\tqbyFEqzfB3nec+1u7qrmqP3ahRWCelhEoKlnDhPwCsFZy6k+Xfi0EJ8j/H/IJUWJQY\n\tM5L/xZktqLDeenclQtfdbUt7u3aLclPz7fFRH4HJxJ3XBm/uuXcNMTwn8sm4t8wSIP\n\tYOLw7xweh2RKBTnhJYzmH0RecCCx2Qy5MLC7uqYMRCbGXNyCZ1/EgO053AGGsYZpaP\n\t23VP6f74veUcg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660834326;\n\tbh=kRTdV4gaxPqzSAW3iMPRuiho6h7/9vIBWcLHRxgcAXM=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=uhhQmxxZziUq/xgbjrfvChmgiG9wYL65zZaPP1/axoIHmAlMni2NfOJtRRqe3oC8i\n\tQ1dDuKHw36e0VdIjuZh097YHBNU/oucGih/+qsOjHVfTr61xmpNm4zR/sCyxK9xuG8\n\tHqIua87CfZtb/+hZHvftCyOMowek6l8NUeUzQaVw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"uhhQmxxZ\"; dkim-atps=neutral","Message-ID":"<45bbfb86-2044-c9e0-e9ac-9c4cb582b54a@ideasonboard.com>","Date":"Thu, 18 Aug 2022 17:52:03 +0300","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.11.0","Content-Language":"en-US","To":"Jacopo Mondi <jacopo@jmondi.org>","References":"<20220701084521.31831-1-tomi.valkeinen@ideasonboard.com>\n\t<20220701084521.31831-8-tomi.valkeinen@ideasonboard.com>\n\t<20220818142546.4jvwsy5h7dywtzca@uno.localdomain>","In-Reply-To":"<20220818142546.4jvwsy5h7dywtzca@uno.localdomain>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] py: Set EFD_CLOEXEC on\n\teventfd to avoid fd leaking","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>","From":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24670,"web_url":"https://patchwork.libcamera.org/comment/24670/","msgid":"<Yv5c18lrYm+0s3HK@pendragon.ideasonboard.com>","date":"2022-08-18T15:37:59","subject":"Re: [libcamera-devel] [PATCH v3 07/17] py: Set EFD_CLOEXEC on\n\teventfd to avoid fd leaking","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nThank you for the patch.\n\nOn Fri, Jul 01, 2022 at 11:45:11AM +0300, Tomi Valkeinen wrote:\n> Set EFD_CLOEXEC on eventfd to avoid fd leaking.\n> \n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/py/libcamera/py_camera_manager.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/py/libcamera/py_camera_manager.cpp b/src/py/libcamera/py_camera_manager.cpp\n> index 51a890c8..3d422c9e 100644\n> --- a/src/py/libcamera/py_camera_manager.cpp\n> +++ b/src/py/libcamera/py_camera_manager.cpp\n> @@ -22,7 +22,7 @@ PyCameraManager::PyCameraManager()\n>  \n>  \tcameraManager_ = std::make_unique<CameraManager>();\n>  \n> -\tint fd = eventfd(0, 0);\n> +\tint fd = eventfd(0, EFD_CLOEXEC);\n>  \tif (fd == -1)\n>  \t\tthrow std::system_error(errno, std::generic_category(),\n>  \t\t\t\t\t\"Failed to create eventfd\");","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 CE51DBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Aug 2022 15:38:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2E43961FC0;\n\tThu, 18 Aug 2022 17:38:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 719F661FA7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Aug 2022 17:38:02 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C6E758B;\n\tThu, 18 Aug 2022 17:38:01 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660837084;\n\tbh=iOt+63Zb86SwClTrIKpDt92knaZMupaiGGFL9f/YOSU=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=MQNVrS7k8ubnGihMLhF57x95G4OB5rkQX633zsNRol4sCfGaS1pC+Flio+rVhnxDT\n\topdokI1pobqxRi9QKujGDm8kBcQZKQdJQdMK6V3lk+WPKiR9fP7PGvbBqEMXnWM7tI\n\t2z/gEDBKSBbldDanTDSvDphRzAsVDvfBNMXpKu0ICY+E7o74Xw502ph3j1aMU9ldSj\n\tSkwCCyEYI1v6n4QB8OI+LhPnwaLxkt9HmkwIFKyoQdyv0vDLUNns2gAt05/Bsyafe9\n\tf7v4SBUW4orNHQ85i9GD/sO5fTdmyTpGyE3TvclvjlHSH3ucs3/lAAePTuOpN2TMoG\n\tN0kI0dgBLfp8Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660837082;\n\tbh=iOt+63Zb86SwClTrIKpDt92knaZMupaiGGFL9f/YOSU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SP3NbsLubromBVS8caFFznf+MvLYgi7ZkuiGJ6HuiBVThBY/mL0hYXdu9kOmGlz5p\n\tKZnhSFzo/nfuGWsbEtQOPY9E138C+/FLyUTrLUUbOB9L73n+4uPT3/pJk/mzItbLpn\n\tnlsjndvKMmEHBrIjhpauZriQH6uv/D0uvvXPPEyw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"SP3NbsLu\"; dkim-atps=neutral","Date":"Thu, 18 Aug 2022 18:37:59 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<Yv5c18lrYm+0s3HK@pendragon.ideasonboard.com>","References":"<20220701084521.31831-1-tomi.valkeinen@ideasonboard.com>\n\t<20220701084521.31831-8-tomi.valkeinen@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220701084521.31831-8-tomi.valkeinen@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] py: Set EFD_CLOEXEC on\n\teventfd to avoid fd leaking","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]