From patchwork Mon Dec 9 04:56:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 2409 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 65F7960BFE for ; Mon, 9 Dec 2019 05:56:14 +0100 (CET) Received: from neptunite.amanokami.net (unknown [96.44.9.94]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5223452B; Mon, 9 Dec 2019 05:56:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1575867373; bh=qCIBG1+qD8/KRjYV7461m/C4W8HEh6NWfc3knAlrt2U=; h=From:To:Cc:Subject:Date:From; b=l2J3A76ZrmEpiBygvAlbPp1iM8cwAgxKA+C65WJL8U+WAWI9N4XCxJSLOCbueStLU lEzpMfzsXcGpV1Pi6uF5P34jsyoAFAs5csWLr4uM/Pnhy8vuxDvPnQle4Ilm9YVjyi ip7127F3i9PU3l19p5p3A0jY4twiTxze7JcTprsg= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Sun, 8 Dec 2019 23:56:02 -0500 Message-Id: <20191209045603.6245-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/2] libcamera: v4l2_device, v4l2_videodevice: call open system call directly X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2019 04:56:14 -0000 We are preparing to integrate the V4L2 adaptation layer, which will intercept open() calls (among others) via LD_PRELOAD. To prevent libcamera's own open() calls from being intercepted, replace them with a direct syscall. Signed-off-by: Paul Elder Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- No change in v2 --- src/libcamera/v4l2_device.cpp | 3 ++- src/libcamera/v4l2_videodevice.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 0452f801..f16931a3 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "log.h" @@ -75,7 +76,7 @@ int V4L2Device::open(unsigned int flags) return -EBUSY; } - int ret = ::open(deviceNode_.c_str(), flags); + int ret = syscall(SYS_open, deviceNode_.c_str(), flags); if (ret < 0) { ret = -errno; LOG(V4L2, Error) << "Failed to open V4L2 device: " diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 99213075..2dff3d3c 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1427,7 +1428,7 @@ int V4L2M2MDevice::open() * as the V4L2VideoDevice::open() retains a handle by duplicating the * fd passed in. */ - fd = ::open(deviceNode_.c_str(), O_RDWR | O_NONBLOCK); + fd = syscall(SYS_open, deviceNode_.c_str(), O_RDWR | O_NONBLOCK); if (fd < 0) { ret = -errno; LOG(V4L2, Error)