Patch Detail
Show a patch.
GET /api/1.1/patches/2492/?format=api
{ "id": 2492, "url": "https://patchwork.libcamera.org/api/1.1/patches/2492/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2492/", "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": "<20200104001414.12755-3-paul.elder@ideasonboard.com>", "date": "2020-01-04T00:14:10", "name": "[libcamera-devel,v6,2/5] libcamera: v4l2_device, v4l2_videodevice: call open system call directly", "commit_ref": null, "pull_url": null, "state": "accepted", "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/2492/mbox/", "series": [ { "id": 599, "url": "https://patchwork.libcamera.org/api/1.1/series/599/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=599", "date": "2020-01-04T00:14:08", "name": "V4L2 compatibility layer", "version": 6, "mbox": "https://patchwork.libcamera.org/series/599/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2492/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2492/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 74D76605F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 4 Jan 2020 01:14:22 +0100 (CET)", "from neptunite.amanokami.net (unknown [96.44.9.94])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 960AC30F;\n\tSat, 4 Jan 2020 01:14:21 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578096862;\n\tbh=cJ4doNACkRAvl6emH6u+vt7JJyYOV24VtKum3YrL3EU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BQ4ZayhtPN5mUAWxNesA7kcQ5GvWLy5Gl/o5hj3BulpxwUUMaVlSf+BbeNTlF8pB/\n\tpYKlvepIpTyK6vPT6bb5hr4RcWwQQLliglqpw1V9E8LpQpyYCjVdFkoF5mgEsPXq2y\n\tORkZfqqRxMQXMccELkWVrkIIS5L8SCkSMxLqfWkw=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 3 Jan 2020 19:14:10 -0500", "Message-Id": "<20200104001414.12755-3-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200104001414.12755-1-paul.elder@ideasonboard.com>", "References": "<20200104001414.12755-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v6 2/5] 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": "Sat, 04 Jan 2020 00:14:22 -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---\nNo change in v6\n\nNo change in v5\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", "v6", "2/5" ] }