Show a patch.

GET /api/patches/12537/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 12537,
    "url": "https://patchwork.libcamera.org/api/patches/12537/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12537/",
    "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-5-hiroh@chromium.org>",
    "date": "2021-06-10T07:50:21",
    "name": "[libcamera-devel,v2,04/10] libcamera: Process: Manage pipe fds by ScopedFD",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5c61f567ec96149633e8cefb09c1c39cb631ec65",
    "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/12537/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/12537/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12537/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 5F275BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jun 2021 07:50:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1C61868933;\n\tThu, 10 Jun 2021 09:50:43 +0200 (CEST)",
            "from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com\n\t[IPv6:2607:f8b0:4864:20::62c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 72B826892C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 09:50:41 +0200 (CEST)",
            "by mail-pl1-x62c.google.com with SMTP id 69so544513plc.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 00:50:41 -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.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 10 Jun 2021 00:50:39 -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=\"ieiBDvEo\"; 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=6gV/JFiuoSpUYo+CBAqmrodOMqb0XKCJlOoRjDzT+TQ=;\n\tb=ieiBDvEobR8/U+OkkNbcKnKcQkg8ZzxPyfGG5vkg1wdkiy8ZYac2qcnBEIisNulBOC\n\tQ6ko3/eqfH8038H1i+bksR/6tqc047SvbKb+BlvUsvij/v0Sbh6i5T+cGLAnOcN7y67e\n\toyqzpN79fvzj1+3zwkmmuKtn8jB2ORZOWdBFY=",
        "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=6gV/JFiuoSpUYo+CBAqmrodOMqb0XKCJlOoRjDzT+TQ=;\n\tb=aBY9ZgNpbgELSOqafGTERRm8rusSMrbsbBVbtwHogKWeYMUEhGzjkucGAJq4Ma6VII\n\thxKTe0T8AJsNJyCpXuTbDWIC2RYG4hBjiuk2Ru8UIZQOpDaiv+0pqWZ8Qx2mbx98CG9H\n\tmXfFzLV4JraI5K/UWpj3Ka1udrEhItnlsogxPvLJkE/CQk2HSya5NiJ9vBS9r/XMz8Ju\n\t6mzF8yWNJiq3TW0j2U5vNeRSP3nLU7KJ9edxFCpRC69YVr/oeaIkj7hsMB+3tZFw9z5p\n\tzqsYZMi9xb/idP5TDpqBw6C7mbfV6y9zAmfrO9Nb9tuS1gOiJYmbzEsy+V+BVfhZL2k6\n\tlZ1w==",
        "X-Gm-Message-State": "AOAM533VGuf5JfN8QW80T/RXR0+15zKAPYyD0byMqM1GJE6oRr6+OWMi\n\t/EiUj1nV9CZnpLuL29rRX39pWURMoEVong==",
        "X-Google-Smtp-Source": "ABdhPJx9T2puFhKU15M3drUUYLTjnfXQWkrcYebYMSmJdk7F9ML7fbQyslMgvnhE+BZtIYU5EvjmZw==",
        "X-Received": "by 2002:a17:902:d64e:b029:ef:8b85:d299 with SMTP id\n\ty14-20020a170902d64eb02900ef8b85d299mr3713709plh.27.1623311439821; \n\tThu, 10 Jun 2021 00:50:39 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 10 Jun 2021 16:50:21 +0900",
        "Message-Id": "<20210610075027.523672-5-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 04/10] libcamera: Process: Manage pipe\n\tfds 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 file descriptors owned by Process for pipe by ScopedFDs.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/process.h |  4 +++-\n src/libcamera/process.cpp            | 16 ++++++++++------\n 2 files changed, 13 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h\nindex 254cda85..027bb7da 100644\n--- a/include/libcamera/internal/process.h\n+++ b/include/libcamera/internal/process.h\n@@ -11,6 +11,7 @@\n #include <string>\n #include <vector>\n \n+#include <libcamera/scoped_fd.h>\n #include <libcamera/signal.h>\n \n namespace libcamera {\n@@ -75,8 +76,9 @@ private:\n \tstd::list<Process *> processes_;\n \n \tstruct sigaction oldsa_;\n+\n \tEventNotifier *sigEvent_;\n-\tint pipe_[2];\n+\tScopedFD pipe_[2];\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\nindex 40a434a6..bb51d73b 100644\n--- a/src/libcamera/process.cpp\n+++ b/src/libcamera/process.cpp\n@@ -69,7 +69,7 @@ void sigact(int signal, siginfo_t *info, void *ucontext)\n void ProcessManager::sighandler([[maybe_unused]] EventNotifier *notifier)\n {\n \tchar data;\n-\tssize_t ret = read(pipe_[0], &data, sizeof(data));\n+\tssize_t ret = read(pipe_[0].get(), &data, sizeof(data));\n \tif (ret < 0) {\n \t\tLOG(Process, Error)\n \t\t\t<< \"Failed to read byte from signal handler pipe\";\n@@ -129,10 +129,15 @@ ProcessManager::ProcessManager()\n \n \tsigaction(SIGCHLD, &sa, NULL);\n \n-\tif (pipe2(pipe_, O_CLOEXEC | O_DIRECT | O_NONBLOCK))\n+\tint pipe[2];\n+\tif (pipe2(pipe, O_CLOEXEC | O_DIRECT | O_NONBLOCK))\n \t\tLOG(Process, Fatal)\n \t\t\t<< \"Failed to initialize pipe for signal handling\";\n-\tsigEvent_ = new EventNotifier(pipe_[0], EventNotifier::Read);\n+\n+\tpipe_[0] = ScopedFD(pipe[0]);\n+\tpipe_[1] = ScopedFD(pipe[1]);\n+\n+\tsigEvent_ = new EventNotifier(pipe_[0].get(), EventNotifier::Read);\n \tsigEvent_->activated.connect(this, &ProcessManager::sighandler);\n \n \tself_ = this;\n@@ -141,9 +146,8 @@ ProcessManager::ProcessManager()\n ProcessManager::~ProcessManager()\n {\n \tsigaction(SIGCHLD, &oldsa_, NULL);\n+\n \tdelete sigEvent_;\n-\tclose(pipe_[0]);\n-\tclose(pipe_[1]);\n \n \tself_ = nullptr;\n }\n@@ -170,7 +174,7 @@ ProcessManager *ProcessManager::instance()\n  */\n int ProcessManager::writePipe() const\n {\n-\treturn pipe_[1];\n+\treturn pipe_[1].get();\n }\n \n /**\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "04/10"
    ]
}