{"id":2408,"url":"https://patchwork.libcamera.org/api/1.1/patches/2408/?format=json","web_url":"https://patchwork.libcamera.org/patch/2408/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191206092654.24340-1-paul.elder@ideasonboard.com>","date":"2019-12-06T09:26:53","name":"[libcamera-devel,1/2] libcamera: v4l2_device, v4l2_videodevice: call open system call directly","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"64d5e1f6da0151199239b0af60d106e9867ba9ab","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2408/mbox/","series":[{"id":584,"url":"https://patchwork.libcamera.org/api/1.1/series/584/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=584","date":"2019-12-06T09:26:54","name":"[libcamera-devel,1/2] libcamera: v4l2_device, v4l2_videodevice: call open system call directly","version":1,"mbox":"https://patchwork.libcamera.org/series/584/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2408/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2408/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 747AF60C0A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Dec 2019 10:27:13 +0100 (CET)","from neptunite.amanokami.net (unknown [96.44.9.94])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C1E8A2E5;\n\tFri,  6 Dec 2019 10:27:11 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1575624432;\n\tbh=GrUzwIRZPBoOL5Gq8kItruoDlY0Hd7nZjwdSM4r3BT4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=ksDlSRh0Skrdg7YcfzJoXDttpgOQPCV5SKfSYgLozcXYOnkEZYP5h9O7ZT7oXA7q4\n\t2jysvYdho/TAggdrlpWS8ZlaHp91vhZVtzc0Qy6KmMPx7NAz1fuYHZCVYrrbqg6xQP\n\t8SEPm3Tdi5sF+K0ETWQ4QBzsRl2atQx6qupLJBtc=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  6 Dec 2019 04:26:53 -0500","Message-Id":"<20191206092654.24340-1-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.23.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/2] 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, 06 Dec 2019 09:27:13 -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 will a\ndirect syscall.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\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..f16931a3 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_open, 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 99213075..2dff3d3c 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@@ -1427,7 +1428,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_open, deviceNode_.c_str(), O_RDWR | O_NONBLOCK);\n \tif (fd < 0) {\n \t\tret = -errno;\n \t\tLOG(V4L2, Error)\n","prefixes":["libcamera-devel","1/2"]}