void-packages/srcpkgs/v4l-utils/patches/musl-ioctl.patch
2025-03-17 16:36:40 -07:00

56 lines
1.9 KiB
Diff

From fd882f9e77b13cbc6a669e6836c3943393b44152 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <vadorovsky@gmail.com>
Date: Fri, 6 Sep 2024 14:46:31 +0200
Subject: libv4l2: Guard the v4l2_ioctl function with HAVE_POSIX_IOCTL
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>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
---
lib/include/libv4l2.h | 4 ++++
lib/libv4l2/libv4l2.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h
index ea1870db..16565555 100644
--- a/lib/include/libv4l2.h
+++ b/lib/include/libv4l2.h
@@ -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,
diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c
index 032a4f1c..1607ec35 100644
--- a/lib/libv4l2/libv4l2.c
+++ b/lib/libv4l2/libv4l2.c
@@ -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;
--
cgit v1.2.3