Show a patch.

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

{
    "id": 19993,
    "url": "https://patchwork.libcamera.org/api/patches/19993/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19993/",
    "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": "<20240503025205.2814-3-laurent.pinchart@ideasonboard.com>",
    "date": "2024-05-03T02:52:03",
    "name": "[2/4] libcamera: shared_mem_object: Fix compilation with uClibc",
    "commit_ref": "acf61456cc55441a0f09b361a531d628d390031b",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b030d73ef909b292917f614fb82eaff3f46e555f",
    "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/19993/mbox/",
    "series": [
        {
            "id": 4285,
            "url": "https://patchwork.libcamera.org/api/series/4285/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4285",
            "date": "2024-05-03T02:52:01",
            "name": "libcamera: Assorted cleanups and fixes",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4285/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19993/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19993/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 DB4D5C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 May 2024 02:52:18 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7173F6341C;\n\tFri,  3 May 2024 04:52:17 +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 3B1796340B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 May 2024 04:52:15 +0200 (CEST)",
            "from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3D57D3A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 May 2024 04:51:17 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"H5807v0A\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1714704677;\n\tbh=xfifvORN7LQ04rfpaGWFaVpc6JGUaYkYuRtvNU/+Vp8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=H5807v0AFHLN2JYifCwvXCaPymIYYQljQs1FsvjuHWyyOG40iKd7Wa0yGQBY+HMwT\n\tmoP/No6+LR98qfjfL8flNFkrTcUzS38qKAmJZIdY1VhPhGyvkaiblmMQeaWFBfDRwn\n\tEHbnfSSKriaOyFKD+60A+PO+tC0j0Nz+TuE/arEk=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH 2/4] libcamera: shared_mem_object: Fix compilation with\n\tuClibc",
        "Date": "Fri,  3 May 2024 05:52:03 +0300",
        "Message-ID": "<20240503025205.2814-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.43.2",
        "In-Reply-To": "<20240503025205.2814-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20240503025205.2814-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "uClibc doesn't provide a memfd_create() implementation. Fix it by using\na direct syscall when the function isn't available.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n meson.build                         | 4 ++++\n src/libcamera/shared_mem_object.cpp | 6 ++++++\n 2 files changed, 10 insertions(+)",
    "diff": "diff --git a/meson.build b/meson.build\nindex 740ead1be85f..39e4947f8c97 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -82,6 +82,10 @@ if cc.has_header_symbol('locale.h', 'locale_t', prefix : '#define _GNU_SOURCE')\n     config_h.set('HAVE_LOCALE_T', 1)\n endif\n \n+if cc.has_header_symbol('sys/mman.h', 'memfd_create', prefix : '#define _GNU_SOURCE')\n+    config_h.set('HAVE_MEMFD_CREATE', 1)\n+endif\n+\n if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOURCE')\n     config_h.set('HAVE_SECURE_GETENV', 1)\n endif\ndiff --git a/src/libcamera/shared_mem_object.cpp b/src/libcamera/shared_mem_object.cpp\nindex b018fb3bc0a5..e8cb59f7a90f 100644\n--- a/src/libcamera/shared_mem_object.cpp\n+++ b/src/libcamera/shared_mem_object.cpp\n@@ -12,6 +12,8 @@\n \n #include <stddef.h>\n #include <stdint.h>\n+#include <sys/mman.h>\n+#include <sys/syscall.h>\n #include <sys/types.h>\n #include <unistd.h>\n \n@@ -56,7 +58,11 @@ SharedMem::SharedMem() = default;\n  */\n SharedMem::SharedMem(const std::string &name, std::size_t size)\n {\n+#if HAVE_MEMFD_CREATE\n \tint fd = memfd_create(name.c_str(), MFD_CLOEXEC);\n+#else\n+\tint fd = syscall(SYS_memfd_create, name.c_str(), MFD_CLOEXEC);\n+#endif\n \tif (fd < 0)\n \t\treturn;\n \n",
    "prefixes": [
        "2/4"
    ]
}