public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] linux: Fix fstat64 on alpha and sparc64
@ 2024-01-02 14:31 Adhemerval Zanella
  2024-01-12 13:37 ` Carlos O'Donell
  0 siblings, 1 reply; 5+ messages in thread
From: Adhemerval Zanella @ 2024-01-02 14:31 UTC (permalink / raw)
  To: libc-alpha

The 551101e8240b7514fc646d1722f8b79c90362b8f change is incorrect for
alpha and sparc, since __NR_stat is defined by both kABI.  Use
__NR_newfstat to check whether to fallback to __NR_fstat64 (similar
to what fstatat64 does).

Checked on sparc64-linux-gnu.
---
 sysdeps/unix/sysv/linux/fstat64.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/fstat64.c b/sysdeps/unix/sysv/linux/fstat64.c
index b4b5dc2908..cc9f695df9 100644
--- a/sysdeps/unix/sysv/linux/fstat64.c
+++ b/sysdeps/unix/sysv/linux/fstat64.c
@@ -30,7 +30,10 @@ __fstat64_time64 (int fd, struct __stat64_t64 *buf)
 {
 #if !FSTATAT_USE_STATX
 # if XSTAT_IS_XSTAT64
-#  ifdef __NR_fstat
+  /* The __NR_stat macro is defined for all ABIs that also define 
+     XSTAT_IS_STAT64, so to correctly identify alpha and sparc check
+     __NR_newfstatat (similar to what fstatat64 does).  */
+#  ifdef __NR_newfstatat
   /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and
      x86_64.  */
   return INLINE_SYSCALL_CALL (fstat, fd, buf);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] linux: Fix fstat64 on alpha and sparc64
  2024-01-02 14:31 [PATCH v2] linux: Fix fstat64 on alpha and sparc64 Adhemerval Zanella
@ 2024-01-12 13:37 ` Carlos O'Donell
  0 siblings, 0 replies; 5+ messages in thread
From: Carlos O'Donell @ 2024-01-12 13:37 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 1/2/24 09:31, Adhemerval Zanella wrote:
> The 551101e8240b7514fc646d1722f8b79c90362b8f change is incorrect for
> alpha and sparc, since __NR_stat is defined by both kABI.  Use
> __NR_newfstat to check whether to fallback to __NR_fstat64 (similar
> to what fstatat64 does).

LGTM for 2.39.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> Checked on sparc64-linux-gnu.
> ---
>  sysdeps/unix/sysv/linux/fstat64.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/fstat64.c b/sysdeps/unix/sysv/linux/fstat64.c
> index b4b5dc2908..cc9f695df9 100644
> --- a/sysdeps/unix/sysv/linux/fstat64.c
> +++ b/sysdeps/unix/sysv/linux/fstat64.c
> @@ -30,7 +30,10 @@ __fstat64_time64 (int fd, struct __stat64_t64 *buf)
>  {
>  #if !FSTATAT_USE_STATX
>  # if XSTAT_IS_XSTAT64
> -#  ifdef __NR_fstat
> +  /* The __NR_stat macro is defined for all ABIs that also define 
> +     XSTAT_IS_STAT64, so to correctly identify alpha and sparc check
> +     __NR_newfstatat (similar to what fstatat64 does).  */
> +#  ifdef __NR_newfstatat

OK. Confirmed in fstatat64.c we use __NR_newfstatat to identify a 64-bit kABI.

>    /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and
>       x86_64.  */
>    return INLINE_SYSCALL_CALL (fstat, fd, buf);

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] linux: Fix fstat64 on alpha and sparc64
  2023-12-29 19:44 Adhemerval Zanella
  2023-12-30  0:36 ` Andreas Schwab
@ 2023-12-30 12:16 ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Florian Weimer @ 2023-12-30 12:16 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

> The 551101e8240b7514fc646d1722f8b79c90362b8f change is incorrect for
> alpha and sparc, since __NR_stat is defined by both kABI.  Use
> __NR_newfstat ti check whether fallback to __NR_fstat64 (similar to

“__NR_newfstat [to] check whether [to] fallback to”

> what fstatat64).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] linux: Fix fstat64 on alpha and sparc64
  2023-12-29 19:44 Adhemerval Zanella
@ 2023-12-30  0:36 ` Andreas Schwab
  2023-12-30 12:16 ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2023-12-30  0:36 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Dez 29 2023, Adhemerval Zanella wrote:

> +  /* The __NR_stat is defined for all ABIs that also define XSTAT_IS_STAT64,
                     ^macro

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] linux: Fix fstat64 on alpha and sparc64
@ 2023-12-29 19:44 Adhemerval Zanella
  2023-12-30  0:36 ` Andreas Schwab
  2023-12-30 12:16 ` Florian Weimer
  0 siblings, 2 replies; 5+ messages in thread
From: Adhemerval Zanella @ 2023-12-29 19:44 UTC (permalink / raw)
  To: libc-alpha

The 551101e8240b7514fc646d1722f8b79c90362b8f change is incorrect for
alpha and sparc, since __NR_stat is defined by both kABI.  Use
__NR_newfstat ti check whether fallback to __NR_fstat64 (similar to
what fstatat64).

Checked on sparc64-linux-gnu and x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/fstat64.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/fstat64.c b/sysdeps/unix/sysv/linux/fstat64.c
index a291f0825b..0f1391067b 100644
--- a/sysdeps/unix/sysv/linux/fstat64.c
+++ b/sysdeps/unix/sysv/linux/fstat64.c
@@ -30,7 +30,10 @@ __fstat64_time64 (int fd, struct __stat64_t64 *buf)
 {
 #if !FSTATAT_USE_STATX
 # if XSTAT_IS_XSTAT64
-#  ifdef __NR_fstat
+  /* The __NR_stat is defined for all ABIs that also define XSTAT_IS_STAT64,
+     so to correctly identify alpha and sparc check __NR_newfstatat (similar
+     to what fstatat64 does).  */
+#  ifdef __NR_newfstatat
   /* 64-bit kABI, e.g. aarch64, ia64, powerpc64*, s390x, riscv64, and
      x86_64.  */
   return INLINE_SYSCALL_CALL (fstat, fd, buf);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-12 13:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 14:31 [PATCH v2] linux: Fix fstat64 on alpha and sparc64 Adhemerval Zanella
2024-01-12 13:37 ` Carlos O'Donell
  -- strict thread matches above, loose matches on Subject: below --
2023-12-29 19:44 Adhemerval Zanella
2023-12-30  0:36 ` Andreas Schwab
2023-12-30 12:16 ` Florian Weimer

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).