Show a patch.

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

{
    "id": 2478,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2478/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2478/",
    "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": "<20191231053314.20063-2-paul.elder@ideasonboard.com>",
    "date": "2019-12-31T05:33:11",
    "name": "[libcamera-devel,v4,1/4] libcamera: v4l2_device, v4l2_videodevice: call open system call directly",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "515d61ea4d47e0f6626d44b053e6b85fa98ee583",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2478/mbox/",
    "series": [
        {
            "id": 595,
            "url": "https://patchwork.libcamera.org/api/1.1/series/595/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=595",
            "date": "2019-12-31T05:33:10",
            "name": "V4L2 compatibility layer",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/595/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2478/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2478/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<paul.elder@ideasonboard.com>",
        "Received": [
            "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 EFD2A60470\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Dec 2019 06:33:24 +0100 (CET)",
            "from neptunite.amanokami.net (173-16-160-11.client.mchsi.com\n\t[173.16.160.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7ED4F30F;\n\tTue, 31 Dec 2019 06:33:23 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1577770404;\n\tbh=LzTYg17R1rCrVjNClFJFWJBpnuNdQnlUr7W7MVhCP3U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=mV4kvvHu2F2mKS9MhMpzWUBgFZ7qXU1lGfE++72JfaQryrBEsIqLQWYR/moCYo5MB\n\tfJpVX0HbyZ9V8TQUDNeb4F/rNtO7eQs0i4lzM48tAWy8J+8evXuBSHrlKtw3yhQcya\n\tQZJgLXoGU/7SPsjc1ho5QcYojfSMIWZvTGu1xBH8=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 30 Dec 2019 23:33:11 -0600",
        "Message-Id": "<20191231053314.20063-2-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191231053314.20063-1-paul.elder@ideasonboard.com>",
        "References": "<20191231053314.20063-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 1/4] libcamera: v4l2_device,\n\tv4l2_videodevice: call open system call directly",
        "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>",
        "X-List-Received-Date": "Tue, 31 Dec 2019 05:33:25 -0000"
    },
    "content": "We are preparing to integrate the V4L2 adaptation layer, which will\nintercept open() calls (among others) via LD_PRELOAD. To prevent\nlibcamera's own open() calls from being intercepted, replace them with a\ndirect syscall.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nChanges in v4:\n- one cosmetic change\n\nChanges in v3:\n- change SYS_open to SYS_openat\n\nNo change in v2\n---\n src/libcamera/v4l2_device.cpp      | 3 ++-\n src/libcamera/v4l2_videodevice.cpp | 4 +++-\n 2 files changed, 5 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 0452f801..c13eddc8 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -11,6 +11,7 @@\n #include <iomanip>\n #include <string.h>\n #include <sys/ioctl.h>\n+#include <sys/syscall.h>\n #include <unistd.h>\n \n #include \"log.h\"\n@@ -75,7 +76,7 @@ int V4L2Device::open(unsigned int flags)\n \t\treturn -EBUSY;\n \t}\n \n-\tint ret = ::open(deviceNode_.c_str(), flags);\n+\tint ret = syscall(SYS_openat, AT_FDCWD, deviceNode_.c_str(), flags);\n \tif (ret < 0) {\n \t\tret = -errno;\n \t\tLOG(V4L2, Error) << \"Failed to open V4L2 device: \"\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 13e02323..033f7cc0 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -13,6 +13,7 @@\n #include <string.h>\n #include <sys/ioctl.h>\n #include <sys/mman.h>\n+#include <sys/syscall.h>\n #include <sys/time.h>\n #include <unistd.h>\n #include <vector>\n@@ -1426,7 +1427,8 @@ int V4L2M2MDevice::open()\n \t * as the V4L2VideoDevice::open() retains a handle by duplicating the\n \t * fd passed in.\n \t */\n-\tfd = ::open(deviceNode_.c_str(), O_RDWR | O_NONBLOCK);\n+\tfd = syscall(SYS_openat, AT_FDCWD, deviceNode_.c_str(),\n+\t\t     O_RDWR | O_NONBLOCK);\n \tif (fd < 0) {\n \t\tret = -errno;\n \t\tLOG(V4L2, Error)\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "1/4"
    ]
}