libcamera: v4l2_device, v4l2_videodevice: call open system call directly

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 <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Paul Elder 2019-12-06 04:09:32 -05:00
parent 4910ff05c0
commit 58a19b9d56
2 changed files with 5 additions and 2 deletions

View file

@ -11,6 +11,7 @@
#include <iomanip>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include <unistd.h>
#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_openat, AT_FDCWD, deviceNode_.c_str(), flags);
if (ret < 0) {
ret = -errno;
LOG(V4L2, Error) << "Failed to open V4L2 device: "