From: Mike Yuan Date: Mon, 20 Jan 2025 18:43:00 +0000 (+0100) Subject: missing_syscall: add {set,remove}xattrat() X-Git-Tag: v258-rc1~1375^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a0924d96cbea137e723f3089648cbb752063f214;p=thirdparty%2Fsystemd.git missing_syscall: add {set,remove}xattrat() --- diff --git a/meson.build b/meson.build index 6d86b057ef7..d38f6ef20f9 100644 --- a/meson.build +++ b/meson.build @@ -682,6 +682,8 @@ foreach ident : [ ['strerrorname_np', '''#include '''], ['getrandom', '''#include '''], ['quotactl_fd', '''#include '''], + ['setxattrat', '''#include '''], # no known header declares setxattrat + ['removexattrat', '''#include '''], # no known header declares removexattrat ] have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index 47ff5a11aac..f4eb4dd57b2 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -637,13 +637,47 @@ int __clone2(int (*fn)(void *), void *stack_base, size_t stack_size, int flags, #if !HAVE_QUOTACTL_FD static inline int missing_quotactl_fd(int fd, int cmd, int id, void *addr) { -#if defined __NR_quotactl_fd +# ifdef __NR_quotactl_fd return syscall(__NR_quotactl_fd, fd, cmd, id, addr); -#else +# else errno = ENOSYS; return -1; -#endif +# endif } # define quotactl_fd missing_quotactl_fd #endif + +/* ======================================================================= */ + +#if !HAVE_SETXATTRAT +struct xattr_args { + _align_(8) uint64_t value; + uint32_t size; + uint32_t flags; +}; + +static inline int missing_setxattrat(int fd, const char *path, int at_flags, const char *name, const struct xattr_args *args, size_t size) { +# ifdef __NR_setxattrat + return syscall(__NR_setxattrat, fd, path, at_flags, name, args, size); +# else + errno = ENOSYS; + return -1; +# endif +} + +# define setxattrat missing_setxattrat +#endif + +#if !HAVE_REMOVEXATTRAT +static inline int missing_removexattrat(int fd, const char *path, int at_flags, const char *name) { +# ifdef __NR_removexattrat + return syscall(__NR_removexattrat, fd, path, at_flags, name); +# else + errno = ENOSYS; + return -1; +# endif +} + +# define removexattrat missing_removexattrat +#endif diff --git a/src/basic/missing_syscall_def.h b/src/basic/missing_syscall_def.h index cd22058cdd4..48116fc0f7c 100644 --- a/src/basic/missing_syscall_def.h +++ b/src/basic/missing_syscall_def.h @@ -994,6 +994,142 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect); # endif #endif +#ifndef __IGNORE_quotactl_fd +# if defined(__aarch64__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__alpha__) +# define systemd_NR_quotactl_fd 553 +# elif defined(__arc__) || defined(__tilegx__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__arm__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__i386__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__ia64__) +# define systemd_NR_quotactl_fd 1467 +# elif defined(__loongarch_lp64) +# define systemd_NR_quotactl_fd 443 +# elif defined(__m68k__) +# define systemd_NR_quotactl_fd 443 +# elif defined(_MIPS_SIM) +# if _MIPS_SIM == _MIPS_SIM_ABI32 +# define systemd_NR_quotactl_fd 4443 +# elif _MIPS_SIM == _MIPS_SIM_NABI32 +# define systemd_NR_quotactl_fd 6443 +# elif _MIPS_SIM == _MIPS_SIM_ABI64 +# define systemd_NR_quotactl_fd 5443 +# else +# error "Unknown MIPS ABI" +# endif +# elif defined(__hppa__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__powerpc__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__riscv) +# if __riscv_xlen == 32 +# define systemd_NR_quotactl_fd 443 +# elif __riscv_xlen == 64 +# define systemd_NR_quotactl_fd 443 +# else +# error "Unknown RISC-V ABI" +# endif +# elif defined(__s390__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__sparc__) +# define systemd_NR_quotactl_fd 443 +# elif defined(__x86_64__) +# if defined(__ILP32__) +# define systemd_NR_quotactl_fd (443 | /* __X32_SYSCALL_BIT */ 0x40000000) +# else +# define systemd_NR_quotactl_fd 443 +# endif +# elif !defined(missing_arch_template) +# warning "quotactl_fd() syscall number is unknown for your architecture" +# endif + +/* may be an (invalid) negative number due to libseccomp, see PR 13319 */ +# if defined __NR_quotactl_fd && __NR_quotactl_fd >= 0 +# if defined systemd_NR_quotactl_fd +assert_cc(__NR_quotactl_fd == systemd_NR_quotactl_fd); +# endif +# else +# if defined __NR_quotactl_fd +# undef __NR_quotactl_fd +# endif +# if defined systemd_NR_quotactl_fd && systemd_NR_quotactl_fd >= 0 +# define __NR_quotactl_fd systemd_NR_quotactl_fd +# endif +# endif +#endif + +#ifndef __IGNORE_removexattrat +# if defined(__aarch64__) +# define systemd_NR_removexattrat 466 +# elif defined(__alpha__) +# define systemd_NR_removexattrat 576 +# elif defined(__arc__) || defined(__tilegx__) +# define systemd_NR_removexattrat 466 +# elif defined(__arm__) +# define systemd_NR_removexattrat 466 +# elif defined(__i386__) +# define systemd_NR_removexattrat 466 +# elif defined(__ia64__) +# define systemd_NR_removexattrat -1 +# elif defined(__loongarch_lp64) +# define systemd_NR_removexattrat 466 +# elif defined(__m68k__) +# define systemd_NR_removexattrat 466 +# elif defined(_MIPS_SIM) +# if _MIPS_SIM == _MIPS_SIM_ABI32 +# define systemd_NR_removexattrat 4466 +# elif _MIPS_SIM == _MIPS_SIM_NABI32 +# define systemd_NR_removexattrat 6466 +# elif _MIPS_SIM == _MIPS_SIM_ABI64 +# define systemd_NR_removexattrat 5466 +# else +# error "Unknown MIPS ABI" +# endif +# elif defined(__hppa__) +# define systemd_NR_removexattrat 466 +# elif defined(__powerpc__) +# define systemd_NR_removexattrat 466 +# elif defined(__riscv) +# if __riscv_xlen == 32 +# define systemd_NR_removexattrat 466 +# elif __riscv_xlen == 64 +# define systemd_NR_removexattrat 466 +# else +# error "Unknown RISC-V ABI" +# endif +# elif defined(__s390__) +# define systemd_NR_removexattrat 466 +# elif defined(__sparc__) +# define systemd_NR_removexattrat 466 +# elif defined(__x86_64__) +# if defined(__ILP32__) +# define systemd_NR_removexattrat (466 | /* __X32_SYSCALL_BIT */ 0x40000000) +# else +# define systemd_NR_removexattrat 466 +# endif +# elif !defined(missing_arch_template) +# warning "removexattrat() syscall number is unknown for your architecture" +# endif + +/* may be an (invalid) negative number due to libseccomp, see PR 13319 */ +# if defined __NR_removexattrat && __NR_removexattrat >= 0 +# if defined systemd_NR_removexattrat +assert_cc(__NR_removexattrat == systemd_NR_removexattrat); +# endif +# else +# if defined __NR_removexattrat +# undef __NR_removexattrat +# endif +# if defined systemd_NR_removexattrat && systemd_NR_removexattrat >= 0 +# define __NR_removexattrat systemd_NR_removexattrat +# endif +# endif +#endif + #ifndef __IGNORE_renameat2 # if defined(__aarch64__) # define systemd_NR_renameat2 276 @@ -1130,138 +1266,138 @@ assert_cc(__NR_setns == systemd_NR_setns); # endif #endif -#ifndef __IGNORE_statx +#ifndef __IGNORE_setxattrat # if defined(__aarch64__) -# define systemd_NR_statx 291 +# define systemd_NR_setxattrat 463 # elif defined(__alpha__) -# define systemd_NR_statx 522 +# define systemd_NR_setxattrat 573 # elif defined(__arc__) || defined(__tilegx__) -# define systemd_NR_statx 291 +# define systemd_NR_setxattrat 463 # elif defined(__arm__) -# define systemd_NR_statx 397 +# define systemd_NR_setxattrat 463 # elif defined(__i386__) -# define systemd_NR_statx 383 +# define systemd_NR_setxattrat 463 # elif defined(__ia64__) -# define systemd_NR_statx 1350 +# define systemd_NR_setxattrat -1 # elif defined(__loongarch_lp64) -# define systemd_NR_statx 291 +# define systemd_NR_setxattrat 463 # elif defined(__m68k__) -# define systemd_NR_statx 379 +# define systemd_NR_setxattrat 463 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 -# define systemd_NR_statx 4366 +# define systemd_NR_setxattrat 4463 # elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define systemd_NR_statx 6330 +# define systemd_NR_setxattrat 6463 # elif _MIPS_SIM == _MIPS_SIM_ABI64 -# define systemd_NR_statx 5326 +# define systemd_NR_setxattrat 5463 # else # error "Unknown MIPS ABI" # endif # elif defined(__hppa__) -# define systemd_NR_statx 349 +# define systemd_NR_setxattrat 463 # elif defined(__powerpc__) -# define systemd_NR_statx 383 +# define systemd_NR_setxattrat 463 # elif defined(__riscv) # if __riscv_xlen == 32 -# define systemd_NR_statx 291 +# define systemd_NR_setxattrat 463 # elif __riscv_xlen == 64 -# define systemd_NR_statx 291 +# define systemd_NR_setxattrat 463 # else # error "Unknown RISC-V ABI" # endif # elif defined(__s390__) -# define systemd_NR_statx 379 +# define systemd_NR_setxattrat 463 # elif defined(__sparc__) -# define systemd_NR_statx 360 +# define systemd_NR_setxattrat 463 # elif defined(__x86_64__) # if defined(__ILP32__) -# define systemd_NR_statx (332 | /* __X32_SYSCALL_BIT */ 0x40000000) +# define systemd_NR_setxattrat (463 | /* __X32_SYSCALL_BIT */ 0x40000000) # else -# define systemd_NR_statx 332 +# define systemd_NR_setxattrat 463 # endif # elif !defined(missing_arch_template) -# warning "statx() syscall number is unknown for your architecture" +# warning "setxattrat() syscall number is unknown for your architecture" # endif /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ -# if defined __NR_statx && __NR_statx >= 0 -# if defined systemd_NR_statx -assert_cc(__NR_statx == systemd_NR_statx); +# if defined __NR_setxattrat && __NR_setxattrat >= 0 +# if defined systemd_NR_setxattrat +assert_cc(__NR_setxattrat == systemd_NR_setxattrat); # endif # else -# if defined __NR_statx -# undef __NR_statx +# if defined __NR_setxattrat +# undef __NR_setxattrat # endif -# if defined systemd_NR_statx && systemd_NR_statx >= 0 -# define __NR_statx systemd_NR_statx +# if defined systemd_NR_setxattrat && systemd_NR_setxattrat >= 0 +# define __NR_setxattrat systemd_NR_setxattrat # endif # endif #endif -#ifndef __IGNORE_quotactl_fd +#ifndef __IGNORE_statx # if defined(__aarch64__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 291 # elif defined(__alpha__) -# define systemd_NR_quotactl_fd 553 +# define systemd_NR_statx 522 # elif defined(__arc__) || defined(__tilegx__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 291 # elif defined(__arm__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 397 # elif defined(__i386__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 383 # elif defined(__ia64__) -# define systemd_NR_quotactl_fd 1467 +# define systemd_NR_statx 1350 # elif defined(__loongarch_lp64) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 291 # elif defined(__m68k__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 379 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 -# define systemd_NR_quotactl_fd 4443 +# define systemd_NR_statx 4366 # elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define systemd_NR_quotactl_fd 6443 +# define systemd_NR_statx 6330 # elif _MIPS_SIM == _MIPS_SIM_ABI64 -# define systemd_NR_quotactl_fd 5443 +# define systemd_NR_statx 5326 # else # error "Unknown MIPS ABI" # endif # elif defined(__hppa__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 349 # elif defined(__powerpc__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 383 # elif defined(__riscv) # if __riscv_xlen == 32 -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 291 # elif __riscv_xlen == 64 -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 291 # else # error "Unknown RISC-V ABI" # endif # elif defined(__s390__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 379 # elif defined(__sparc__) -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 360 # elif defined(__x86_64__) # if defined(__ILP32__) -# define systemd_NR_quotactl_fd (443 | /* __X32_SYSCALL_BIT */ 0x40000000) +# define systemd_NR_statx (332 | /* __X32_SYSCALL_BIT */ 0x40000000) # else -# define systemd_NR_quotactl_fd 443 +# define systemd_NR_statx 332 # endif # elif !defined(missing_arch_template) -# warning "quotactl_fd() syscall number is unknown for your architecture" +# warning "statx() syscall number is unknown for your architecture" # endif /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ -# if defined __NR_quotactl_fd && __NR_quotactl_fd >= 0 -# if defined systemd_NR_quotactl_fd -assert_cc(__NR_quotactl_fd == systemd_NR_quotactl_fd); +# if defined __NR_statx && __NR_statx >= 0 +# if defined systemd_NR_statx +assert_cc(__NR_statx == systemd_NR_statx); # endif # else -# if defined __NR_quotactl_fd -# undef __NR_quotactl_fd +# if defined __NR_statx +# undef __NR_statx # endif -# if defined systemd_NR_quotactl_fd && systemd_NR_quotactl_fd >= 0 -# define __NR_quotactl_fd systemd_NR_quotactl_fd +# if defined systemd_NR_statx && systemd_NR_statx >= 0 +# define __NR_statx systemd_NR_statx # endif # endif #endif diff --git a/src/basic/missing_syscalls.py b/src/basic/missing_syscalls.py index a15fed03585..d0e9d7dec4b 100644 --- a/src/basic/missing_syscalls.py +++ b/src/basic/missing_syscalls.py @@ -21,8 +21,10 @@ SYSCALLS = [ 'pidfd_send_signal', 'pkey_mprotect', 'quotactl_fd', + 'removexattrat', 'renameat2', 'setns', + 'setxattrat', 'statx', ]