From patchwork Fri Mar 31 21:35:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 669327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C192C76196 for ; Fri, 31 Mar 2023 21:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232932AbjCaVfH (ORCPT ); Fri, 31 Mar 2023 17:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbjCaVfG (ORCPT ); Fri, 31 Mar 2023 17:35:06 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC3B1EFE8 for ; Fri, 31 Mar 2023 14:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1680298504; i=ps.report@gmx.net; bh=nYQwD9PTnIV16rk+6rCYGfdwng+QWXHUl9sOdkX4DZw=; h=X-UI-Sender-Class:From:To:Subject:Date; b=tnufBGG22rR1LoM8PQLsaWyowt1I3ZdMzPc+gAE6XsnH6o9kzsKd2CXD0myn58Vhg 2Q5IXsDJ6HfsBcyY7ujCuSh8PTVG9EZIubRMVL0wpKmeZ+ZeZe6ee68MLaBBy4KgtM Tr1brm21wz4y9hx8VCsahhyKo9vENwN6zKt6lZcrVJUf5PMZQF3uboFbyzyONYWRcA CWFlt8P/7NyEgQmmJ1GtQqJ6JoVevMjsDPcnD9HF5QG+hQwri+0HSQUkRtMpJCQQGl WOrZaUgo5GfFfl2PjJCe9LHufkMLMqB6ht+RVN9zyZpXDRpC/CSl+jqNmWicZPFQms nCEtDzTd0PVVA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([62.216.208.135]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N9MpS-1qTkSx3Hz2-015JtD for ; Fri, 31 Mar 2023 23:35:03 +0200 From: Peter Seiderer To: linux-media@vger.kernel.org Subject: [PATCH v4l-utils v1 1/2] v4l2-tracer: wrap open64/mmap64 functions only if linux && __GLIBC__ Date: Fri, 31 Mar 2023 23:35:02 +0200 Message-Id: <20230331213503.24082-1-ps.report@gmx.net> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:K81SeGxUXxoWqJxeWBsr8LidD3xlAkKtWymuZMWgJIK9v42j7Eg LNplLmQb4cZ942/eH7tUPNZYo8DD+lSQzuZFlvFr/I69YCs7NqsFdMPm/d0wwLpEgOvr/QV pfCidFGBFgrXvLtelt68YRwKOeZec15sshWr0+rfAKWrZae9bSqT957TZOEFN+MsWZobYUR SdS1Q66sV8s0RwrPi/1jg== UI-OutboundReport: notjunk:1;M01:P0:8iTC5RhBV40=;IXTzJlq+rDoWG30UgARvv4BK56+ odzmHrbzV9wQi1zUyZVZzuVC/GhAxvR2zsUHOBz5PlEmuYOi4fj7l7sk4mOHz6arBeGXNEJ4Q cGTCxXVA3OLQTYudqdjo50nBb5klaQPUCUxewMGWVom/WB2kA2XjnGzTbscjIaiKrhm2wRwHH ZDf1RW/jhvL9moz0yzkbbzavz4UB/ez+yx3WQi4HPR1aGabws+8bqW2+e6D5rt0dmFGoTFrOC tV0FvmNquk8nGjuvt/3L3DJWGEmkK8wza1/ICXPUb7q0lJOF2i9GcR+FaXQovRYYos9lqUdXH 44Vt/ToKrWpIuE6R26BMZ9tEDyBMLBnDqSrBGrJdjQF+v3Z9uBpZTX1gGzWjNrJT9bNqvQUTL 8T38IwXNudUrZhxto6UYySY+TusXVOR+VO/f0b/7+Xs5ubE3Uv03tkTrWFWCfeLpNBOsO0aHf Tp1qV6KpdS6w8LB7gY4BBrowUWA/z3j7IoTL3ORyTmk+zY1TZwpbvGgPoQzfrOqV5gmGce8qR H73kmXIzSMhKIDpLFrfg1BI3AVvEUXI1vPtgij07PxJU9OHpUl6DLGmdRVzHtbkJOFbEkTVbq KGZ5zHjrnuwoeqJNeFX4AtiYdxmOxdFPGPYEmRN0Op79YPE31U6w2m3hFyRJoGjsf64FlQRbg OLPHid73xnv1HySjDldp1E78vTJfRBjv9YMp6PwxM/fs1uwGXYHVVJqa8Xpi6odWxZkl0lNlQ ts5kl0pm+Et1UBPbE0TPma0/GhXmFbfNTrV8NZge1HHNva6841KJubtSzHdkdz/zS5VT3UB+D MgYKkhRv7Ulr3sKEfpErxsrJpv9XQ0ciffSqA591CugWx9oQfMzBPwSmBBUuGAA4bAGax8R0A fvmgAhKDnmuGrFBlPgUkH4X4/JC530KjThdd4N4EN5IxBsQDZb2bYf4ApkYW7RKWTO59jh6OT 4I4DNVAk7E0l6Z12vz00Qy9udF4= Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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) { From patchwork Fri Mar 31 21:35:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 669706 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3500C761A6 for ; Fri, 31 Mar 2023 21:35:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232973AbjCaVfI (ORCPT ); Fri, 31 Mar 2023 17:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230064AbjCaVfH (ORCPT ); Fri, 31 Mar 2023 17:35:07 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B783120D9A for ; Fri, 31 Mar 2023 14:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1680298504; i=ps.report@gmx.net; bh=iW0T5BT7BblpskLAJZrB8GeGcLqNHbw25J4oVc85lJU=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=Z57s6mM2KgI/t3mF8sTKn7K1Pg6f6qH0Lqpq5E3gCSTYfthbzrZFymOwPlhNCORmT p/S3pkCXaLe2+oPpoht2aOTQyppV12P/XibsP69lCSeWwTetfe2hWbPcVifbPg+W8j FekTPAY255znKPIsj4UmT1dr2yoAmTyTL4vi+amNSwv8CS5Xw33CdLrZkTmqrzFqEm xuAZIVr/rAwCKRPRutj7lBRATEuazIWi2Coq/khxxWfQp80ZniXh9z2TWpqsECxtrm 8u6wUa+xykaphV+K4/Dr3BaPlRtXdnN5FLpkUP4AyRP059aQrDJufsSWCeT6vkD7mU z4vFgU+a/UzFw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([62.216.208.135]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mv2xO-1qZE6J3zeq-00r2gR for ; Fri, 31 Mar 2023 23:35:04 +0200 From: Peter Seiderer To: linux-media@vger.kernel.org Subject: [PATCH v4l-utils v1 2/2] libv4l1/libv4l2/v4l2-tracer: use common meson c_args/cpp_args to disable transparent large file support Date: Fri, 31 Mar 2023 23:35:03 +0200 Message-Id: <20230331213503.24082-2-ps.report@gmx.net> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230331213503.24082-1-ps.report@gmx.net> References: <20230331213503.24082-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:axv893YlEAzi8NvllQC1N/rQ1xBdsFMvqcfhT5zLMEMnnXvrlL2 0dzosCsBxIMa45UzA6n4LJNV63CKYTWqqwErsbQGzyPETa7cPmjgne2LnYrFgQp6Wnbc4el /1EX0Lc4AM2t0N6o2fbil0eurxYVHp6Qx0voI+tpkJRyQfy8pUVc62qXa9u8GdtliV/utcI c6QgiSxvEcek4yLbIbt6Q== UI-OutboundReport: notjunk:1;M01:P0:RTgentn6KcM=;NPTSdfH+u+pV/zI0C0nMSVd2SYd iYapIDVz53HQwtpvh4PoUzr+hop7iXu+qUdzPlg22hD9SJxjH2So+fdvLNMlcdyI/Emlu3u9f L9nwNaMD3s82sbX1nBVDry/lqSh2RvoddwSvETMeMEulgBTmQBLHwUCTWoPqA8e8FgBgPgSOQ aRr0hISabeNdFb/p/Dcp4Dnkc1Pk8CJgo4vL/m8Bw0C1a8QYcLJkVOgf7srfyFBFNkw9WYu/+ yrF6iWD19JcCtwNcR+gTGOlROdE4vugnZOUKl+n9ZSQQscwlSUKXJwwWsJzEeZgvQ9r5kzxmj oRkDtL2l+RsM5s+j97m3Ukd23G2c7gSv13V2ZcHZjX0pClbl1USvLydbWh4wbNgQx+q2dKec7 uL4jCq9D7yt8tL/eqqnitsJjc6kGxRpuk1KR8fXTy+COz2N7XOQ6e7Poe3F/o105ZluxELjIW 5lqLPc39iZvb6mhAi7SEIuw7tp81rXeJp2dFVG+VS/alnyUlum6G/8KHmam+tUgrRJQpsYID4 zgR4RfzC3EZ21y+ELIf/UHIsL2lJtZcULshD8IxxVJ4BD9RDw3SDbfLOSxcss+YJFTqJ96edi 4g35cghYyL3alto4ymTG4cG1Lxr1fJI3o3Df8sGanW/GcIr66pRyW93B2RcWMRsTad8khxyzF ERPXviatHzE8gls8spm4En+jN6Keye5fNOezFSfoasU9mg4MKvhz2/JlRyDBX2GwUDKwvJ3P0 QZ9RwBzez7g/oDlQW4XCOa0HAEhEFa6yYfEk1JPj4DahUeX4P2++/zSCMN+sMbEQc97zl0/UK ybyAUOORHSXvIqjG37wM301DuBV67QhH7pOj69K8HCxI/Dpj5pmnWV0nOyOaeAXDO9c+ibAmg PYBR4fTMM9rQ66I1NsG0mk3jiUXuEA8Aqv714xBfF2pb+Wi8L/VUuI/tJvFODsuuH8/6Ih1SV khTTVA== Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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 #include #include 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 #include #include 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)