linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Only use _FILE_OFFSET_BITS with __GLIBC__
@ 2019-03-07 20:26 Heiko Becker
  2019-03-08 17:16 ` Lucas De Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Heiko Becker @ 2019-03-07 20:26 UTC (permalink / raw)
  To: linux-modules; +Cc: Heiko Becker

It's a glibc specific macro. With the musl libc {,l}stat64 are just
a macro defined for compatibility and off_t is always 64bit. The
former's expansion causes a build error though:
"...testsuite/path.c:191:21: error: redefinition of 'stat'".
---
 testsuite/path.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testsuite/path.c b/testsuite/path.c
index fa5fceb..74db898 100644
--- a/testsuite/path.c
+++ b/testsuite/path.c
@@ -187,7 +187,7 @@ WRAP_2ARGS(int, -1, mkdir, mode_t);
 WRAP_2ARGS(int, -1, access, int);
 WRAP_2ARGS(int, -1, stat, struct stat*);
 WRAP_2ARGS(int, -1, lstat, struct stat*);
-#ifndef _FILE_OFFSET_BITS
+#if defined(__GLIBC__) && !defined(_FILE_OFFSET_BITS)
 WRAP_2ARGS(int, -1, stat64, struct stat64*);
 WRAP_2ARGS(int, -1, lstat64, struct stat64*);
 WRAP_OPEN(64);
@@ -198,7 +198,7 @@ WRAP_OPEN();
 #ifdef HAVE___XSTAT
 WRAP_VERSTAT(__x,);
 WRAP_VERSTAT(__lx,);
-#ifndef _FILE_OFFSET_BITS
+#if defined(__GLIBC__) && !defined(_FILE_OFFSET_BITS)
 WRAP_VERSTAT(__x,64);
 WRAP_VERSTAT(__lx,64);
 #endif
-- 
2.21.0


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

* Re: [PATCH] Only use _FILE_OFFSET_BITS with __GLIBC__
  2019-03-07 20:26 [PATCH] Only use _FILE_OFFSET_BITS with __GLIBC__ Heiko Becker
@ 2019-03-08 17:16 ` Lucas De Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas De Marchi @ 2019-03-08 17:16 UTC (permalink / raw)
  To: Heiko Becker; +Cc: linux-modules

On Thu, Mar 7, 2019 at 12:32 PM Heiko Becker <heirecka@exherbo.org> wrote:
>
> It's a glibc specific macro. With the musl libc {,l}stat64 are just

Is it really glibc-specific? Just grepping uClibc for example returns
the macro there - this would probably break this libc. Do we have a
macro like this to test for musl? Another options would be to check if
these "functions" are implemented like macros and avoid the wrappers
in this case.

Lucas De Marchi

> a macro defined for compatibility and off_t is always 64bit. The
> former's expansion causes a build error though:
> "...testsuite/path.c:191:21: error: redefinition of 'stat'".
> ---
>  testsuite/path.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/testsuite/path.c b/testsuite/path.c
> index fa5fceb..74db898 100644
> --- a/testsuite/path.c
> +++ b/testsuite/path.c
> @@ -187,7 +187,7 @@ WRAP_2ARGS(int, -1, mkdir, mode_t);
>  WRAP_2ARGS(int, -1, access, int);
>  WRAP_2ARGS(int, -1, stat, struct stat*);
>  WRAP_2ARGS(int, -1, lstat, struct stat*);
> -#ifndef _FILE_OFFSET_BITS
> +#if defined(__GLIBC__) && !defined(_FILE_OFFSET_BITS)
>  WRAP_2ARGS(int, -1, stat64, struct stat64*);
>  WRAP_2ARGS(int, -1, lstat64, struct stat64*);
>  WRAP_OPEN(64);
> @@ -198,7 +198,7 @@ WRAP_OPEN();
>  #ifdef HAVE___XSTAT
>  WRAP_VERSTAT(__x,);
>  WRAP_VERSTAT(__lx,);
> -#ifndef _FILE_OFFSET_BITS
> +#if defined(__GLIBC__) && !defined(_FILE_OFFSET_BITS)
>  WRAP_VERSTAT(__x,64);
>  WRAP_VERSTAT(__lx,64);
>  #endif
> --
> 2.21.0
>


-- 
Lucas De Marchi

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

end of thread, other threads:[~2019-03-08 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 20:26 [PATCH] Only use _FILE_OFFSET_BITS with __GLIBC__ Heiko Becker
2019-03-08 17:16 ` Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).