[PATCH v4 1/2] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts

Joseph Myers joseph@codesourcery.com
Fri Oct 18 15:08:00 GMT 2019


On Wed, 16 Oct 2019, Alistair Francis wrote:

> diff --git a/sysdeps/unix/sysv/linux/generic/xstat.c b/sysdeps/unix/sysv/linux/generic/xstat.c
> index 75ceb9bc74b..ece14fc5838 100644
> --- a/sysdeps/unix/sysv/linux/generic/xstat.c
> +++ b/sysdeps/unix/sysv/linux/generic/xstat.c
> @@ -28,6 +28,11 @@
>  #include <sysdep.h>
>  #include <sys/syscall.h>
>  
> +#if __INO_T_MATCHES_INO64_T
> +_Static_assert (sizeof (__blkcnt_t) == sizeof (__blkcnt64_t),
> +                "__blkcnt_t and __blkcnt64_t must match");
> +#endif

This isn't a good place for this check because this file is overridden for 
wordsize-32, meaning the check is missing in the wordsize-32 case.  It 
needs to go somewhere used whether or not the wordsize-32 subdirectory is 
in use.  (You could e.g. have a source file used only for this check, that 
compiles to an object file with no code.)

I think this assertion should also have a comment explaining that it's 
because the layout code in bits/stat.h, and the overflow handling in 
wordsize-32/overflow.h, require either all or none of the three types 
concerned to have padding.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list