Show a patch.

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

{
    "id": 2444,
    "url": "https://patchwork.libcamera.org/api/patches/2444/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2444/",
    "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": "<20191223072620.13022-2-paul.elder@ideasonboard.com>",
    "date": "2019-12-23T07:26:15",
    "name": "[libcamera-devel,v3,1/6] libcamera: v4l2_device, v4l2_videodevice: call open system call directly",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4b5b12f3ca9884ccbfd1bc28f9ad9d56c72fc0d4",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2444/mbox/",
    "series": [
        {
            "id": 592,
            "url": "https://patchwork.libcamera.org/api/series/592/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=592",
            "date": "2019-12-23T07:26:14",
            "name": "V4L2 compatibility layer",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/592/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2444/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2444/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 C3F30605D0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Dec 2019 08:26:47 +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 3D51097A;\n\tMon, 23 Dec 2019 08:26:46 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1577086007;\n\tbh=ADhUIuHGA6FLWE/WdJXHK0Z76gzbqUuxcTwm8eRHAFo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=poQ55OJeDJB9iJ1ZaOnZ4K/ancuvvy/uH3tLv1Q9nT/7SFxOMOFqOfruY/7VpxVmj\n\tfwu/y8w/SQp+AgDA61CiVZgQW8ynk45pwryp8yUcOiBoqLCe+07NCFxTbL7/ZujGSp\n\ttOuL8lLPVSi6HtBfy6cDAzSkEjAi4DzLn1goTLko=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 23 Dec 2019 01:26:15 -0600",
        "Message-Id": "<20191223072620.13022-2-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191223072620.13022-1-paul.elder@ideasonboard.com>",
        "References": "<20191223072620.13022-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 1/6] 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": "Mon, 23 Dec 2019 07:26:48 -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 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 | 3 ++-\n 2 files changed, 4 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..50e3bc11 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,7 @@ 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(), O_RDWR | O_NONBLOCK);\n \tif (fd < 0) {\n \t\tret = -errno;\n \t\tLOG(V4L2, Error)\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "1/6"
    ]
}