Patch Detail
Show a patch.
GET /api/patches/12535/?format=api
{ "id": 12535, "url": "https://patchwork.libcamera.org/api/patches/12535/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12535/", "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": "<20210610075027.523672-3-hiroh@chromium.org>", "date": "2021-06-10T07:50:19", "name": "[libcamera-devel,v2,02/10] libcamera: EventDispatcherPoll: Manage fd by ScopedFD", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "e0a18ad6a0339ae2c5d32df1c5536a51340f6cf0", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12535/mbox/", "series": [ { "id": 2115, "url": "https://patchwork.libcamera.org/api/series/2115/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2115", "date": "2021-06-10T07:50:17", "name": "Introduce ScopedFD", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2115/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12535/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12535/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 A75D4BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jun 2021 07:50:40 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5646368938;\n\tThu, 10 Jun 2021 09:50:40 +0200 (CEST)", "from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com\n\t[IPv6:2607:f8b0:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FCD36892F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 09:50:38 +0200 (CEST)", "by mail-pg1-x52f.google.com with SMTP id y12so10083437pgk.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 00:50:38 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:98e0:b356:1c8a:25d4])\n\tby smtp.gmail.com with ESMTPSA id\n\td66sm1565161pfa.32.2021.06.10.00.50.35\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 10 Jun 2021 00:50:36 -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=\"mboGGsJ/\"; 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=pWxJ4OnA63T98e6zNE9xleVDI6Wpjy17l9FjAPBNIrM=;\n\tb=mboGGsJ/NLkz/ZfbnVWWukzzAbsb88fCfwU0/2U+0Uj+VTXJruJC4WljiDDHyVdvLo\n\tOOM0c+UbinNyCeK5IyvFbLhtWSczP6YrL+zSWDs8WyeiepfoCqcDtBCQO6jGslxFWP1h\n\tfGuCOTLMIa6QpsfEZ0ow9/pR6t2lWD60qrNMc=", "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=pWxJ4OnA63T98e6zNE9xleVDI6Wpjy17l9FjAPBNIrM=;\n\tb=mg8Z7OwX5KnopH26FtcyYiWkRqazS3owG9s3lfVGnJf/Y6Q3u3jc+jXb4OilDwAlxH\n\tem1pSCJaghWUOUIEXZ1iGe0ylswd5QYksCj97u0NjXExv7hInI5pvxsIkIzRBVztCz58\n\tBbkWTiClzsu6YJLvcEQMTh98yQ6M/d883rFCTPp4nn0yWzStJJC9rSDr06kszAm92rnI\n\t5gsLqZ0Gd9NIQPg5fgKd/8ugnzHVONP/KxVv3tkKmip0uQQF7xaO0NqI3fnM92HBNdJz\n\tFu6vV5qU1wN2yei6Y0ceoDxQBMBphgCYvm/KP9iJ0o5VtlZHXJHvk00MyzhQNVJfGPo/\n\tE4+g==", "X-Gm-Message-State": "AOAM533Vy3tJifADXNc12j8lzpAPLPquS2QQj3BtZq2W2yTWyRsFFIIO\n\txcwUOW3UchK6q9/KzEvdQSZFpKk7NMKIRA==", "X-Google-Smtp-Source": "ABdhPJz+IHnvo779Ik9vMJ3M32OPkrG+RoPAaQn+55gsZRWeE3f0j9nGUqVtDFf7GujJ/8VGTQW2GA==", "X-Received": "by 2002:a63:f13:: with SMTP id e19mr3715702pgl.112.1623311436598;\n\tThu, 10 Jun 2021 00:50:36 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 10 Jun 2021 16:50:19 +0900", "Message-Id": "<20210610075027.523672-3-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.32.0.rc1.229.g3e70b5a671-goog", "In-Reply-To": "<20210610075027.523672-1-hiroh@chromium.org>", "References": "<20210610075027.523672-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Manages the event file descriptor owned by EventDispatcherPoll\nby ScopedFD.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/event_dispatcher_poll.h | 4 +++-\n src/libcamera/event_dispatcher_poll.cpp | 11 +++++------\n 2 files changed, 8 insertions(+), 7 deletions(-)", "diff": "diff --git a/include/libcamera/internal/event_dispatcher_poll.h b/include/libcamera/internal/event_dispatcher_poll.h\nindex 33de051d..a309bb7f 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_fd.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..65e46b92 100644\n--- a/src/libcamera/event_dispatcher_poll.cpp\n+++ b/src/libcamera/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_ = ScopedFD(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", "v2", "02/10" ] }