From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
To: Lukasz Majewski <lukma@denx.de>
Cc: Alistair Francis <alistair.francis@wdc.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH 15/16] linux: Add {f}stat{at} y2038 support
Date: Thu, 30 Jul 2020 09:42:51 -0300 [thread overview]
Message-ID: <9555e199-4dcc-22c0-0d06-85144d1f1156@linaro.org> (raw)
In-Reply-To: <20200724125350.7bbbd20a@jawa>
[-- Attachment #1.1: Type: text/plain, Size: 4830 bytes --]
On 24/07/2020 07:53, Lukasz Majewski wrote:
>>
>> diff --git a/sysdeps/unix/sysv/linux/fstatat.c
>> b/sysdeps/unix/sysv/linux/fstatat.c index 03ddb3f493..f65d3b74a6
>> 100644 --- a/sysdeps/unix/sysv/linux/fstatat.c
>> +++ b/sysdeps/unix/sysv/linux/fstatat.c
>> -# ifdef __NR_fstatat64
>> - /* Old KABIs with old non-LFS support, e.g. arm, i386, hppa, m68k,
>> mips32,
>> - microblaze, s390, sh, powerpc, and sparc. */
>> + struct statx stx;
>> + int r = INLINE_SYSCALL_CALL (statx, fd, file, flag,
>> STATX_BASIC_STATS,
>> + &stx);
>
> I'm wondering about the indentation here - I do see 3*TAB and some
> spaces. Shouldn't we only use spaces?
Afaik the GNU code guidelines requires to use TAB indentations instead
of space in this case.
>
> And one more question what is the correct alignment:
> (statx, fd, file, flag
> &stx);
>
> or
> (statx, fd, file, flag
> &stx);
My understanding the latter.
>
>> + if (r == 0 || errno != ENOSYS)
>> + {
>> + if (r == 0)
>> + __cp_stat_t64_statx (st, &stx);
>> + return r;
>> + }
>
> Great that the statx is used here.
>
>> +
>> +# ifdef __NR_fstatat64
>> + /* Both new kABI which uses generic pre 64-bit time Linux ABI
>> (e.g. csky
>> + and nios) and old kABI with non-LFS support (e.g. arm, i386,
>> hppa, m68k,
>> + mips32, microblaze, s390, sh, powerpc, and sparc32). */
>> struct stat64 st64;
>> - int r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag);
>> + r = INLINE_SYSCALL_CALL (fstatat64, fd, file, &st64, flag);
>> if (r == 0)
>> {
>> if (! in_ino_t_range (st64.st_ino)
>> @@ -48,7 +51,7 @@ __fstatat (int fd, const char *file, struct stat
>> *st, int flag) || ! in_blkcnt_t_range (st64.st_blocks))
>> return INLINE_SYSCALL_ERROR_RETURN_VALUE (EOVERFLOW);
>>
>> - /* Clear internal pad and reserved fields. */
>> + /* Clear both pad and reserved fields. */
>> memset (st, 0, sizeof (*st));
>>
>> st->st_dev = st64.st_dev,
>> @@ -61,22 +64,29 @@ __fstatat (int fd, const char *file, struct stat
>> *st, int flag) st->st_size = st64.st_size;
>> st->st_blksize = st64.st_blksize;
>> st->st_blocks = st64.st_blocks;
>> - st->st_atim.tv_sec = st64.st_atim.tv_sec;
>> - st->st_atim.tv_nsec = st64.st_atim.tv_nsec;
>> - st->st_mtim.tv_sec = st64.st_mtim.tv_sec;
>> - st->st_mtim.tv_nsec = st64.st_mtim.tv_nsec;
>> - st->st_ctim.tv_sec = st64.st_ctim.tv_sec;
>> - st->st_ctim.tv_nsec = st64.st_ctim.tv_nsec;
>> + st->st_atim = valid_timespec_to_timespec64 (st64.st_atim);
>> + st->st_mtim = valid_timespec_to_timespec64 (st64.st_mtim);
>> + st->st_ctim = valid_timespec_to_timespec64 (st64.st_ctim);
>> }
>> return r;
>> -# else
>> +# else
>> /* 64-bit kabi outlier, e.g. mips64 and mips64-n32. */
>> struct kernel_stat kst;
>> - int r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
>> - return r ?: __cp_kstat_stat (&kst, st);
>> -# endif /* __nr_fstatat64 */
>> -# endif /* STAT_IS_KERNEL_STAT */
>> + r = INTERNAL_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
>> + return r ?: __cp_kstat_stat_t64 (&kst, st);
>> +# endif /* __NR_fstatat64 */
>> +}
>> +# if __TIMESIZE != 64
>> +libc_hidden_def (__fstatat_time64)
>> +
>> +int
>> +__fstatat (int fd, const char *file, struct stat *buf, int flags)
>> +{
>> + struct __stat_t64 st_t64;
>> + return __fstatat_time64 (fd, file, &st_t64, flags)
>> + ?: __cp_stat_t64_stat (&st_t64, buf);
>> }
>> +# endif
>>
>> weak_alias (__fstatat, fstatat)
>> #endif
>> diff --git a/sysdeps/unix/sysv/linux/fstatat64.c
>> b/sysdeps/unix/sysv/linux/fstatat64.c index 82fab107a5..b3940f0d20
>> 100644 --- a/sysdeps/unix/sysv/linux/fstatat64.c
>> +++ b/sysdeps/unix/sysv/linux/fstatat64.c
>> @@ -19,56 +19,102 @@
>> #define __fstatat __redirect___fstatat
>> #define fstatat __redirect_fstatat
>> #include <sys/stat.h>
>> -#undef __fstatat
>> -#undef fstatat
>> #include <fcntl.h>
>> -
>> +#include <string.h>
>> #include <kernel_stat.h>
>> #include <sysdep.h>
>> -
>> +#include <time.h>
>> #include <statx_cp.h>
>> #include <kstat_cp.h>
>> +#include <stat_t64_cp.h>
>>
>> int
>> -__fstatat64 (int fd, const char *file, struct stat64 *st, int flag)
>> +__fstatat64_time64 (int fd, const char *file, struct __stat64_t64
>> *st,
>> + int flag)
>> {
>> + int r;
>> +
>> +#if (__WORDSIZE == 32 \
>> + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32))
>
> I do guess that the above condition is to ensure that 32 bit archs
> (excluding x86_64-x32 - e.g. arm, riscv, etc) use statx?
Yes, this is similar for what is done by SysVIPC fixes.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-07-30 12:42 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 19:46 [PATCH 00/16] Add y2038 support for stat functions Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 01/16] linux: Always define STAT_IS_KERNEL_STAT Adhemerval Zanella via Libc-alpha
2020-07-24 8:17 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 02/16] linux: Define STAT64_IS_KERNEL_STAT64 Adhemerval Zanella via Libc-alpha
2020-07-24 8:20 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 03/16] linux: Consolidate xstat{64} Adhemerval Zanella via Libc-alpha
2020-07-23 20:51 ` Joseph Myers
2020-07-24 8:34 ` Lukasz Majewski
2020-09-09 14:46 ` Lukasz Majewski
2020-09-09 18:05 ` Adhemerval Zanella via Libc-alpha
2020-09-10 7:10 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 04/16] linux: Consolidate lxstat{64} Adhemerval Zanella via Libc-alpha
2020-07-24 8:43 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 05/16] linux: Consolidate fxstat{64} Adhemerval Zanella via Libc-alpha
2020-07-24 9:04 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 06/16] linux: Consolidate fxstatat{64} Adhemerval Zanella via Libc-alpha
2020-07-24 9:14 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 07/16] Linux: Consolidate xmknod Adhemerval Zanella via Libc-alpha
2020-07-24 9:14 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 08/16] Remove internal usage of extensible stat functions Adhemerval Zanella via Libc-alpha
2020-07-24 9:16 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 09/16] Remove stat wrapper functions, move them to exported symbols Adhemerval Zanella via Libc-alpha
2020-07-24 9:23 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 10/16] Remove mknod wrapper functions, move them to symbols Adhemerval Zanella via Libc-alpha
2020-07-23 20:53 ` Joseph Myers
2020-07-23 20:58 ` Adhemerval Zanella via Libc-alpha
2020-07-23 21:01 ` Joseph Myers
2020-07-24 9:25 ` Lukasz Majewski
2020-10-12 22:27 ` Joseph Myers
2020-10-13 0:58 ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 11/16] linux: Move the struct stat{64} to struct_stat.h Adhemerval Zanella via Libc-alpha
2020-07-24 9:27 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 12/16] linux: Implement {l}fstat{at} in terms of fstatat Adhemerval Zanella via Libc-alpha
2020-07-24 9:29 ` Lukasz Majewski
2020-07-23 19:46 ` [PATCH 13/16] linux: Disentangle fstatat from fxstatat Adhemerval Zanella via Libc-alpha
2020-07-24 9:39 ` Lukasz Majewski
2020-07-24 10:25 ` Florian Weimer via Libc-alpha
2020-07-24 14:39 ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 14/16] linux: Move {f}xstat{at} to compat symbols Adhemerval Zanella via Libc-alpha
2020-07-24 9:40 ` Lukasz Majewski
2020-10-21 5:21 ` __xstat et al. as compat symbols (was: Re: [PATCH 14/16] linux: Move {f}xstat{at} to compat symbols) Florian Weimer via Libc-alpha
2020-10-21 11:59 ` Adhemerval Zanella via Libc-alpha
2020-10-21 12:57 ` __xstat et al. as compat symbols Florian Weimer via Libc-alpha
2020-10-21 13:09 ` Adhemerval Zanella via Libc-alpha
2020-10-22 10:08 ` Florian Weimer via Libc-alpha
2020-10-22 12:43 ` Adhemerval Zanella via Libc-alpha
2020-10-22 15:37 ` Florian Weimer via Libc-alpha
2020-10-22 16:40 ` Adhemerval Zanella via Libc-alpha
2020-10-22 18:04 ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 15/16] linux: Add {f}stat{at} y2038 support Adhemerval Zanella via Libc-alpha
2020-07-23 20:55 ` Joseph Myers
2020-07-23 21:00 ` Adhemerval Zanella via Libc-alpha
2020-07-24 10:53 ` Lukasz Majewski
2020-07-30 12:42 ` Adhemerval Zanella via Libc-alpha [this message]
2020-08-02 19:46 ` Maciej W. Rozycki via Libc-alpha
2020-10-06 9:48 ` Lukasz Majewski
2020-10-07 12:52 ` Adhemerval Zanella via Libc-alpha
2020-10-07 14:25 ` Adhemerval Zanella via Libc-alpha
2020-10-07 20:20 ` Lukasz Majewski
2020-10-07 21:01 ` Adhemerval Zanella via Libc-alpha
2020-10-07 21:07 ` Adhemerval Zanella via Libc-alpha
2020-10-08 7:57 ` Lukasz Majewski
2020-10-09 14:05 ` Adhemerval Zanella via Libc-alpha
2020-10-09 15:39 ` Lukasz Majewski
2020-10-09 20:06 ` Adhemerval Zanella via Libc-alpha
2020-10-13 13:58 ` Lukasz Majewski
2020-10-13 14:18 ` Adhemerval Zanella via Libc-alpha
2020-10-13 14:23 ` H.J. Lu via Libc-alpha
2020-10-13 14:27 ` Adhemerval Zanella via Libc-alpha
2020-10-13 18:14 ` Adhemerval Zanella via Libc-alpha
2020-10-13 21:20 ` Lukasz Majewski
2020-10-13 21:40 ` Lukasz Majewski
2020-10-14 13:15 ` Lukasz Majewski
2020-10-14 13:39 ` Adhemerval Zanella via Libc-alpha
2020-07-23 19:46 ` [PATCH 16/16] linux: Move xmknoda{at} to compat symbols Adhemerval Zanella via Libc-alpha
2020-07-24 10:30 ` Florian Weimer via Libc-alpha
2020-07-24 12:34 ` Adhemerval Zanella via Libc-alpha
2020-07-24 12:43 ` Florian Weimer via Libc-alpha
2020-07-24 12:49 ` Adhemerval Zanella via Libc-alpha
2020-07-24 10:43 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9555e199-4dcc-22c0-0d06-85144d1f1156@linaro.org \
--to=libc-alpha@sourceware.org \
--cc=adhemerval.zanella@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=lukma@denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).