mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
basic/missing-syscalls: only emit one warning about missing numbers
The ifdef pattern is the same for all syscalls, so most of the time, if one is not defined, all others will too. So let's reduce the noise a bit and emit one warning in case the support for the architecture is fully missing. (Current template was copied over from before when we added numbers for each syscall by hand and stopped making sense when we started generating the header from a table that is expected to have all syscall numbers.)
This commit is contained in:
parent
192a9d95ea
commit
94dfd85b0c
@ -1,6 +1,34 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
* This file is generated. Do not edit! */
|
||||
|
||||
/* 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__)
|
||||
# elif defined(__alpha__)
|
||||
# elif defined(__arc__) || defined(__tilegx__)
|
||||
# elif defined(__arm__)
|
||||
# elif defined(__i386__)
|
||||
# elif defined(__ia64__)
|
||||
# elif defined(__m68k__)
|
||||
# elif defined(_MIPS_SIM)
|
||||
# if _MIPS_SIM == _MIPS_SIM_ABI32
|
||||
# elif _MIPS_SIM == _MIPS_SIM_NABI32
|
||||
# elif _MIPS_SIM == _MIPS_SIM_ABI64
|
||||
# else
|
||||
# error "Unknown MIPS ABI"
|
||||
# endif
|
||||
# elif defined(__powerpc__)
|
||||
# elif defined(__s390__)
|
||||
# elif defined(__sparc__)
|
||||
# elif defined(__x86_64__)
|
||||
# if defined(__ILP32__)
|
||||
# else
|
||||
# endif
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "Current architecture is missing from the template"
|
||||
# define missing_arch_template 1
|
||||
# endif
|
||||
|
||||
#ifndef __IGNORE_bpf
|
||||
# if defined(__aarch64__)
|
||||
# define systemd_NR_bpf 280
|
||||
@ -38,7 +66,7 @@
|
||||
# else
|
||||
# define systemd_NR_bpf 321
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "bpf() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -94,7 +122,7 @@ assert_cc(__NR_bpf == systemd_NR_bpf);
|
||||
# else
|
||||
# define systemd_NR_close_range 436
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "close_range() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -150,7 +178,7 @@ assert_cc(__NR_close_range == systemd_NR_close_range);
|
||||
# else
|
||||
# define systemd_NR_copy_file_range 326
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "copy_file_range() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -206,7 +234,7 @@ assert_cc(__NR_copy_file_range == systemd_NR_copy_file_range);
|
||||
# else
|
||||
# define systemd_NR_getrandom 318
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "getrandom() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -262,7 +290,7 @@ assert_cc(__NR_getrandom == systemd_NR_getrandom);
|
||||
# else
|
||||
# define systemd_NR_memfd_create 319
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "memfd_create() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -318,7 +346,7 @@ assert_cc(__NR_memfd_create == systemd_NR_memfd_create);
|
||||
# else
|
||||
# define systemd_NR_name_to_handle_at 303
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "name_to_handle_at() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -374,7 +402,7 @@ assert_cc(__NR_name_to_handle_at == systemd_NR_name_to_handle_at);
|
||||
# else
|
||||
# define systemd_NR_pidfd_open 434
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "pidfd_open() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -430,7 +458,7 @@ assert_cc(__NR_pidfd_open == systemd_NR_pidfd_open);
|
||||
# else
|
||||
# define systemd_NR_pidfd_send_signal 424
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "pidfd_send_signal() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -486,7 +514,7 @@ assert_cc(__NR_pidfd_send_signal == systemd_NR_pidfd_send_signal);
|
||||
# else
|
||||
# define systemd_NR_pkey_mprotect 329
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "pkey_mprotect() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -542,7 +570,7 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect);
|
||||
# else
|
||||
# define systemd_NR_renameat2 316
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "renameat2() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -598,7 +626,7 @@ assert_cc(__NR_renameat2 == systemd_NR_renameat2);
|
||||
# else
|
||||
# define systemd_NR_setns 308
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "setns() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -654,7 +682,7 @@ assert_cc(__NR_setns == systemd_NR_setns);
|
||||
# else
|
||||
# define systemd_NR_statx 332
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "statx() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
@ -710,7 +738,7 @@ assert_cc(__NR_statx == systemd_NR_statx);
|
||||
# else
|
||||
# define systemd_NR_epoll_pwait2 441
|
||||
# endif
|
||||
# else
|
||||
# elif !defined(missing_arch_template)
|
||||
# warning "epoll_pwait2() syscall number is unknown for your architecture"
|
||||
# endif
|
||||
|
||||
|
@ -37,8 +37,12 @@ def parse_syscall_tables(filenames):
|
||||
return {filename.split('-')[-1][:-4]: parse_syscall_table(filename)
|
||||
for filename in filenames}
|
||||
|
||||
DEF_TEMPLATE = '''
|
||||
DEF_TEMPLATE_A = '''\
|
||||
|
||||
#ifndef __IGNORE_{syscall}
|
||||
'''
|
||||
|
||||
DEF_TEMPLATE_B = '''\
|
||||
# if defined(__aarch64__)
|
||||
# define systemd_NR_{syscall} {nr_arm64}
|
||||
# elif defined(__alpha__)
|
||||
@ -75,9 +79,12 @@ DEF_TEMPLATE = '''
|
||||
# else
|
||||
# define systemd_NR_{syscall} {nr_x86_64}
|
||||
# endif
|
||||
# else
|
||||
# warning "{syscall}() syscall number is unknown for your architecture"
|
||||
# elif !defined(missing_arch_template)
|
||||
%s
|
||||
# endif
|
||||
'''
|
||||
|
||||
DEF_TEMPLATE_C = '''\
|
||||
|
||||
/* may be an (invalid) negative number due to libseccomp, see PR 13319 */
|
||||
# if defined __NR_{syscall} && __NR_{syscall} >= 0
|
||||
@ -92,20 +99,33 @@ assert_cc(__NR_{syscall} == systemd_NR_{syscall});
|
||||
# define __NR_{syscall} systemd_NR_{syscall}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
'''
|
||||
#endif'''
|
||||
|
||||
DEF_TEMPLATE = (DEF_TEMPLATE_A +
|
||||
DEF_TEMPLATE_B % '# warning "{syscall}() syscall number is unknown for your architecture"' +
|
||||
DEF_TEMPLATE_C)
|
||||
|
||||
ARCH_CHECK = '''\
|
||||
/* Note: if this code looks strange, this is because it is derived from the same
|
||||
* template as the per-syscall blocks below. */
|
||||
''' + '\n'.join(line for line in DEF_TEMPLATE_B.splitlines()
|
||||
if ' define ' not in line) % '''\
|
||||
# warning "Current architecture is missing from the template"
|
||||
# define missing_arch_template 1'''
|
||||
|
||||
def print_syscall_def(syscall, tables, out):
|
||||
mappings = {f'nr_{arch}':t.get(syscall, -1)
|
||||
for arch, t in tables.items()}
|
||||
print(DEF_TEMPLATE.format(syscall=syscall, **mappings),
|
||||
file=out, end='')
|
||||
file=out)
|
||||
|
||||
def print_syscall_defs(syscalls, tables, out):
|
||||
print('''\
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
* This file is generated. Do not edit! */
|
||||
''' , file=out, end='')
|
||||
''',
|
||||
file=out)
|
||||
print(ARCH_CHECK, file=out)
|
||||
for syscall in syscalls:
|
||||
print_syscall_def(syscall, tables, out)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user