From b80603d4088fd30fd9d7b6b56490e7e138551e9d Mon Sep 17 00:00:00 2001 From: Leo Izen Date: Wed, 4 Jun 2025 14:50:05 -0400 Subject: [PATCH] libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public header Commit fd882f9e77b13cbc6a669e6836c3943393b44152 introduced the flag HAVE_POSIX_IOCTL to change which v4l2_ioctl function is declared in libv4l2.h, but this is a public header and may conflict with another project which may use HAVE_POSIX_IOCTL on its own to determine which ioctl funtion it should declare. This commit namespaces the flag so it can't conflict with another project's configuration. Notably, if it uses #if instead of #ifdef and defines HAVE_POSIX_IOCTL to be 0, then it will create an incompatible function signature between v4l2_ioctl and the project's. Signed-off-by: Leo Izen --- lib/include/libv4l2.h | 2 +- lib/libv4l1/v4l1compat.c | 2 +- lib/libv4l2/libv4l2.c | 2 +- lib/libv4l2/v4l2convert.c | 2 +- meson.build | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/include/libv4l2.h b/lib/include/libv4l2.h index 16565555..25ababc7 100644 --- a/lib/include/libv4l2.h +++ b/lib/include/libv4l2.h @@ -63,7 +63,7 @@ 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 +#ifdef LIBV4L_HAVE_POSIX_IOCTL LIBV4L_PUBLIC int v4l2_ioctl(int fd, int request, ...); #else LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...); diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c index 2db68423..c4ca3a70 100644 --- a/lib/libv4l1/v4l1compat.c +++ b/lib/libv4l1/v4l1compat.c @@ -90,7 +90,7 @@ LIBV4L_PUBLIC int dup(int fd) return v4l1_dup(fd); } -#ifdef HAVE_POSIX_IOCTL +#ifdef LIBV4L_HAVE_POSIX_IOCTL LIBV4L_PUBLIC int ioctl(int fd, int request, ...) #else LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...) diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c index 1607ec35..289501d9 100644 --- a/lib/libv4l2/libv4l2.c +++ b/lib/libv4l2/libv4l2.c @@ -1051,7 +1051,7 @@ static int v4l2_s_fmt(int index, struct v4l2_format *dest_fmt) return 0; } -#ifdef HAVE_POSIX_IOCTL +#ifdef LIBV4L_HAVE_POSIX_IOCTL int v4l2_ioctl(int fd, int request, ...) #else int v4l2_ioctl(int fd, unsigned long int request, ...) diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c index 396ed3ea..b33472e5 100644 --- a/lib/libv4l2/v4l2convert.c +++ b/lib/libv4l2/v4l2convert.c @@ -123,7 +123,7 @@ LIBV4L_PUBLIC int dup(int fd) return v4l2_dup(fd); } -#ifdef HAVE_POSIX_IOCTL +#ifdef LIBV4L_HAVE_POSIX_IOCTL LIBV4L_PUBLIC int ioctl(int fd, int request, ...) #else LIBV4L_PUBLIC int ioctl(int fd, unsigned long int request, ...) diff --git a/meson.build b/meson.build index 88781e59..590ef11e 100644 --- a/meson.build +++ b/meson.build @@ -365,7 +365,7 @@ ioctl_posix_test = ''' int ioctl (int, int, ...); ''' if cc.compiles(ioctl_posix_test) - conf.set('HAVE_POSIX_IOCTL', 1) + conf.set('LIBV4L_HAVE_POSIX_IOCTL', 1) endif c_arguments = [] -- 2.49.0