From patchwork Sat Mar 28 15:22:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38647 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by sourceware.org (Postfix) with ESMTPS id 50B40385E009 for ; Sat, 28 Mar 2020 15:30:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 50B40385E009 IronPort-SDR: zSLMfHjmrzUjUC0iJAot8J3Hk+dcsW0r6MpQfgSbStVosXMO6bM93UMglUU6UTnGL6lzlHqpj4 UzGolwc04j7I0BuOtTZ/HRuYIMJdn4koPGCJHwwEhB1PEKllggrcieI2igKfIOPy/UVq9F60IV avxcpaR9ALBPxC8oqJEY7FhZeoikdBGrhagFEJLS8ZFX5OQusM6h9qLbBMjZPxol/Hx+reuB4+ B8334p9rU6plaVMvIN0DULuP413FtDnF81UDgEYAY6Tdui8mlgu5Ryz+5AfHGlfhIg3cfAasXd +6E= X-IronPort-AV: E=Sophos;i="5.72,316,1580745600"; d="scan'208";a="138142287" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 28 Mar 2020 23:30:29 +0800 IronPort-SDR: aNXNdIBrs+FHOWYCCLSckRSmB5i9Y6X/rbpzc37y2av5vVM3lLE0VJYm4avwVTwXjFy00hQ3ol xvIhkSm6nxXFA0yNXl4X/tG2/acIE9senCLr9L+7/DMfxjJUhcSIwtll7HanjvMYc4cYHouXTA BEdNHvvjHPbKl4eWwpTgPn0HSjxOnVZEf4MrBFbpMGsq9n6YLEmzkFJEzR9zdv5H+JQOAMGc4s s/m6UzmjQmPM+D/meN949OAcRdMuGX0YC99ESrZ3siO0Sbwn8rI/G1uZAWKmLu1M2Z3PypRlrv FsJyqKBLr9zkeu3e5IKlajq3 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2020 08:21:28 -0700 IronPort-SDR: xYv43KoPNZYpkhLP350MXHGTRQtAQ8qDt0Ke2mLQwECntXFci5KjDGQLC3G/3Hl7fUQ1HLkBpX JIc7+iMdq9uu6quhJmI3HiTly2EEf4m39slScF3ae7lbSlu9gi7i5ru/gQvjKYIIX5BaNIUxmN axLtpciZ+srRjN6O5PZaixr1df8s87pWA3Yo1uCswfVfqtc3cTIscJ8v/JnX5wz37Rm/0raxTL WcJk7yse7GRfmnKw4TpQ8QEMyjuP3o9jkabVFJhbHC5gtymoaBhc+fmQ0SBPWMzs7Quj8sjchG Dkw= WDCIronportException: Internal Received: from wdapacbjl0003.my.asia.wdc.com (HELO risc6-mainframe.hgst.com) ([10.86.55.5]) by uls-op-cesaip02.wdc.com with ESMTP; 28 Mar 2020 08:30:28 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: Vineet.Gupta1@synopsys.com, alistair23@gmail.com, Alistair Francis , Lukasz Majewski Subject: [PATCH v6 1/5] sysv: Define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 Date: Sat, 28 Mar 2020 08:22:45 -0700 Message-Id: <20200328152249.972428-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200328152249.972428-1-alistair.francis@wdc.com> References: <20200328152249.972428-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-25.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Mar 2020 15:30:34 -0000 On y2038 safe 32-bit systems the Linux kernel expects itimerval and rusage to use a 32-bit time_t, even though the other time_t's are 64-bit. There are currently no plans to make 64-bit time_t versions of these structs. There are also other occurrences where the time passed to the kernel via timeval doesn't match the wordsize. To handle these cases let's define a new macro __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64. This macro specifies if the kernel's old_timeval matches the new timeval64. This should be true for 64-bit architectures except for Alpha's old osf syscalls and x32. Reviewed-by: Lukasz Majewski --- bits/typesizes.h | 6 ++++++ sysdeps/unix/sysv/linux/alpha/bits/typesizes.h | 3 +++ sysdeps/unix/sysv/linux/generic/bits/typesizes.h | 6 ++++++ sysdeps/unix/sysv/linux/s390/bits/typesizes.h | 6 ++++++ sysdeps/unix/sysv/linux/sparc/bits/typesizes.h | 6 ++++++ sysdeps/unix/sysv/linux/x86/bits/typesizes.h | 5 +++++ 6 files changed, 32 insertions(+) diff --git a/bits/typesizes.h b/bits/typesizes.h index 599408973e..8f16903a21 100644 --- a/bits/typesizes.h +++ b/bits/typesizes.h @@ -76,10 +76,16 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif /* Number of descriptors that can fit in an `fd_set'. */ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h index 28ee3e5920..1d1fd242dc 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h @@ -73,6 +73,9 @@ /* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 0 +/* And for getitimer, setitimer and rusage */ +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 + /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 1024 diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h index 7c963e523e..4fb246ac74 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h @@ -77,11 +77,17 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif + /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 1024 diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index e775e460bb..2bc87c1079 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -82,10 +82,16 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 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 ac48c23e37..288a902b5f 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -76,10 +76,16 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 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 87c50a4f32..1bb4a1620c 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -88,10 +88,15 @@ /* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ # define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 #else # define __RLIM_T_MATCHES_RLIM64_T 0 # define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 #endif /* Number of descriptors that can fit in an `fd_set'. */