Skip to contentSkip to conversation

libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public, header

PATCH New Leo Izen 1 participant 2 messages Jun 4, 2025 – Jun 5, 2025

Subsystems (2)
lore
Share & tools
lore

Leo Izen

author
#0 lore raw

PATCH 1/1 libv4l2: prefix HAVE_POSIX_IOCTL with LIBV4L_ for public, header

From b80603d4088fd30fd9d7b6b56490e7e138551e9d Mon Sep 17 00:00:00 2001
From: Leo Izen <[email protected]>
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.

---
 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(-)
lib/include/libv4l2.h +1 -1
index 16565555..25ababc7 100644
@@ -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, ...);
lib/libv4l1/v4l1compat.c +1 -1
index 2db68423..c4ca3a70 100644
@@ -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, ...)
lib/libv4l2/libv4l2.c +1 -1
index 1607ec35..289501d9 100644
@@ -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, ...)
lib/libv4l2/v4l2convert.c +1 -1
index 396ed3ea..b33472e5 100644
@@ -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, ...)
meson.build +1 -1
index 88781e59..590ef11e 100644
@@ -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 = []
Signature · 1 line
2.49.0

From b80603d4088fd30fd9d7b6b56490e7e138551e9d Mon Sep 17 00:00:00 2001
From: Leo Izen <[email protected]>
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.

---
 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(-)
lib/include/libv4l2.h +1 -1
index 16565555..25ababc7 100644
@@ -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, ...);
lib/libv4l1/v4l1compat.c +1 -1
index 2db68423..c4ca3a70 100644
@@ -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, ...)
lib/libv4l2/libv4l2.c +1 -1
index 1607ec35..289501d9 100644
@@ -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, ...)
lib/libv4l2/v4l2convert.c +1 -1
index 396ed3ea..b33472e5 100644
@@ -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, ...)
meson.build +1 -1
index 88781e59..590ef11e 100644
@@ -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 = []
Signature · 1 line
2.49.0
author
#1 lore raw

PATCH 1/1 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.

---
 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(-)
lib/include/libv4l2.h +1 -1
index 16565555..25ababc7 100644
@@ -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, ...);
lib/libv4l1/v4l1compat.c +1 -1
index 2db68423..c4ca3a70 100644
@@ -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, ...)
lib/libv4l2/libv4l2.c +1 -1
index 1607ec35..289501d9 100644
@@ -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, ...)
lib/libv4l2/v4l2convert.c +1 -1
index 396ed3ea..b33472e5 100644
@@ -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, ...)
meson.build +1 -1
index 88781e59..590ef11e 100644
@@ -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 = []
Signature · 1 line
2.49.0