From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 2F1AC3858028 for ; Fri, 26 Mar 2021 09:24:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F1AC3858028 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12Q93hLV143886 for ; Fri, 26 Mar 2021 05:24:28 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 37hcc3s1sm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 26 Mar 2021 05:24:28 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12Q9OPpZ016159 for ; Fri, 26 Mar 2021 09:24:25 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04fra.de.ibm.com with ESMTP id 37h156g8s0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 26 Mar 2021 09:24:25 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12Q9O5Ap27525390 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 26 Mar 2021 09:24:05 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8CA06A4059 for ; Fri, 26 Mar 2021 09:24:23 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6911CA4051 for ; Fri, 26 Mar 2021 09:24:23 +0000 (GMT) Received: from li-ab9d22cc-354d-11b2-a85c-e984af76f811.ibm.com (unknown [9.171.2.19]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Fri, 26 Mar 2021 09:24:23 +0000 (GMT) From: Stefan Liebler Subject: Re: [PATCH 1/5] linux: Implement fstatat with __fstatat64_time64 To: libc-alpha@sourceware.org References: <20210319183121.2252064-1-adhemerval.zanella@linaro.org> <20210319183121.2252064-2-adhemerval.zanella@linaro.org> Message-ID: <5970116c-2af3-2f02-d526-e89008d36f18@linux.ibm.com> Date: Fri, 26 Mar 2021 10:24:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210319183121.2252064-2-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: sx16RfpJe5Zx0S_-8YBnEbc4MIk93mSu X-Proofpoint-ORIG-GUID: sx16RfpJe5Zx0S_-8YBnEbc4MIk93mSu X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-26_02:2021-03-26, 2021-03-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 phishscore=0 spamscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103260067 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: Fri, 26 Mar 2021 09:24:30 -0000 On 19/03/2021 19:31, Adhemerval Zanella via Libc-alpha wrote: > It makes fstatat use __NR_statx, which fix the s390 issue with > missing nanoxsecond support on compat stat syscalls (at least > on recent kernels) and limits the statx call to only one function > (which simplifies the __ASSUME_STATX support). > > Checked on i686-linux-gnu and on powerpc-linux-gnu. > --- > sysdeps/unix/sysv/linux/fstatat.c | 52 +++++++------------------------ > 1 file changed, 11 insertions(+), 41 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/fstatat.c b/sysdeps/unix/sysv/linux/fstatat.c > index 59efff615f..618c254d6f 100644 > --- a/sysdeps/unix/sysv/linux/fstatat.c > +++ b/sysdeps/unix/sysv/linux/fstatat.c > @@ -26,33 +26,19 @@ > int > __fstatat (int fd, const char *file, struct stat *buf, int flag) > { > - int r; > - > -# if STAT_IS_KERNEL_STAT > - /* New kABIs which uses generic pre 64-bit time Linux ABI, e.g. > - csky, nios2 */ > - r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, buf, flag); > - if (r == 0 && (buf->__st_ino_pad != 0 > - || buf->__st_size_pad != 0 > - || buf->__st_blocks_pad != 0)) > - return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); > -# else > -# ifdef __NR_fstatat64 > - /* Old KABIs with old non-LFS support, e.g. arm, i386, hppa, m68k, mips32, > - microblaze, s390, sh, powerpc, and sparc. */ > - struct stat64 st64; > - r = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, &st64, flag); > + struct __stat64_t64 st64; > + int r = __fstatat64_time64 (fd, file, &st64, flag); > if (r == 0) > { > if (! in_ino_t_range (st64.st_ino) > || ! in_off_t_range (st64.st_size) > - || ! in_blkcnt_t_range (st64.st_blocks)) > + || ! in_blkcnt_t_range (st64.st_blocks) > + || ! in_time_t_range (st64.st_atim.tv_sec) > + || ! in_time_t_range (st64.st_mtim.tv_sec) > + || ! in_time_t_range (st64.st_ctim.tv_sec)) > return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW); OK > > - /* Clear internal pad and reserved fields. */ > - memset (buf, 0, sizeof (*buf)); Do we have to clear the user provided struct as before? > - > - buf->st_dev = st64.st_dev, > + buf->st_dev = st64.st_dev; > buf->st_ino = st64.st_ino; > buf->st_mode = st64.st_mode; > buf->st_nlink = st64.st_nlink; > @@ -62,27 +48,11 @@ __fstatat (int fd, const char *file, struct stat *buf, int flag) > buf->st_size = st64.st_size; > buf->st_blksize = st64.st_blksize; > buf->st_blocks = st64.st_blocks; > - buf->st_atim.tv_sec = st64.st_atim.tv_sec; > - buf->st_atim.tv_nsec = st64.st_atim.tv_nsec; > - buf->st_mtim.tv_sec = st64.st_mtim.tv_sec; > - buf->st_mtim.tv_nsec = st64.st_mtim.tv_nsec; > - buf->st_ctim.tv_sec = st64.st_ctim.tv_sec; > - buf->st_ctim.tv_nsec = st64.st_ctim.tv_nsec; > - > - return 0; > + buf->st_atim = valid_timespec64_to_timespec (st64.st_atim); > + buf->st_mtim = valid_timespec64_to_timespec (st64.st_mtim); > + buf->st_ctim = valid_timespec64_to_timespec (st64.st_ctim); > } > -# else > - /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */ > - struct kernel_stat kst; > - r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag); > - if (r == 0) > - r = __cp_kstat_stat (&kst, buf); > -# endif /* __nr_fstatat64 */ > -# endif /* STAT_IS_KERNEL_STAT */ > - > - return INTERNAL_SYSCALL_ERROR_P (r) > - ? INLINE_SYSCALL_ERROR_RETURN_VALUE (-r) > - : 0; > + return r; > } > > weak_alias (__fstatat, fstatat) > OK