This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 1/2] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Alistair Francis <alistair dot francis at wdc dot com>
- Cc: <libc-alpha at sourceware dot org>, <alistair23 at gmail dot com>
- Date: Thu, 3 Oct 2019 20:00:04 +0000
- Subject: Re: [PATCH v3 1/2] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts
- Ironport-sdr: bb8yzLfKrwh330vP9WVrNieCMheEI2L8WS7rVwM/i77GrDcupBZBzKEZ3Y6FlsGA52nNgQ88sx 9NsYAGLIIXWfLAqulVIJKul1gXQs0DyRIZ4pkoIMUMtUGy4aENMbfmdBkatYKjUL18ScRPsJs/ wBi2QxKbkRH7sCfjSd6CdxbCOv1kU+23xh+dySdmakALIn1WsRrZXQqzVe2kmV4BSpwcZpWEH4 zI0aGHGKS2/6VVdKRZxB6tbp//nr8+xI5hq/GsP8nzEYN2LDlt5WpehFpoN/eX0La7peI+TFPA fNg=
- Ironport-sdr: /+USO3H2Rtg8wzvh7Jfp+x4YEgV3H1vJXzoXMuYwWbXsQMCO2yiyinMxWUnu/brhJxoRr1ZL2d YH3nLJS3gY29FozccO4JkXvE7x++yEzmgHyOVbVvcT04SZyG4n21x9/RQe0fRolHgXxGyt6lhz OvXc2zsUuyWSIacyTMs7Ov4zHu/zaEMJEzWlGNvPe0wP6Zc1S85IisOhG/oqjlj1sJIG+SQzrt 9spaP5WKRaJSrevlQ84x/zpKa1AquRuaBkhhy0uZutwbXHDz/zPQd/AZxRoKQYtl9b9rqA3/c/ s2M=
- References: <20191003174131.18673-1-alistair.francis@wdc.com>
On Thu, 3 Oct 2019, Alistair Francis wrote:
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> index 1565f3f8248..0c1850322be 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> @@ -40,7 +40,10 @@
> /* Versions of the `xmknod' interface. */
> #define _MKNOD_VER_LINUX 0
>
> -#if defined __USE_FILE_OFFSET64
> +#if defined __USE_FILE_OFFSET64 || defined __INO_T_MATCHES_INO64_T
> +# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
> +# error "ino_t and off_t must both be the same type"
> +# endif
> # define __field64(type, type64, name) type64 name
> #elif __WORDSIZE == 64
Logically it feels like this actually should be added to the __WORDSIZE ==
64 case rather than the __USE_FILE_OFFSET64, so that the type names such
as __ino_t get used to define the fields rather than those such as
__ino64_t. (If that makes a difference to anything in practice, it should
just be to what typedef name debug info says was used to declare the
fields.)
There are actually three types involved, not two. If there's no other
place that needs to check whether blkcnt_t and blkcnt64_t match and so
needs a macro for that, I suppose some convenient .c file in linux/generic
could do
#if __INO_T_MATCHES_INO64_T
_Static_assert (sizeof (__blkcnt_t) == sizeof (__blkcnt64_t),
"__blkcnt_t and __blkcnt64_t must match");
#endif
to make sure the build fails if anyone tries to create a broken
configuration where some types match but not others.
--
Joseph S. Myers
joseph@codesourcery.com