[PATCH] Loongarch: adapt for the re-introduction of fstat and newfstatat in 6.11

Xi Ruoyao xry111@xry111.site
Tue Aug 20 12:44:19 GMT 2024


On Tue, 2024-08-20 at 20:27 +0800, Miao Wang via B4 Relay wrote:

> Kernel 6.11 adds back fstat and newfstatat in commit 7697a0fe0154
> ("LoongArch: Define __ARCH_WANT_NEW_STAT in unistd.h"). With kernel
> headers from 6.11, make update-syscall-lists will generate the following
> diffs:
> 
> diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h

Don't directly embed a diff here (w/o some mangling).  Doing so will
puzzle patchwork, git am, etc to consider it a part of the patch.  Look
at the unwanted effect at
https://patchwork.sourceware.org/project/glibc/patch/20240820-loong-fstat-v1-1-799b6627bb2f@gmail.com/.

> +#include_next <kernel-features.h>
> +
> +#define __ASSUME_LOONGARCH_NEWSTAT 1
> +
> +/* No support for fstat or newfstatat before 6.11.  */

6.10.6, the change is backported so we can assume anything >= 6.10.6
have these syscalls.  But we cannot make a reasonable assumption with
other backports like 6.6.47.

> +#if __LINUX_KERNEL_VERSION < 0x060b00

0x060a06.

> +# undef __ASSUME_LOONGARCH_NEWSTAT

Can we just #undef __NR_fstat and #undef __NR_newfstatat here?  Sparc is
undefining __NR_pause in their kernel-features.h.

> +#endif

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Libc-alpha mailing list