Age | Commit message (Collapse) | Author |
|
Some applications (eg. Firefox, Google Chrome, Skype) use open64,
openat64, and mmap64 instead of their non-64 versions that we currently
intercept. Intercept these calls as well. _LARGEFILE64_SOURCE needs to
be set so that the 64-bit symbols are available and not synonymous to
the non-64-bit versions on 64-bit systems.
Also, since we set _FILE_OFFSET_BITS to 32 to force the various open and
mmap symbols that we export to not be the 64-bit versions, our dlsym to
get the original open and mmap calls will not automatically be converted
to their 64-bit versions. Since we intercept both 32-bit and 64-bit
versions of open and mmap, we should be using the 64-bit version to
service both. Fetch the 64-bit versions of openat and mmap directly.
musl defines the 64-bit symbols as macros that are equivalent to the
non-64-bit symbols, so we put compile guards that check if the 64-bit
symbols are defined.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # Compile with musl
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The V4L2 compatibility layer is licensed under the GPL. It is compiled
as a binary separate from libcamera.so, and is loaded into the address
space of processes through LD_PRELOAD to intercept calls to the C
library.
It is our understanding and intent that the GPL license doesn't
propagate to the binaries whose calls are intercepted, considering those
binaries are not derivative work of the V4L2 compatibility layer and are
not designed to be linked to the V4L2 compatibility layer. There is
however a possibly grey area if binaries are packaged with a shell
script wrapper that loads the V4L2 compatibility layer. This could lead
to license-related issues if such packaging is performed by Linux
distributions or system integrators.
To clarify the intent and lift the doubts, relicense the V4L2
compatibility layer under the LGPL. The V4L2 compatibility layer code
itself still benefits from the license protection, while its usage with
third-party binaries is clearly allowed as intended.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
|
|
The __open_2() and __openat_2() functions are defined by glibc as taking
2 and 3 arguments respectively, with variadic arguments for the file
mode as open() and openat() do. The V4L2 compatibility layer defines
them as aliases for open() and openat(), which results in compilation
failures with gcc:
../../src/v4l2/v4l2_compat.cpp: In function ‘int __openat_2(int, const char*, int)’:
../../src/v4l2/v4l2_compat.cpp:58:14: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
58 | return open(dirfd, path, oflag);
| ^~~~~
| |
| int
../../src/v4l2/v4l2_compat.cpp:31:39: note: initializing argument 1 of ‘int open(const char*, int, ...)’
31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)
| ~~~~~~~~~~~~^~~~
../../src/v4l2/v4l2_compat.cpp:58:21: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive]
58 | return open(dirfd, path, oflag);
| ^~~~
| |
| const char*
../../src/v4l2/v4l2_compat.cpp:31:49: note: initializing argument 2 of ‘int open(const char*, int, ...)’
31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)
|
Fix this by defining the two functions as wrappers around open() and
openat() without variadic arguments.
Fixes: 0ce8f2390b52 ("v4l2: v4l2_compat: Add V4L2 compatibility layer")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add libcamera V4L2 compatibility layer.
This initial implementation supports the minimal set of V4L2 operations,
which allows getting, setting, and enumerating formats, and streaming
frames from a video device. Some data about the wrapped V4L2 video
device are hardcoded.
Add a build option named 'v4l2' and adjust the build system to
selectively compile the V4L2 compatibility layer.
For now we match the V4L2 device node to a libcamera camera based on a
devnum that a pipeline handler may optionally map to a libcamera
camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|