]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Define __STATFS_MATCHES_STATFS64
authorAlistair Francis <alistair.francis@wdc.com>
Tue, 13 Aug 2019 20:35:28 +0000 (13:35 -0700)
committerAlistair Francis <alistair.francis@wdc.com>
Thu, 24 Oct 2019 16:14:26 +0000 (09:14 -0700)
Add a new macro __STATFS_MATCHES_STATFS64 that specifies if fsblkcnt_t
matches fsblkcnt64_t and if fsfilcnt_t matches fsfilcnt64_t.

As we don't have the padding we also need to update the overflow checker
to not access the undefined members.

bits/typesizes.h
sysdeps/mach/hurd/bits/typesizes.h
sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
sysdeps/unix/sysv/linux/generic/bits/statfs.h
sysdeps/unix/sysv/linux/generic/bits/typesizes.h
sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
sysdeps/unix/sysv/linux/s390/bits/typesizes.h
sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
sysdeps/unix/sysv/linux/x86/bits/typesizes.h

index 779945bf0992294b6c9abebd8b0e4dcc00ea91b3..ae6eff5fc5f5483a6ed7af0a0c74f72bb786d577 100644 (file)
 
 /* And for rlim_t and rlim64_t.  */
 # define __RLIM_T_MATCHES_RLIM64_T     1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
 #else
 # define __RLIM_T_MATCHES_RLIM64_T     0
+
+# define __STATFS_MATCHES_STATFS64  0
 #endif
 
 /* Number of descriptors that can fit in an `fd_set'.  */
index c30de12d1d4f74cd5d59947ace7d673100678d62..3600137f501d5af8413113b34c8a9187d4aed145 100644 (file)
@@ -64,5 +64,9 @@
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define        __FD_SETSIZE            256
 
+/* Tell the libc code that fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and
+   fsfilcnt64_t are not the same type for all ABI purposes.  */
+# define __STATFS_MATCHES_STATFS64  0
+
 
 #endif /* bits/typesizes.h */
index 20231152e336e3657532597b100cc04452f393e6..687b4df006a507c4d710bfb89c97f92d6dc58206 100644 (file)
@@ -69,6 +69,9 @@
 /* And for __rlim_t and __rlim64_t.  */
 #define __RLIM_T_MATCHES_RLIM64_T 1
 
+/* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  0
+
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define        __FD_SETSIZE            1024
 
index c4069aba620570abe840ec378d7a3ca83af72ce8..e622daf2240b78d18687c3f7e1bd0c9438805a6e 100644 (file)
@@ -34,7 +34,7 @@
 
 #if defined __USE_FILE_OFFSET64
 # define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64
+#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64
 # define __field64(type, type64, name) type name
 #elif __BYTE_ORDER == __LITTLE_ENDIAN
 # define __field64(type, type64, name) \
index 05e3cfee4547947df4cf19f7e06f1cd8fad72a53..0c8c2e0c12a12d21b71feb29e632115d54054e98 100644 (file)
 
 /* And for __rlim_t and __rlim64_t.  */
 # define __RLIM_T_MATCHES_RLIM64_T     1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
 #else
 # define __RLIM_T_MATCHES_RLIM64_T     0
-#endif
 
+# define __STATFS_MATCHES_STATFS64  0
+#endif
 /* Number of descriptors that can fit in an `fd_set'.  */
 #define        __FD_SETSIZE            1024
 
index 66546b07ccdc3c46113c1731fd56380dc05f21cf..f63dbfae8990bc5704e95d927e9614642ba20334 100644 (file)
@@ -51,6 +51,9 @@ static inline int stat_overflow (struct stat *buf)
 /* Note that f_files and f_ffree may validly be a sign-extended -1.  */
 static inline int statfs_overflow (struct statfs *buf)
 {
+#if __STATFS_MATCHES_STATFS64
+  return 0;
+#else
   if (buf->__f_blocks_pad == 0 && buf->__f_bfree_pad == 0
       && buf->__f_bavail_pad == 0
       && (buf->__f_files_pad == 0
@@ -61,4 +64,5 @@ static inline int statfs_overflow (struct statfs *buf)
 
   __set_errno (EOVERFLOW);
   return -1;
+#endif
 }
index 94234f9242766cca66a133acb112cba0378c96a6..38034e3ad4037b0209ee4b99100edfe5390d6889 100644 (file)
 
 /* And for __rlim_t and __rlim64_t.  */
 # define __RLIM_T_MATCHES_RLIM64_T     1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
 #else
 # define __RLIM_T_MATCHES_RLIM64_T     0
+
+# define __STATFS_MATCHES_STATFS64  0
 #endif
 
 /* Number of descriptors that can fit in an `fd_set'.  */
index 037f530d65ba5f7adb87488e261ed23316d697a2..c93f428017ba72769fbd7697add8d8eb531c1624 100644 (file)
 
 /* And for __rlim_t and __rlim64_t.  */
 # define __RLIM_T_MATCHES_RLIM64_T     1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
 #else
 # define __RLIM_T_MATCHES_RLIM64_T     0
+
+# define __STATFS_MATCHES_STATFS64  0
 #endif
 
 /* Number of descriptors that can fit in an `fd_set'.  */
index 012651b3ab5dc9b83111f2f3f7aba74ba2981442..168990f9dda43d46a883738314a8215acee84418 100644 (file)
 
 /* And for __rlim_t and __rlim64_t.  */
 # define __RLIM_T_MATCHES_RLIM64_T     1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
 #else
 # define __RLIM_T_MATCHES_RLIM64_T     0
+
+# define __STATFS_MATCHES_STATFS64  0
 #endif
 
 /* Number of descriptors that can fit in an `fd_set'.  */