Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame^] | 1 | From 5ce1e410965ed047a03c09b17796162f0363e396 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 13 Feb 2023 12:47:31 -0800 |
| 4 | Subject: [PATCH] v4l2: Define ioctl_req_t for posix/linux case |
| 5 | |
| 6 | this is an issue seen with musl based linux distros e.g. alpine [1] |
| 7 | musl is not going to change this since it breaks ABI/API interfaces |
| 8 | Newer compilers are stringent ( e.g. clang16 ) which can now detect |
| 9 | signature mismatches in function pointers too, existing code warned but |
| 10 | did not error with older clang |
| 11 | |
| 12 | Fixes |
| 13 | gstv4l2object.c:544:23: error: incompatible function pointer types assigning to 'gint (*)(gint, ioctl_req_t, ...)' (aka 'int (*)(int, unsigned long, ...)') from 'int (int, int, ...)' [-Wincompatible-function-pointer-types] |
| 14 | v4l2object->ioctl = ioctl; |
| 15 | ^ ~~~~~ |
| 16 | |
| 17 | [1] https://gitlab.alpinelinux.org/alpine/aports/-/issues/7580 |
| 18 | |
| 19 | Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3950] |
| 20 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 21 | --- |
| 22 | sys/v4l2/gstv4l2object.h | 2 ++ |
| 23 | 1 file changed, 2 insertions(+) |
| 24 | |
| 25 | diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h |
| 26 | index 3a5c961..4f43008 100644 |
| 27 | --- a/sys/v4l2/gstv4l2object.h |
| 28 | +++ b/sys/v4l2/gstv4l2object.h |
| 29 | @@ -76,6 +76,8 @@ typedef gboolean (*GstV4l2UpdateFpsFunction) (GstV4l2Object * v4l2object); |
| 30 | * 'unsigned long' for the 2nd parameter */ |
| 31 | #ifdef __ANDROID__ |
| 32 | typedef unsigned ioctl_req_t; |
| 33 | +#elif defined(__linux__) && !defined(__GLIBC__) /* musl/linux */ |
| 34 | +typedef int ioctl_req_t; |
| 35 | #else |
| 36 | typedef gulong ioctl_req_t; |
| 37 | #endif |
| 38 | -- |
| 39 | 2.39.1 |
| 40 | |