Patch Detail
Show a patch.
GET /api/1.1/patches/2486/?format=api
{ "id": 2486, "url": "https://patchwork.libcamera.org/api/1.1/patches/2486/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2486/", "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": "<20200103054120.30979-2-paul.elder@ideasonboard.com>", "date": "2020-01-03T05:41:17", "name": "[libcamera-devel,v5,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/2486/mbox/", "series": [ { "id": 598, "url": "https://patchwork.libcamera.org/api/1.1/series/598/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=598", "date": "2020-01-03T05:41:16", "name": "V4L2 compatibility layer", "version": 5, "mbox": "https://patchwork.libcamera.org/series/598/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2486/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2486/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 B8E5B605E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 3 Jan 2020 06:41:28 +0100 (CET)", "from neptunite.amanokami.net (unknown [96.44.9.94])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DA92EA3C;\n\tFri, 3 Jan 2020 06:41:27 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578030088;\n\tbh=7k/LtAKn5SvZJZZrPQPHmdjYI4nRdibYZevxzLT6R5I=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=tDQTzVBwcLD2fEgvzvOwZcLPr6r0BP0c0giA/1asj6vwZWZ3lytbwvgnjTLP6drGy\n\td9+9SaXnhLIjyVcGspTwYrhxU67o+CFRHoUxIKOP2VjLJI9DQX4ne8zFgs7rl1jL3p\n\tlGVXgK9/999nwdQaqY3iEB9SOxVNeeokyk/pzrq4=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 3 Jan 2020 00:41:17 -0500", "Message-Id": "<20200103054120.30979-2-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200103054120.30979-1-paul.elder@ideasonboard.com>", "References": "<20200103054120.30979-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 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": "Fri, 03 Jan 2020 05:41:28 -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 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", "v5", "1/4" ] }