[v4l-utils] libv4l2: Guard the v4l2_ioctl function with HAVE_POSIX_IOCTL
Checks
Commit Message
Lack of this check leads to issues on musl-based system. Even though
compilation of libv4l2 itself with musl doesn't cause any errors,
using the library inside gst-plugins-v4l2 causes a compiler error
due to mismatch of the ioctl signature.
A similar check is already performed in v4l2convert.c, so the change
doesn't bring any inconsistency.
Link: https://bugs.gentoo.org/896418
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
---
lib/include/libv4l2.h | 4 ++++
lib/libv4l2/libv4l2.c | 4 ++++
2 files changed, 8 insertions(+)
@@ -63,7 +63,11 @@ LIBV4L_PUBLIC extern FILE *v4l2_log_file;
LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
LIBV4L_PUBLIC int v4l2_close(int fd);
LIBV4L_PUBLIC int v4l2_dup(int fd);
+#ifdef HAVE_POSIX_IOCTL
+LIBV4L_PUBLIC int v4l2_ioctl(int fd, int request, ...);
+#else
LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
+#endif
LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n);
LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n);
LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags,
@@ -1051,7 +1051,11 @@ static int v4l2_s_fmt(int index, struct v4l2_format *dest_fmt)
return 0;
}
+#ifdef HAVE_POSIX_IOCTL
+int v4l2_ioctl(int fd, int request, ...)
+#else
int v4l2_ioctl(int fd, unsigned long int request, ...)
+#endif
{
void *arg;
va_list ap;