From patchwork Thu Oct 24 19:23:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35290 Received: (qmail 105532 invoked by alias); 24 Oct 2019 19:23:14 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 105507 invoked by uid 89); 24 Oct 2019 19:23:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io X-Gerrit-PatchSet: 1 Date: Thu, 24 Oct 2019 15:23:08 -0400 From: "Carlos O'Donell (Code Review)" To: libc-alpha@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] Define __STATFS_MATCHES_STATFS64 X-Gerrit-Change-Id: I3d07f40852bd591ce7b9106dd0bac5088c6e078b X-Gerrit-Change-Number: 302 X-Gerrit-ChangeURL: X-Gerrit-Commit: b84a88d8ee043d0e831ae8b4946d36b22a1470e9 References: Reply-To: carlos@redhat.com, libc-alpha@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3 Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/302 ...................................................................... Define __STATFS_MATCHES_STATFS64 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. Change-Id: I3d07f40852bd591ce7b9106dd0bac5088c6e078b --- M bits/typesizes.h M sysdeps/mach/hurd/bits/typesizes.h M sysdeps/unix/sysv/linux/alpha/bits/typesizes.h M sysdeps/unix/sysv/linux/generic/bits/statfs.h M sysdeps/unix/sysv/linux/generic/bits/typesizes.h M sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h M sysdeps/unix/sysv/linux/s390/bits/typesizes.h M sysdeps/unix/sysv/linux/sparc/bits/typesizes.h M sysdeps/unix/sysv/linux/x86/bits/typesizes.h 9 files changed, 37 insertions(+), 2 deletions(-) diff --git a/bits/typesizes.h b/bits/typesizes.h index 779945b..ae6eff5 100644 --- a/bits/typesizes.h +++ b/bits/typesizes.h @@ -72,8 +72,13 @@ /* 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'. */ diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h index c30de12..3600137 100644 --- a/sysdeps/mach/hurd/bits/typesizes.h +++ b/sysdeps/mach/hurd/bits/typesizes.h @@ -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 */ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h index 2023115..687b4df 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h @@ -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 diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/generic/bits/statfs.h index c4069ab..e622daf 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h +++ b/sysdeps/unix/sysv/linux/generic/bits/statfs.h @@ -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) \ diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h index 05e3cfe..0c8c2e0 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h @@ -73,10 +73,14 @@ /* 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 diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h index 66546b0..f63dbfa 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h +++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h @@ -51,6 +51,9 @@ /* 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 @@ __set_errno (EOVERFLOW); return -1; +#endif } diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index 94234f9..38034e3 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -78,8 +78,13 @@ /* 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'. */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h index 037f530..c93f428 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -72,8 +72,13 @@ /* 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'. */ diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h index 012651b..168990f 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -84,8 +84,13 @@ /* 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'. */