All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__
@ 2023-03-31 21:35 Peter Seiderer
  2023-03-31 21:35 ` [PATCH v4l-utils v1 2/2] libv4l1/libv4l2/v4l2-tracer: use common meson c_args/cpp_args to disable transparent large file support Peter Seiderer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Seiderer @ 2023-03-31 21:35 UTC (permalink / raw
  To: linux-media

Wrap open64/mmap64 functions only if linux && __GLIBC__, as done
in lib/libv4l1/v4l1comapt.c and lib/libv4l2/v4l2convert.c since
commit 'libv4l: Wrap LFS64 functions only if linux && __GLIBC__'
(403a4e2697a1ff96fe2fa16589039595f21cadf0), should fix musl libc
compile.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 utils/v4l2-tracer/libv4l2tracer.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp
index a9f039c7..68f6304a 100644
--- a/utils/v4l2-tracer/libv4l2tracer.cpp
+++ b/utils/v4l2-tracer/libv4l2tracer.cpp
@@ -89,6 +89,7 @@ int open(const char *path, int oflag, ...)
 	return fd;
 }
 
+#if defined(linux) && defined(__GLIBC__)
 int open64(const char *path, int oflag, ...)
 {
 	errno = 0;
@@ -124,6 +125,7 @@ int open64(const char *path, int oflag, ...)
 
 	return fd;
 }
+#endif
 
 int close(int fd)
 {
@@ -177,6 +179,7 @@ void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
 	return buf_address_pointer;
 }
 
+#if defined(linux) && defined(__GLIBC__)
 void *mmap64(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
 {
 	errno = 0;
@@ -191,6 +194,7 @@ void *mmap64(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
 
 	return buf_address_pointer;
 }
+#endif
 
 int munmap(void *start, size_t length)
 {
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4l-utils v1 2/2] libv4l1/libv4l2/v4l2-tracer: use common meson c_args/cpp_args to disable transparent large file support
  2023-03-31 21:35 [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__ Peter Seiderer
@ 2023-03-31 21:35 ` Peter Seiderer
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Seiderer @ 2023-03-31 21:35 UTC (permalink / raw
  To: linux-media

Use common meson c_args/cpp_args to disable transparent large
file support for the wrappers as already done in utils/v4l2-tracer
for lib/libv4l1/v4l1compat.c and lib/libv4l2/v4l2convert.c too.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 lib/libv4l1/meson.build       |  1 +
 lib/libv4l1/v4l1compat.c      |  5 -----
 lib/libv4l2/meson.build       |  1 +
 lib/libv4l2/v4l2convert.c     |  5 -----
 meson.build                   | 10 ++++++++++
 utils/v4l2-tracer/meson.build | 13 +------------
 6 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/lib/libv4l1/meson.build b/lib/libv4l1/meson.build
index e1df2fa2..e1fba346 100644
--- a/lib/libv4l1/meson.build
+++ b/lib/libv4l1/meson.build
@@ -60,5 +60,6 @@ v4l1compat = shared_module('v4l1compat',
                            name_prefix : '',
                            install : true,
                            install_dir : libv4l1privdir,
+                           c_args : v4l2_wrapper_args,
                            dependencies : v4l1compat_deps,
                            include_directories : v4l2_utils_incdir)
diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c
index 705d7d4b..2db68423 100644
--- a/lib/libv4l1/v4l1compat.c
+++ b/lib/libv4l1/v4l1compat.c
@@ -19,11 +19,6 @@
 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
  */
 
-/* ensure we see *64 variants and they aren't transparently used */
-#undef _LARGEFILE_SOURCE
-#undef _FILE_OFFSET_BITS
-#define _LARGEFILE64_SOURCE 1
-
 #include <stdlib.h>
 #include <stdarg.h>
 #include <fcntl.h>
diff --git a/lib/libv4l2/meson.build b/lib/libv4l2/meson.build
index bd6e0e7f..9d6ecd5f 100644
--- a/lib/libv4l2/meson.build
+++ b/lib/libv4l2/meson.build
@@ -69,5 +69,6 @@ v4l2convert = shared_module('v4l2convert',
                             name_prefix : '',
                             install : true,
                             install_dir : libv4l2privdir,
+                            c_args : v4l2_wrapper_args,
                             dependencies : v4l2convert_deps,
                             include_directories : v4l2_utils_incdir)
diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c
index 97bed9a9..396ed3ea 100644
--- a/lib/libv4l2/v4l2convert.c
+++ b/lib/libv4l2/v4l2convert.c
@@ -23,11 +23,6 @@
 /* prevent GCC 4.7 inlining error */
 #undef _FORTIFY_SOURCE
 
-/* ensure we see *64 variants and they aren't transparently used */
-#undef _LARGEFILE_SOURCE
-#undef _FILE_OFFSET_BITS
-#define _LARGEFILE64_SOURCE 1
-
 #include <stdarg.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/meson.build b/meson.build
index 1e76b0f4..75398917 100644
--- a/meson.build
+++ b/meson.build
@@ -47,6 +47,16 @@ common_arguments = [
     '-include', meson.current_build_dir() / 'config.h',
 ]
 
+v4l2_wrapper_args = [
+    # As the library needs to provide both 32-bit and 64-bit versions
+    # of file operations, disable transparent large file support (fixes
+    # 'Error: symbol `open64/mmap64' is already defined' compile failure
+    # otherwise)
+    '-U_FILE_OFFSET_BITS',
+    '-D_FILE_OFFSET_BITS=32',
+    '-D_LARGEFILE64_SOURCE',
+]
+
 v4l2_utils_incdir_arr = [
     'lib' / 'include',
 ]
diff --git a/utils/v4l2-tracer/meson.build b/utils/v4l2-tracer/meson.build
index ed2c1df8..47c0a1f6 100644
--- a/utils/v4l2-tracer/meson.build
+++ b/utils/v4l2-tracer/meson.build
@@ -70,21 +70,10 @@ libv4l2_tracer_incdir = [
     v4l2_utils_incdir,
 ]
 
-libv4l2_tracer_cpp_args = [
-    # Meson enables large file support unconditionally, which redirects file
-    # operations to 64-bit versions. This results in some symbols being
-    # renamed, for instance open() being renamed to open64(). As the library
-    # needs to provide both 32-bit and 64-bit versions of file operations,
-    # disable transparent large file support.
-    '-U_FILE_OFFSET_BITS',
-    '-D_FILE_OFFSET_BITS=32',
-    '-D_LARGEFILE64_SOURCE',
-]
-
 libv4l2tracer = shared_module('v4l2tracer',
                               libv4l2tracer_sources,
                               install : true,
-                              cpp_args : libv4l2_tracer_cpp_args,
+                              cpp_args : v4l2_wrapper_args,
                               dependencies : libv4l2tracer_deps,
                               include_directories : libv4l2_tracer_incdir)
 
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__
@ 2023-11-16 12:19 Peter Seiderer
  2023-11-16 12:31 ` Peter Seiderer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Seiderer @ 2023-11-16 12:19 UTC (permalink / raw
  To: linux-media

Wrap open64/mmap64 functions only if linux && __GLIBC__, as done
in lib/libv4l1/v4l1comapt.c and lib/libv4l2/v4l2convert.c since
commit 'libv4l: Wrap LFS64 functions only if linux && __GLIBC__'
(403a4e2697a1ff96fe2fa16589039595f21cadf0), should fix musl libc
compile.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 utils/v4l2-tracer/libv4l2tracer.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp
index a9f039c7..68f6304a 100644
--- a/utils/v4l2-tracer/libv4l2tracer.cpp
+++ b/utils/v4l2-tracer/libv4l2tracer.cpp
@@ -89,6 +89,7 @@ int open(const char *path, int oflag, ...)
 	return fd;
 }
 
+#if defined(linux) && defined(__GLIBC__)
 int open64(const char *path, int oflag, ...)
 {
 	errno = 0;
@@ -124,6 +125,7 @@ int open64(const char *path, int oflag, ...)
 
 	return fd;
 }
+#endif
 
 int close(int fd)
 {
@@ -177,6 +179,7 @@ void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
 	return buf_address_pointer;
 }
 
+#if defined(linux) && defined(__GLIBC__)
 void *mmap64(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
 {
 	errno = 0;
@@ -191,6 +194,7 @@ void *mmap64(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
 
 	return buf_address_pointer;
 }
+#endif
 
 int munmap(void *start, size_t length)
 {
-- 
2.40.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__
  2023-11-16 12:19 [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__ Peter Seiderer
@ 2023-11-16 12:31 ` Peter Seiderer
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Seiderer @ 2023-11-16 12:31 UTC (permalink / raw
  To: linux-media

Ups..., wrong command line resulted in resend of old patches, please ignore
and sorry for the noise...

Regards,
Peter


On Thu, 16 Nov 2023 13:19:46 +0100, Peter Seiderer <ps.report@gmx.net> wrote:

> Wrap open64/mmap64 functions only if linux && __GLIBC__, as done
> in lib/libv4l1/v4l1comapt.c and lib/libv4l2/v4l2convert.c since
> commit 'libv4l: Wrap LFS64 functions only if linux && __GLIBC__'
> (403a4e2697a1ff96fe2fa16589039595f21cadf0), should fix musl libc
> compile.
>
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
>  utils/v4l2-tracer/libv4l2tracer.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp
> index a9f039c7..68f6304a 100644
> --- a/utils/v4l2-tracer/libv4l2tracer.cpp
> +++ b/utils/v4l2-tracer/libv4l2tracer.cpp
> @@ -89,6 +89,7 @@ int open(const char *path, int oflag, ...)
>  	return fd;
>  }
>
> +#if defined(linux) && defined(__GLIBC__)
>  int open64(const char *path, int oflag, ...)
>  {
>  	errno = 0;
> @@ -124,6 +125,7 @@ int open64(const char *path, int oflag, ...)
>
>  	return fd;
>  }
> +#endif
>
>  int close(int fd)
>  {
> @@ -177,6 +179,7 @@ void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
>  	return buf_address_pointer;
>  }
>
> +#if defined(linux) && defined(__GLIBC__)
>  void *mmap64(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
>  {
>  	errno = 0;
> @@ -191,6 +194,7 @@ void *mmap64(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
>
>  	return buf_address_pointer;
>  }
> +#endif
>
>  int munmap(void *start, size_t length)
>  {


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-16 12:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-31 21:35 [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__ Peter Seiderer
2023-03-31 21:35 ` [PATCH v4l-utils v1 2/2] libv4l1/libv4l2/v4l2-tracer: use common meson c_args/cpp_args to disable transparent large file support Peter Seiderer
  -- strict thread matches above, loose matches on Subject: below --
2023-11-16 12:19 [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__ Peter Seiderer
2023-11-16 12:31 ` Peter Seiderer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.