Patch Detail
Show a patch.
GET /api/patches/14823/?format=api
{ "id": 14823, "url": "https://patchwork.libcamera.org/api/patches/14823/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14823/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20211128235752.10836-9-laurent.pinchart@ideasonboard.com>", "date": "2021-11-28T23:57:43", "name": "[libcamera-devel,v3,08/17] libcamera: event_dispatcher_poll: Manage fd by UniqueFD", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "5282388199e1174f679f94257d441715ce0b5b04", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14823/mbox/", "series": [ { "id": 2768, "url": "https://patchwork.libcamera.org/api/series/2768/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2768", "date": "2021-11-28T23:57:35", "name": "libcamera: Introduce UniqueFD", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2768/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14823/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14823/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 349C2C3251\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 28 Nov 2021 23:58:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF357605B6;\n\tMon, 29 Nov 2021 00:58:32 +0100 (CET)", "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 D467660596\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 00:58:24 +0100 (CET)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 60E45A15;\n\tMon, 29 Nov 2021 00:58:24 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"b9HnCH2F\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638143904;\n\tbh=eVMS4rD6rnd3lfEo/ZYM1xExa2nsFuds09Vpy5zarcE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=b9HnCH2FL+Jd2kcmmNJXCO7x07Wg98IRp62FbCbcVFbiubtygr1y7S3XW7sgs/G6k\n\teVRAHwshhHjdUL7DNSjOvSDU9nlF5tCLmw+M1qbULfo+UNnkkegXScwtKDOtd8TE1E\n\tz3+/8NkqaYse8i8CPg5/1hEtQJKIHqp7KSToG48g=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 29 Nov 2021 01:57:43 +0200", "Message-Id": "<20211128235752.10836-9-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>", "References": "<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 08/17] libcamera:\n\tevent_dispatcher_poll: Manage fd by UniqueFD", "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": "From: Hirokazu Honda <hiroh@chromium.org>\n\nManages the event file descriptor owned by EventDispatcherPoll\nby UniqueFD.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/base/event_dispatcher_poll.h | 3 ++-\n src/libcamera/base/event_dispatcher_poll.cpp | 11 +++++------\n 2 files changed, 7 insertions(+), 7 deletions(-)", "diff": "diff --git a/include/libcamera/base/event_dispatcher_poll.h b/include/libcamera/base/event_dispatcher_poll.h\nindex 3d2fc7bbc4c3..b7840309bb25 100644\n--- a/include/libcamera/base/event_dispatcher_poll.h\n+++ b/include/libcamera/base/event_dispatcher_poll.h\n@@ -14,6 +14,7 @@\n #include <libcamera/base/private.h>\n \n #include <libcamera/base/event_dispatcher.h>\n+#include <libcamera/base/unique_fd.h>\n \n struct pollfd;\n \n@@ -50,7 +51,7 @@ private:\n \n \tstd::map<int, EventNotifierSetPoll> notifiers_;\n \tstd::list<Timer *> timers_;\n-\tint eventfd_;\n+\tUniqueFD eventfd_;\n \n \tbool processingEvents_;\n };\ndiff --git a/src/libcamera/base/event_dispatcher_poll.cpp b/src/libcamera/base/event_dispatcher_poll.cpp\nindex 3c9a126c0bd6..8ee22d5adcc4 100644\n--- a/src/libcamera/base/event_dispatcher_poll.cpp\n+++ b/src/libcamera/base/event_dispatcher_poll.cpp\n@@ -54,14 +54,13 @@ EventDispatcherPoll::EventDispatcherPoll()\n \t * Create the event fd. Failures are fatal as we can't implement an\n \t * interruptible dispatcher without the fd.\n \t */\n-\teventfd_ = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);\n-\tif (eventfd_ < 0)\n+\teventfd_ = UniqueFD(eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK));\n+\tif (!eventfd_.isValid())\n \t\tLOG(Event, Fatal) << \"Unable to create eventfd\";\n }\n \n EventDispatcherPoll::~EventDispatcherPoll()\n {\n-\tclose(eventfd_);\n }\n \n void EventDispatcherPoll::registerEventNotifier(EventNotifier *notifier)\n@@ -154,7 +153,7 @@ void EventDispatcherPoll::processEvents()\n \tfor (auto notifier : notifiers_)\n \t\tpollfds.push_back({ notifier.first, notifier.second.events(), 0 });\n \n-\tpollfds.push_back({ eventfd_, POLLIN, 0 });\n+\tpollfds.push_back({ eventfd_.get(), POLLIN, 0 });\n \n \t/* Wait for events and process notifiers and timers. */\n \tdo {\n@@ -176,7 +175,7 @@ void EventDispatcherPoll::processEvents()\n void EventDispatcherPoll::interrupt()\n {\n \tuint64_t value = 1;\n-\tssize_t ret = write(eventfd_, &value, sizeof(value));\n+\tssize_t ret = write(eventfd_.get(), &value, sizeof(value));\n \tif (ret != sizeof(value)) {\n \t\tif (ret < 0)\n \t\t\tret = -errno;\n@@ -230,7 +229,7 @@ void EventDispatcherPoll::processInterrupt(const struct pollfd &pfd)\n \t\treturn;\n \n \tuint64_t value;\n-\tssize_t ret = read(eventfd_, &value, sizeof(value));\n+\tssize_t ret = read(eventfd_.get(), &value, sizeof(value));\n \tif (ret != sizeof(value)) {\n \t\tif (ret < 0)\n \t\t\tret = -errno;\n", "prefixes": [ "libcamera-devel", "v3", "08/17" ] }