Patch Detail
Show a patch.
GET /api/1.1/patches/11938/?format=api
{ "id": 11938, "url": "https://patchwork.libcamera.org/api/1.1/patches/11938/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11938/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210415083843.3399502-2-hiroh@chromium.org>", "date": "2021-04-15T08:38:35", "name": "[libcamera-devel,RFC,02/10] libcamera: EventDispatcherPoll: Manage fd by ScopedFD", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "7ee485df6746ed20fc4e3c7cf64442207a9d7047", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/11938/mbox/", "series": [ { "id": 1933, "url": "https://patchwork.libcamera.org/api/1.1/series/1933/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1933", "date": "2021-04-15T08:38:35", "name": null, "version": 1, "mbox": "https://patchwork.libcamera.org/series/1933/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11938/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11938/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 8DA9EBD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Apr 2021 08:38:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 508556880B;\n\tThu, 15 Apr 2021 10:38:54 +0200 (CEST)", "from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com\n\t[IPv6:2607:f8b0:4864:20::1029])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4319168813\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Apr 2021 10:38:52 +0200 (CEST)", "by mail-pj1-x1029.google.com with SMTP id\n\tq14-20020a17090a430eb02901503aaee02bso1237278pjg.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Apr 2021 01:38:52 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:84f5:7981:dfbe:8f02])\n\tby smtp.gmail.com with ESMTPSA id\n\t205sm1520258pfc.201.2021.04.15.01.38.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 15 Apr 2021 01:38:50 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"M1reJcFd\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ixH+lzGrZPeeae5KvkgM+e04VdvZ3YsSbidPulfu7Hk=;\n\tb=M1reJcFd52JDdieFjSELynpJ2JxOibozZ051HJz/M4DbtMWrAKxC2xMq+Sf6Kn1kF3\n\t1wdCuGRIyXxmkGoaSQFJuWKSWfiqAr7Cdtz/IQvH6JUfDidskI/a1smLgqzke2QyabIV\n\tYPB3pTUhrjvvVIs6Jd/jlpYZhlnrbNFMZ8VR0=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=ixH+lzGrZPeeae5KvkgM+e04VdvZ3YsSbidPulfu7Hk=;\n\tb=COxSuYmyuxumNOJ4cVXl+fJTxsCwYPVGaoPDVcpU2UYq2xIlAXNI764KPSPfbp4xqX\n\tWEJCqa/tQ6CdalnUCiv9Sh0vk47E85Lalyx3zmhRADg9LCUCNeuipY9i4BRvniEUVtBd\n\t75sKK0dGJYWeyg9Bf6+b9zEiOMhPbhlqwAoc41GD96ytQ3HhHpauOrZ+fHFAoOpjb0Qm\n\tZcwdcZwJZ/58FCd6o4057DrENZb5gaZYzsnzvyMsHLFqE5UzNtfABPVOMueV+i9vRfvl\n\t4TAa7Al24DGrGALgO4ktbQq7rkfUyuhQv701TkvPMHhZwvZciq/XOJyXjuEQdADK13ue\n\tJ0HA==", "X-Gm-Message-State": "AOAM530HEaFr7FixOeebDoX67YFpquHNe1zfKznLfVpG6tan0DTndDmM\n\tTqu5TDDS7WkjPuxH6rtU/LniLDRERzWENw==", "X-Google-Smtp-Source": "ABdhPJz3YWDD642xAC1Scbh6MDH4SMYbkxTpaEzR1krdW3HWWwU0p3+CthVSSdEALLQxRJBndF5h4Q==", "X-Received": "by 2002:a17:902:f687:b029:e8:da63:6195 with SMTP id\n\tl7-20020a170902f687b02900e8da636195mr2537060plg.75.1618475930435; \n\tThu, 15 Apr 2021 01:38:50 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 15 Apr 2021 17:38:35 +0900", "Message-Id": "<20210415083843.3399502-2-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.31.1.368.gbe11c130af-goog", "In-Reply-To": "<20210415083843.3399502-1-hiroh@chromium.org>", "References": "<20210415083843.3399502-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [RFC PATCH 02/10] libcamera: EventDispatcherPoll:\n\tManage fd by ScopedFD", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "EventDispatcherPoll owns the event file descriptor. This manages\nthe fd with ScopedFD to avoid leakage.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/event_dispatcher_poll.h | 4 +++-\n src/libcamera/event_dispatcher_poll.cpp | 12 ++++++------\n 2 files changed, 9 insertions(+), 7 deletions(-)", "diff": "diff --git a/include/libcamera/internal/event_dispatcher_poll.h b/include/libcamera/internal/event_dispatcher_poll.h\nindex 33de051d..b686183d 100644\n--- a/include/libcamera/internal/event_dispatcher_poll.h\n+++ b/include/libcamera/internal/event_dispatcher_poll.h\n@@ -11,6 +11,8 @@\n #include <map>\n #include <vector>\n \n+#include <libcamera/scoped_file_descriptor.h>\n+\n #include \"libcamera/internal/event_dispatcher.h\"\n \n struct pollfd;\n@@ -48,7 +50,7 @@ private:\n \n \tstd::map<int, EventNotifierSetPoll> notifiers_;\n \tstd::list<Timer *> timers_;\n-\tint eventfd_;\n+\tScopedFD eventfd_;\n \n \tbool processingEvents_;\n };\ndiff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp\nindex 456c6def..6b22a8a3 100644\n--- a/src/libcamera/event_dispatcher_poll.cpp\n+++ b/src/libcamera/event_dispatcher_poll.cpp\n@@ -54,14 +54,14 @@ 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+\tint fd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);\n+\tif (fd < 0)\n \t\tLOG(Event, Fatal) << \"Unable to create eventfd\";\n+\teventfd_ = ScopedFD(fd);\n }\n \n EventDispatcherPoll::~EventDispatcherPoll()\n {\n-\tclose(eventfd_);\n }\n \n void EventDispatcherPoll::registerEventNotifier(EventNotifier *notifier)\n@@ -154,7 +154,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 +176,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 +230,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", "RFC", "02/10" ] }