From: Yu Watanabe Date: Wed, 18 Jun 2025 23:35:35 +0000 (+0900) Subject: basic: move basic/missing_syscall_defs.h -> include/override/sys/syscall.h X-Git-Tag: v258-rc1~98^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da522c9921f85c2369cae17c75c48174c3b410cd;p=thirdparty%2Fsystemd.git basic: move basic/missing_syscall_defs.h -> include/override/sys/syscall.h This also moves syscall tables and generators to the same directory. Note, inclusion of asm/sgidefs.h is dropped, as it is already included by unistd.h and sys/syscall.h. --- diff --git a/src/basic/meson.build b/src/basic/meson.build index b7b2253586a..ece4bf1e922 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build @@ -121,9 +121,6 @@ sources += basic_sources missing_audit_h = files('missing_audit.h') -missing_syscall_def_h = files('missing_syscall_def.h') -basic_sources += missing_syscall_def_h - generated_gperf_headers = [] foreach item : [ # name, source, struct name, prefix, headers @@ -176,50 +173,6 @@ basic_sources += generated_gperf_headers ############################################################ -arch_list = [ - 'alpha', - 'arc', - 'arm', - 'arm64', - 'i386', - 'ia64', - 'loongarch64', - 'm68k', - 'mips64', - 'mips64n32', - 'mipso32', - 'parisc', - 'powerpc', - 'powerpc64', - 'riscv32', - 'riscv64', - 's390', - 's390x', - 'sparc', - 'x86_64' -] - -run_target( - 'update-syscall-tables', - command : [update_syscall_tables_sh, meson.current_source_dir()] + arch_list) - -syscall_list_txt = files('syscall-list.txt') - -syscall_lists = [] -foreach arch: arch_list - syscall_lists += files('syscalls-@0@.txt'.format(arch)) -endforeach - -missing_syscalls_py = find_program('missing_syscalls.py') - -run_target( - 'update-syscall-header', - command : [missing_syscalls_py, - missing_syscall_def_h, - syscall_lists]) - -############################################################ - filesystem_includes = files( '../include/uapi/linux/magic.h', 'missing_magic.h', diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h index 76074d1c049..994bda9a3e3 100644 --- a/src/basic/missing_syscall.h +++ b/src/basic/missing_syscall.h @@ -10,13 +10,8 @@ #include #include -#ifdef ARCH_MIPS -#include -#endif - #include "forward.h" #include "missing_keyctl.h" -#include "missing_syscall_def.h" /* ======================================================================= */ diff --git a/src/include/meson.build b/src/include/meson.build index 74f4437df04..9786723b1b2 100644 --- a/src/include/meson.build +++ b/src/include/meson.build @@ -1,5 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later +subdir('override/sys') + # Source files that provides AF_XYZ af_sources = files( 'override/sys/socket.h', diff --git a/src/basic/missing_syscalls.py b/src/include/override/sys/generate-syscall.py similarity index 94% rename from src/basic/missing_syscalls.py rename to src/include/override/sys/generate-syscall.py index dd26b76b4c9..b58f1d6bcf1 100644 --- a/src/basic/missing_syscalls.py +++ b/src/include/override/sys/generate-syscall.py @@ -33,6 +33,20 @@ def parse_syscall_tables(filenames): return {filename.split('-')[-1][:-4]: parse_syscall_table(filename) for filename in filenames} +HEADER = '''\ +/* SPDX-License-Identifier: LGPL-2.1-or-later + * This file is generated by src/include/override/sys/generate-syscall.py. Do not edit! + * + * Use 'ninja -C build update-syscall-tables' to download new syscall tables, + * and 'ninja -C build update-syscall-header' to regenerate this file. + */ +#pragma once + +#include_next + +#include +''' + DEF_TEMPLATE_A = '''\ #ifndef __IGNORE_{syscall} @@ -97,7 +111,7 @@ DEF_TEMPLATE_C = '''\ /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ # if defined __NR_{syscall} && __NR_{syscall} >= 0 # if defined systemd_NR_{syscall} -_Static_assert(__NR_{syscall} == systemd_NR_{syscall}, ""); +static_assert(__NR_{syscall} == systemd_NR_{syscall}, ""); # endif # else # if defined __NR_{syscall} @@ -128,16 +142,7 @@ def print_syscall_def(syscall, tables, out): file=out) def print_syscall_defs(syscalls, tables, out): - print('''\ -/* SPDX-License-Identifier: LGPL-2.1-or-later - * This file is generated by src/basic/missing_syscalls.py. Do not edit! - * - * Use 'ninja -C build update-syscall-tables' to download new syscall tables, - * and 'ninja -C build update-syscall-header' to regenerate this file. - */ -#pragma once -''', - file=out) + print(HEADER, file=out) print(ARCH_CHECK, file=out) for syscall in syscalls: print_syscall_def(syscall, tables, out) diff --git a/src/include/override/sys/meson.build b/src/include/override/sys/meson.build new file mode 100644 index 00000000000..b66f9d055fd --- /dev/null +++ b/src/include/override/sys/meson.build @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +arch_list = [ + 'alpha', + 'arc', + 'arm', + 'arm64', + 'i386', + 'ia64', + 'loongarch64', + 'm68k', + 'mips64', + 'mips64n32', + 'mipso32', + 'parisc', + 'powerpc', + 'powerpc64', + 'riscv32', + 'riscv64', + 's390', + 's390x', + 'sparc', + 'x86_64' +] + +run_target( + 'update-syscall-tables', + command : [update_syscall_tables_sh, meson.current_source_dir()] + arch_list) + +syscall_list_txt = files('syscall-list.txt') + +syscall_lists = [] +foreach arch: arch_list + syscall_lists += files('syscalls-@0@.txt'.format(arch)) +endforeach + +generate_syscall_py = find_program('generate-syscall.py') + +run_target( + 'update-syscall-header', + command : [generate_syscall_py, files('syscall.h')] + syscall_lists) diff --git a/src/include/override/sys/mount.h b/src/include/override/sys/mount.h index 3c9cd8ef5bd..050c23cc6ab 100644 --- a/src/include/override/sys/mount.h +++ b/src/include/override/sys/mount.h @@ -11,8 +11,6 @@ #include #include -#include "missing_syscall_def.h" - /* Since glibc-2.37 (774058d72942249f71d74e7f2b639f77184160a6), sys/mount.h includes linux/mount.h, and * we can safely include both headers in the same source file. However, we cannot do that with older glibc. * To avoid conflicts, let's not use glibc's sys/mount.h, and provide our own minimal implementation. diff --git a/src/basic/syscall-list.txt b/src/include/override/sys/syscall-list.txt similarity index 100% rename from src/basic/syscall-list.txt rename to src/include/override/sys/syscall-list.txt diff --git a/src/basic/missing_syscall_def.h b/src/include/override/sys/syscall.h similarity index 96% rename from src/basic/missing_syscall_def.h rename to src/include/override/sys/syscall.h index a34cb36f14d..894394a76bb 100644 --- a/src/basic/missing_syscall_def.h +++ b/src/include/override/sys/syscall.h @@ -1,11 +1,15 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later - * This file is generated by src/basic/missing_syscalls.py. Do not edit! + * This file is generated by src/include/override/sys/generate-syscall.py. Do not edit! * * Use 'ninja -C build update-syscall-tables' to download new syscall tables, * and 'ninja -C build update-syscall-header' to regenerate this file. */ #pragma once +#include_next + +#include + /* Note: if this code looks strange, this is because it is derived from the same * template as the per-syscall blocks below. */ # if defined(__aarch64__) @@ -98,7 +102,7 @@ /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ # if defined __NR_close_range && __NR_close_range >= 0 # if defined systemd_NR_close_range -_Static_assert(__NR_close_range == systemd_NR_close_range, ""); +static_assert(__NR_close_range == systemd_NR_close_range, ""); # endif # else # if defined __NR_close_range @@ -166,7 +170,7 @@ _Static_assert(__NR_close_range == systemd_NR_close_range, ""); /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ # if defined __NR_fchmodat2 && __NR_fchmodat2 >= 0 # if defined systemd_NR_fchmodat2 -_Static_assert(__NR_fchmodat2 == systemd_NR_fchmodat2, ""); +static_assert(__NR_fchmodat2 == systemd_NR_fchmodat2, ""); # endif # else # if defined __NR_fchmodat2 @@ -234,7 +238,7 @@ _Static_assert(__NR_fchmodat2 == systemd_NR_fchmodat2, ""); /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ # if defined __NR_mount_setattr && __NR_mount_setattr >= 0 # if defined systemd_NR_mount_setattr -_Static_assert(__NR_mount_setattr == systemd_NR_mount_setattr, ""); +static_assert(__NR_mount_setattr == systemd_NR_mount_setattr, ""); # endif # else # if defined __NR_mount_setattr @@ -246,6 +250,74 @@ _Static_assert(__NR_mount_setattr == systemd_NR_mount_setattr, ""); # endif #endif +#ifndef __IGNORE_open_tree_attr +# if defined(__aarch64__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__alpha__) +# define systemd_NR_open_tree_attr 577 +# elif defined(__arc__) || defined(__tilegx__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__arm__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__i386__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__ia64__) +# define systemd_NR_open_tree_attr -1 +# elif defined(__loongarch_lp64) +# define systemd_NR_open_tree_attr 467 +# elif defined(__m68k__) +# define systemd_NR_open_tree_attr 467 +# elif defined(_MIPS_SIM) +# if _MIPS_SIM == _MIPS_SIM_ABI32 +# define systemd_NR_open_tree_attr 4467 +# elif _MIPS_SIM == _MIPS_SIM_NABI32 +# define systemd_NR_open_tree_attr 6467 +# elif _MIPS_SIM == _MIPS_SIM_ABI64 +# define systemd_NR_open_tree_attr 5467 +# else +# error "Unknown MIPS ABI" +# endif +# elif defined(__hppa__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__powerpc__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__riscv) +# if __riscv_xlen == 32 +# define systemd_NR_open_tree_attr 467 +# elif __riscv_xlen == 64 +# define systemd_NR_open_tree_attr 467 +# else +# error "Unknown RISC-V ABI" +# endif +# elif defined(__s390__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__sparc__) +# define systemd_NR_open_tree_attr 467 +# elif defined(__x86_64__) +# if defined(__ILP32__) +# define systemd_NR_open_tree_attr (467 | /* __X32_SYSCALL_BIT */ 0x40000000) +# else +# define systemd_NR_open_tree_attr 467 +# endif +# elif !defined(missing_arch_template) +# warning "open_tree_attr() syscall number is unknown for your architecture" +# endif + +/* may be an (invalid) negative number due to libseccomp, see PR 13319 */ +# if defined __NR_open_tree_attr && __NR_open_tree_attr >= 0 +# if defined systemd_NR_open_tree_attr +static_assert(__NR_open_tree_attr == systemd_NR_open_tree_attr, ""); +# endif +# else +# if defined __NR_open_tree_attr +# undef __NR_open_tree_attr +# endif +# if defined systemd_NR_open_tree_attr && systemd_NR_open_tree_attr >= 0 +# define __NR_open_tree_attr systemd_NR_open_tree_attr +# endif +# endif +#endif + #ifndef __IGNORE_openat2 # if defined(__aarch64__) # define systemd_NR_openat2 437 @@ -302,7 +374,7 @@ _Static_assert(__NR_mount_setattr == systemd_NR_mount_setattr, ""); /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ # if defined __NR_openat2 && __NR_openat2 >= 0 # if defined systemd_NR_openat2 -_Static_assert(__NR_openat2 == systemd_NR_openat2, ""); +static_assert(__NR_openat2 == systemd_NR_openat2, ""); # endif # else # if defined __NR_openat2 @@ -370,7 +442,7 @@ _Static_assert(__NR_openat2 == systemd_NR_openat2, ""); /* 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 -_Static_assert(__NR_quotactl_fd == systemd_NR_quotactl_fd, ""); +static_assert(__NR_quotactl_fd == systemd_NR_quotactl_fd, ""); # endif # else # if defined __NR_quotactl_fd @@ -438,7 +510,7 @@ _Static_assert(__NR_quotactl_fd == systemd_NR_quotactl_fd, ""); /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ # if defined __NR_removexattrat && __NR_removexattrat >= 0 # if defined systemd_NR_removexattrat -_Static_assert(__NR_removexattrat == systemd_NR_removexattrat, ""); +static_assert(__NR_removexattrat == systemd_NR_removexattrat, ""); # endif # else # if defined __NR_removexattrat @@ -506,7 +578,7 @@ _Static_assert(__NR_removexattrat == systemd_NR_removexattrat, ""); /* may be an (invalid) negative number due to libseccomp, see PR 13319 */ # if defined __NR_setxattrat && __NR_setxattrat >= 0 # if defined systemd_NR_setxattrat -_Static_assert(__NR_setxattrat == systemd_NR_setxattrat, ""); +static_assert(__NR_setxattrat == systemd_NR_setxattrat, ""); # endif # else # if defined __NR_setxattrat @@ -517,71 +589,3 @@ _Static_assert(__NR_setxattrat == systemd_NR_setxattrat, ""); # endif # endif #endif - -#ifndef __IGNORE_open_tree_attr -# if defined(__aarch64__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__alpha__) -# define systemd_NR_open_tree_attr 577 -# elif defined(__arc__) || defined(__tilegx__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__arm__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__i386__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__ia64__) -# define systemd_NR_open_tree_attr -1 -# elif defined(__loongarch_lp64) -# define systemd_NR_open_tree_attr 467 -# elif defined(__m68k__) -# define systemd_NR_open_tree_attr 467 -# elif defined(_MIPS_SIM) -# if _MIPS_SIM == _MIPS_SIM_ABI32 -# define systemd_NR_open_tree_attr 4467 -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define systemd_NR_open_tree_attr 6467 -# elif _MIPS_SIM == _MIPS_SIM_ABI64 -# define systemd_NR_open_tree_attr 5467 -# else -# error "Unknown MIPS ABI" -# endif -# elif defined(__hppa__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__powerpc__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__riscv) -# if __riscv_xlen == 32 -# define systemd_NR_open_tree_attr 467 -# elif __riscv_xlen == 64 -# define systemd_NR_open_tree_attr 467 -# else -# error "Unknown RISC-V ABI" -# endif -# elif defined(__s390__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__sparc__) -# define systemd_NR_open_tree_attr 467 -# elif defined(__x86_64__) -# if defined(__ILP32__) -# define systemd_NR_open_tree_attr (467 | /* __X32_SYSCALL_BIT */ 0x40000000) -# else -# define systemd_NR_open_tree_attr 467 -# endif -# elif !defined(missing_arch_template) -# warning "open_tree_attr() syscall number is unknown for your architecture" -# endif - -/* may be an (invalid) negative number due to libseccomp, see PR 13319 */ -# if defined __NR_open_tree_attr && __NR_open_tree_attr >= 0 -# if defined systemd_NR_open_tree_attr -_Static_assert(__NR_open_tree_attr == systemd_NR_open_tree_attr, ""); -# endif -# else -# if defined __NR_open_tree_attr -# undef __NR_open_tree_attr -# endif -# if defined systemd_NR_open_tree_attr && systemd_NR_open_tree_attr >= 0 -# define __NR_open_tree_attr systemd_NR_open_tree_attr -# endif -# endif -#endif diff --git a/src/basic/syscalls-alpha.txt b/src/include/override/sys/syscalls-alpha.txt similarity index 100% rename from src/basic/syscalls-alpha.txt rename to src/include/override/sys/syscalls-alpha.txt diff --git a/src/basic/syscalls-arc.txt b/src/include/override/sys/syscalls-arc.txt similarity index 100% rename from src/basic/syscalls-arc.txt rename to src/include/override/sys/syscalls-arc.txt diff --git a/src/basic/syscalls-arm.txt b/src/include/override/sys/syscalls-arm.txt similarity index 100% rename from src/basic/syscalls-arm.txt rename to src/include/override/sys/syscalls-arm.txt diff --git a/src/basic/syscalls-arm64.txt b/src/include/override/sys/syscalls-arm64.txt similarity index 100% rename from src/basic/syscalls-arm64.txt rename to src/include/override/sys/syscalls-arm64.txt diff --git a/src/basic/syscalls-i386.txt b/src/include/override/sys/syscalls-i386.txt similarity index 100% rename from src/basic/syscalls-i386.txt rename to src/include/override/sys/syscalls-i386.txt diff --git a/src/basic/syscalls-ia64.txt b/src/include/override/sys/syscalls-ia64.txt similarity index 100% rename from src/basic/syscalls-ia64.txt rename to src/include/override/sys/syscalls-ia64.txt diff --git a/src/basic/syscalls-loongarch64.txt b/src/include/override/sys/syscalls-loongarch64.txt similarity index 100% rename from src/basic/syscalls-loongarch64.txt rename to src/include/override/sys/syscalls-loongarch64.txt diff --git a/src/basic/syscalls-m68k.txt b/src/include/override/sys/syscalls-m68k.txt similarity index 100% rename from src/basic/syscalls-m68k.txt rename to src/include/override/sys/syscalls-m68k.txt diff --git a/src/basic/syscalls-mips64.txt b/src/include/override/sys/syscalls-mips64.txt similarity index 100% rename from src/basic/syscalls-mips64.txt rename to src/include/override/sys/syscalls-mips64.txt diff --git a/src/basic/syscalls-mips64n32.txt b/src/include/override/sys/syscalls-mips64n32.txt similarity index 100% rename from src/basic/syscalls-mips64n32.txt rename to src/include/override/sys/syscalls-mips64n32.txt diff --git a/src/basic/syscalls-mipso32.txt b/src/include/override/sys/syscalls-mipso32.txt similarity index 100% rename from src/basic/syscalls-mipso32.txt rename to src/include/override/sys/syscalls-mipso32.txt diff --git a/src/basic/syscalls-parisc.txt b/src/include/override/sys/syscalls-parisc.txt similarity index 100% rename from src/basic/syscalls-parisc.txt rename to src/include/override/sys/syscalls-parisc.txt diff --git a/src/basic/syscalls-powerpc.txt b/src/include/override/sys/syscalls-powerpc.txt similarity index 100% rename from src/basic/syscalls-powerpc.txt rename to src/include/override/sys/syscalls-powerpc.txt diff --git a/src/basic/syscalls-powerpc64.txt b/src/include/override/sys/syscalls-powerpc64.txt similarity index 100% rename from src/basic/syscalls-powerpc64.txt rename to src/include/override/sys/syscalls-powerpc64.txt diff --git a/src/basic/syscalls-riscv32.txt b/src/include/override/sys/syscalls-riscv32.txt similarity index 100% rename from src/basic/syscalls-riscv32.txt rename to src/include/override/sys/syscalls-riscv32.txt diff --git a/src/basic/syscalls-riscv64.txt b/src/include/override/sys/syscalls-riscv64.txt similarity index 100% rename from src/basic/syscalls-riscv64.txt rename to src/include/override/sys/syscalls-riscv64.txt diff --git a/src/basic/syscalls-s390.txt b/src/include/override/sys/syscalls-s390.txt similarity index 100% rename from src/basic/syscalls-s390.txt rename to src/include/override/sys/syscalls-s390.txt diff --git a/src/basic/syscalls-s390x.txt b/src/include/override/sys/syscalls-s390x.txt similarity index 100% rename from src/basic/syscalls-s390x.txt rename to src/include/override/sys/syscalls-s390x.txt diff --git a/src/basic/syscalls-sparc.txt b/src/include/override/sys/syscalls-sparc.txt similarity index 100% rename from src/basic/syscalls-sparc.txt rename to src/include/override/sys/syscalls-sparc.txt diff --git a/src/basic/syscalls-x86_64.txt b/src/include/override/sys/syscalls-x86_64.txt similarity index 100% rename from src/basic/syscalls-x86_64.txt rename to src/include/override/sys/syscalls-x86_64.txt