1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-10 01:17:44 +03:00

Merge pull request #19441 from keszybz/riscv-syscall-lists

Add syscall list for riscv
This commit is contained in:
Lennart Poettering 2021-04-28 21:17:43 +02:00 committed by GitHub
commit 249e7b6692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1037 additions and 78 deletions

View File

@ -480,11 +480,14 @@ conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h
decl_headers = '''
#include <uchar.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <linux/fs.h>
'''
foreach decl : ['char16_t',
'char32_t',
'struct mount_attr',
'struct statx',
]
@ -555,6 +558,9 @@ foreach ident : [
['execveat', '''#include <unistd.h>'''],
['close_range', '''#include <unistd.h>'''],
['epoll_pwait2', '''#include <sys/epoll.h>'''],
['mount_setattr', '''#include <sys/mount.h>'''],
['move_mount', '''#include <sys/mount.h>'''],
['open_tree', '''#include <sys/mount.h>'''],
]
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')

View File

@ -358,6 +358,7 @@ arch_list = [
'mipso32',
'powerpc',
'powerpc64',
'riscv64',
's390',
's390x',
'sparc',

View File

@ -425,3 +425,98 @@ static inline int missing_epoll_pwait2(
# define epoll_pwait2 missing_epoll_pwait2
#endif
/* ======================================================================= */
#if !HAVE_MOUNT_SETATTR
#if !HAVE_STRUCT_MOUNT_ATTR
struct mount_attr {
uint64_t attr_set;
uint64_t attr_clr;
uint64_t propagation;
uint64_t userns_fd;
};
#else
struct mount_attr;
#endif
#ifndef MOUNT_ATTR_IDMAP
#define MOUNT_ATTR_IDMAP 0x00100000
#endif
#ifndef AT_RECURSIVE
#define AT_RECURSIVE 0x8000
#endif
static inline int missing_mount_setattr(
int dfd,
const char *path,
unsigned flags,
struct mount_attr *attr,
size_t size) {
# if defined __NR_mount_setattr && __NR_mount_setattr >= 0
return syscall(__NR_mount_setattr, dfd, path, flags, attr, size);
# else
errno = ENOSYS;
return -1;
# endif
}
# define mount_setattr missing_mount_setattr
#endif
/* ======================================================================= */
#if !HAVE_OPEN_TREE
#ifndef OPEN_TREE_CLONE
#define OPEN_TREE_CLONE 1
#endif
#ifndef OPEN_TREE_CLOEXEC
#define OPEN_TREE_CLOEXEC O_CLOEXEC
#endif
static inline int missing_open_tree(
int dfd,
const char *filename,
unsigned flags) {
# if defined __NR_open_tree && __NR_open_tree >= 0
return syscall(__NR_open_tree, dfd, filename, flags);
# else
errno = ENOSYS;
return -1;
# endif
}
# define open_tree missing_open_tree
#endif
/* ======================================================================= */
#if !HAVE_MOVE_MOUNT
#ifndef MOVE_MOUNT_F_EMPTY_PATH
#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
#endif
static inline int missing_move_mount(
int from_dfd,
const char *from_pathname,
int to_dfd,
const char *to_pathname,
unsigned flags) {
# if defined __NR_move_mount && __NR_move_mount >= 0
return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd, to_pathname, flags);
# else
errno = ENOSYS;
return -1;
# endif
}
# define move_mount missing_move_mount
#endif

View File

@ -1,5 +1,38 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later
* This file is generated. Do not edit! */
* 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.
*/
/* 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(__riscv) && defined(__LP64__)
# 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__)
@ -28,6 +61,8 @@
# endif
# elif defined(__powerpc__)
# define systemd_NR_bpf 361
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_bpf 280
# elif defined(__s390__)
# define systemd_NR_bpf 351
# elif defined(__sparc__)
@ -38,7 +73,7 @@
# else
# define systemd_NR_bpf 321
# endif
# else
# elif !defined(missing_arch_template)
# warning "bpf() syscall number is unknown for your architecture"
# endif
@ -84,6 +119,8 @@ assert_cc(__NR_bpf == systemd_NR_bpf);
# endif
# elif defined(__powerpc__)
# define systemd_NR_close_range 436
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_close_range 436
# elif defined(__s390__)
# define systemd_NR_close_range 436
# elif defined(__sparc__)
@ -94,7 +131,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
@ -140,6 +177,8 @@ assert_cc(__NR_close_range == systemd_NR_close_range);
# endif
# elif defined(__powerpc__)
# define systemd_NR_copy_file_range 379
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_copy_file_range 285
# elif defined(__s390__)
# define systemd_NR_copy_file_range 375
# elif defined(__sparc__)
@ -150,7 +189,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
@ -169,6 +208,64 @@ assert_cc(__NR_copy_file_range == systemd_NR_copy_file_range);
# endif
#endif
#ifndef __IGNORE_epoll_pwait2
# if defined(__aarch64__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__alpha__)
# define systemd_NR_epoll_pwait2 551
# elif defined(__arc__) || defined(__tilegx__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__arm__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__i386__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__ia64__)
# define systemd_NR_epoll_pwait2 1465
# elif defined(__m68k__)
# define systemd_NR_epoll_pwait2 441
# elif defined(_MIPS_SIM)
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define systemd_NR_epoll_pwait2 4441
# elif _MIPS_SIM == _MIPS_SIM_NABI32
# define systemd_NR_epoll_pwait2 6441
# elif _MIPS_SIM == _MIPS_SIM_ABI64
# define systemd_NR_epoll_pwait2 5441
# else
# error "Unknown MIPS ABI"
# endif
# elif defined(__powerpc__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__s390__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__sparc__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__x86_64__)
# if defined(__ILP32__)
# define systemd_NR_epoll_pwait2 (441 | /* __X32_SYSCALL_BIT */ 0x40000000)
# else
# define systemd_NR_epoll_pwait2 441
# endif
# elif !defined(missing_arch_template)
# warning "epoll_pwait2() syscall number is unknown for your architecture"
# endif
/* may be an (invalid) negative number due to libseccomp, see PR 13319 */
# if defined __NR_epoll_pwait2 && __NR_epoll_pwait2 >= 0
# if defined systemd_NR_epoll_pwait2
assert_cc(__NR_epoll_pwait2 == systemd_NR_epoll_pwait2);
# endif
# else
# if defined __NR_epoll_pwait2
# undef __NR_epoll_pwait2
# endif
# if defined systemd_NR_epoll_pwait2 && systemd_NR_epoll_pwait2 >= 0
# define __NR_epoll_pwait2 systemd_NR_epoll_pwait2
# endif
# endif
#endif
#ifndef __IGNORE_getrandom
# if defined(__aarch64__)
# define systemd_NR_getrandom 278
@ -196,6 +293,8 @@ assert_cc(__NR_copy_file_range == systemd_NR_copy_file_range);
# endif
# elif defined(__powerpc__)
# define systemd_NR_getrandom 359
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_getrandom 278
# elif defined(__s390__)
# define systemd_NR_getrandom 349
# elif defined(__sparc__)
@ -206,7 +305,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
@ -252,6 +351,8 @@ assert_cc(__NR_getrandom == systemd_NR_getrandom);
# endif
# elif defined(__powerpc__)
# define systemd_NR_memfd_create 360
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_memfd_create 279
# elif defined(__s390__)
# define systemd_NR_memfd_create 350
# elif defined(__sparc__)
@ -262,7 +363,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
@ -281,6 +382,122 @@ assert_cc(__NR_memfd_create == systemd_NR_memfd_create);
# endif
#endif
#ifndef __IGNORE_mount_setattr
# if defined(__aarch64__)
# define systemd_NR_mount_setattr 442
# elif defined(__alpha__)
# define systemd_NR_mount_setattr 552
# elif defined(__arc__) || defined(__tilegx__)
# define systemd_NR_mount_setattr 442
# elif defined(__arm__)
# define systemd_NR_mount_setattr 442
# elif defined(__i386__)
# define systemd_NR_mount_setattr 442
# elif defined(__ia64__)
# define systemd_NR_mount_setattr 1466
# elif defined(__m68k__)
# define systemd_NR_mount_setattr 442
# elif defined(_MIPS_SIM)
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define systemd_NR_mount_setattr 4442
# elif _MIPS_SIM == _MIPS_SIM_NABI32
# define systemd_NR_mount_setattr 6442
# elif _MIPS_SIM == _MIPS_SIM_ABI64
# define systemd_NR_mount_setattr 5442
# else
# error "Unknown MIPS ABI"
# endif
# elif defined(__powerpc__)
# define systemd_NR_mount_setattr 442
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_mount_setattr 442
# elif defined(__s390__)
# define systemd_NR_mount_setattr 442
# elif defined(__sparc__)
# define systemd_NR_mount_setattr 442
# elif defined(__x86_64__)
# if defined(__ILP32__)
# define systemd_NR_mount_setattr (442 | /* __X32_SYSCALL_BIT */ 0x40000000)
# else
# define systemd_NR_mount_setattr 442
# endif
# elif !defined(missing_arch_template)
# warning "mount_setattr() syscall number is unknown for your architecture"
# endif
/* 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
assert_cc(__NR_mount_setattr == systemd_NR_mount_setattr);
# endif
# else
# if defined __NR_mount_setattr
# undef __NR_mount_setattr
# endif
# if defined systemd_NR_mount_setattr && systemd_NR_mount_setattr >= 0
# define __NR_mount_setattr systemd_NR_mount_setattr
# endif
# endif
#endif
#ifndef __IGNORE_move_mount
# if defined(__aarch64__)
# define systemd_NR_move_mount 429
# elif defined(__alpha__)
# define systemd_NR_move_mount 539
# elif defined(__arc__) || defined(__tilegx__)
# define systemd_NR_move_mount 429
# elif defined(__arm__)
# define systemd_NR_move_mount 429
# elif defined(__i386__)
# define systemd_NR_move_mount 429
# elif defined(__ia64__)
# define systemd_NR_move_mount 1453
# elif defined(__m68k__)
# define systemd_NR_move_mount 429
# elif defined(_MIPS_SIM)
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define systemd_NR_move_mount 4429
# elif _MIPS_SIM == _MIPS_SIM_NABI32
# define systemd_NR_move_mount 6429
# elif _MIPS_SIM == _MIPS_SIM_ABI64
# define systemd_NR_move_mount 5429
# else
# error "Unknown MIPS ABI"
# endif
# elif defined(__powerpc__)
# define systemd_NR_move_mount 429
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_move_mount 429
# elif defined(__s390__)
# define systemd_NR_move_mount 429
# elif defined(__sparc__)
# define systemd_NR_move_mount 429
# elif defined(__x86_64__)
# if defined(__ILP32__)
# define systemd_NR_move_mount (429 | /* __X32_SYSCALL_BIT */ 0x40000000)
# else
# define systemd_NR_move_mount 429
# endif
# elif !defined(missing_arch_template)
# warning "move_mount() syscall number is unknown for your architecture"
# endif
/* may be an (invalid) negative number due to libseccomp, see PR 13319 */
# if defined __NR_move_mount && __NR_move_mount >= 0
# if defined systemd_NR_move_mount
assert_cc(__NR_move_mount == systemd_NR_move_mount);
# endif
# else
# if defined __NR_move_mount
# undef __NR_move_mount
# endif
# if defined systemd_NR_move_mount && systemd_NR_move_mount >= 0
# define __NR_move_mount systemd_NR_move_mount
# endif
# endif
#endif
#ifndef __IGNORE_name_to_handle_at
# if defined(__aarch64__)
# define systemd_NR_name_to_handle_at 264
@ -308,6 +525,8 @@ assert_cc(__NR_memfd_create == systemd_NR_memfd_create);
# endif
# elif defined(__powerpc__)
# define systemd_NR_name_to_handle_at 345
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_name_to_handle_at 264
# elif defined(__s390__)
# define systemd_NR_name_to_handle_at 335
# elif defined(__sparc__)
@ -318,7 +537,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
@ -337,6 +556,64 @@ assert_cc(__NR_name_to_handle_at == systemd_NR_name_to_handle_at);
# endif
#endif
#ifndef __IGNORE_open_tree
# if defined(__aarch64__)
# define systemd_NR_open_tree 428
# elif defined(__alpha__)
# define systemd_NR_open_tree 538
# elif defined(__arc__) || defined(__tilegx__)
# define systemd_NR_open_tree 428
# elif defined(__arm__)
# define systemd_NR_open_tree 428
# elif defined(__i386__)
# define systemd_NR_open_tree 428
# elif defined(__ia64__)
# define systemd_NR_open_tree 1452
# elif defined(__m68k__)
# define systemd_NR_open_tree 428
# elif defined(_MIPS_SIM)
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define systemd_NR_open_tree 4428
# elif _MIPS_SIM == _MIPS_SIM_NABI32
# define systemd_NR_open_tree 6428
# elif _MIPS_SIM == _MIPS_SIM_ABI64
# define systemd_NR_open_tree 5428
# else
# error "Unknown MIPS ABI"
# endif
# elif defined(__powerpc__)
# define systemd_NR_open_tree 428
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_open_tree 428
# elif defined(__s390__)
# define systemd_NR_open_tree 428
# elif defined(__sparc__)
# define systemd_NR_open_tree 428
# elif defined(__x86_64__)
# if defined(__ILP32__)
# define systemd_NR_open_tree (428 | /* __X32_SYSCALL_BIT */ 0x40000000)
# else
# define systemd_NR_open_tree 428
# endif
# elif !defined(missing_arch_template)
# warning "open_tree() 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 && __NR_open_tree >= 0
# if defined systemd_NR_open_tree
assert_cc(__NR_open_tree == systemd_NR_open_tree);
# endif
# else
# if defined __NR_open_tree
# undef __NR_open_tree
# endif
# if defined systemd_NR_open_tree && systemd_NR_open_tree >= 0
# define __NR_open_tree systemd_NR_open_tree
# endif
# endif
#endif
#ifndef __IGNORE_pidfd_open
# if defined(__aarch64__)
# define systemd_NR_pidfd_open 434
@ -364,6 +641,8 @@ assert_cc(__NR_name_to_handle_at == systemd_NR_name_to_handle_at);
# endif
# elif defined(__powerpc__)
# define systemd_NR_pidfd_open 434
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_pidfd_open 434
# elif defined(__s390__)
# define systemd_NR_pidfd_open 434
# elif defined(__sparc__)
@ -374,7 +653,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
@ -420,6 +699,8 @@ assert_cc(__NR_pidfd_open == systemd_NR_pidfd_open);
# endif
# elif defined(__powerpc__)
# define systemd_NR_pidfd_send_signal 424
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_pidfd_send_signal 424
# elif defined(__s390__)
# define systemd_NR_pidfd_send_signal 424
# elif defined(__sparc__)
@ -430,7 +711,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
@ -476,6 +757,8 @@ assert_cc(__NR_pidfd_send_signal == systemd_NR_pidfd_send_signal);
# endif
# elif defined(__powerpc__)
# define systemd_NR_pkey_mprotect 386
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_pkey_mprotect 288
# elif defined(__s390__)
# define systemd_NR_pkey_mprotect 384
# elif defined(__sparc__)
@ -486,7 +769,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
@ -532,6 +815,8 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect);
# endif
# elif defined(__powerpc__)
# define systemd_NR_renameat2 357
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_renameat2 276
# elif defined(__s390__)
# define systemd_NR_renameat2 347
# elif defined(__sparc__)
@ -542,7 +827,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
@ -588,6 +873,8 @@ assert_cc(__NR_renameat2 == systemd_NR_renameat2);
# endif
# elif defined(__powerpc__)
# define systemd_NR_setns 350
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_setns 268
# elif defined(__s390__)
# define systemd_NR_setns 339
# elif defined(__sparc__)
@ -598,7 +885,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
@ -644,6 +931,8 @@ assert_cc(__NR_setns == systemd_NR_setns);
# endif
# elif defined(__powerpc__)
# define systemd_NR_statx 383
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_statx 291
# elif defined(__s390__)
# define systemd_NR_statx 379
# elif defined(__sparc__)
@ -654,7 +943,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
@ -672,59 +961,3 @@ assert_cc(__NR_statx == systemd_NR_statx);
# endif
# endif
#endif
#ifndef __IGNORE_epoll_pwait2
# if defined(__aarch64__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__alpha__)
# define systemd_NR_epoll_pwait2 551
# elif defined(__arc__) || defined(__tilegx__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__arm__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__i386__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__ia64__)
# define systemd_NR_epoll_pwait2 1465
# elif defined(__m68k__)
# define systemd_NR_epoll_pwait2 441
# elif defined(_MIPS_SIM)
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define systemd_NR_epoll_pwait2 4441
# elif _MIPS_SIM == _MIPS_SIM_NABI32
# define systemd_NR_epoll_pwait2 6441
# elif _MIPS_SIM == _MIPS_SIM_ABI64
# define systemd_NR_epoll_pwait2 5441
# else
# error "Unknown MIPS ABI"
# endif
# elif defined(__powerpc__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__s390__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__sparc__)
# define systemd_NR_epoll_pwait2 441
# elif defined(__x86_64__)
# if defined(__ILP32__)
# define systemd_NR_epoll_pwait2 (441 | /* __X32_SYSCALL_BIT */ 0x40000000)
# else
# define systemd_NR_epoll_pwait2 441
# endif
# else
# warning "epoll_pwait2() syscall number is unknown for your architecture"
# endif
/* may be an (invalid) negative number due to libseccomp, see PR 13319 */
# if defined __NR_epoll_pwait2 && __NR_epoll_pwait2 >= 0
# if defined systemd_NR_epoll_pwait2
assert_cc(__NR_epoll_pwait2 == systemd_NR_epoll_pwait2);
# endif
# else
# if defined __NR_epoll_pwait2
# undef __NR_epoll_pwait2
# endif
# if defined systemd_NR_epoll_pwait2 && systemd_NR_epoll_pwait2 >= 0
# define __NR_epoll_pwait2 systemd_NR_epoll_pwait2
# endif
# endif
#endif

View File

@ -9,16 +9,20 @@ SYSCALLS = [
'bpf',
'close_range',
'copy_file_range',
'epoll_pwait2',
'getrandom',
'memfd_create',
'mount_setattr',
'move_mount',
'name_to_handle_at',
'open_tree',
'pidfd_open',
'pidfd_send_signal',
'pkey_mprotect',
'renameat2',
'setns',
'statx',
'epoll_pwait2']
]
def dictify(f):
def wrap(*args, **kwargs):
@ -37,8 +41,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__)
@ -65,6 +73,8 @@ DEF_TEMPLATE = '''
# endif
# elif defined(__powerpc__)
# define systemd_NR_{syscall} {nr_powerpc}
# elif defined(__riscv) && defined(__LP64__)
# define systemd_NR_{syscall} {nr_riscv64}
# elif defined(__s390__)
# define systemd_NR_{syscall} {nr_s390}
# elif defined(__sparc__)
@ -75,9 +85,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 +105,37 @@ 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='')
* 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.
*/
''',
file=out)
print(ARCH_CHECK, file=out)
for syscall in syscalls:
print_syscall_def(syscall, tables, out)

View File

@ -0,0 +1,594 @@
_llseek
_newselect
_sysctl
accept 202
accept4 242
access
acct 89
add_key 217
adjtimex 171
alarm
arc_gettls
arc_settls
arc_usr_cmpxchg
arch_prctl
arm_fadvise64_64
atomic_barrier
atomic_cmpxchg_32
bdflush
bind 200
bpf 280
brk 214
cachectl
cacheflush
capget 90
capset 91
chdir 49
chmod
chown
chown32
chroot 51
clock_adjtime 266
clock_adjtime64
clock_getres 114
clock_getres_time64
clock_gettime 113
clock_gettime64
clock_nanosleep 115
clock_nanosleep_time64
clock_settime 112
clock_settime64
clone 220
clone2
clone3 435
close 57
close_range 436
connect 203
copy_file_range 285
creat
create_module
delete_module 106
dipc
dup 23
dup2
dup3 24
epoll_create
epoll_create1 20
epoll_ctl 21
epoll_ctl_old
epoll_pwait 22
epoll_pwait2 441
epoll_wait
epoll_wait_old
eventfd
eventfd2 19
exec_with_loader
execv
execve 221
execveat 281
exit 93
exit_group 94
faccessat 48
faccessat2 439
fadvise64 223
fadvise64_64
fallocate 47
fanotify_init 262
fanotify_mark 263
fchdir 50
fchmod 52
fchmodat 53
fchown 55
fchown32
fchownat 54
fcntl 25
fcntl64
fdatasync 83
fgetxattr 10
finit_module 273
flistxattr 13
flock 32
fork
fp_udfiex_crtl
fremovexattr 16
fsconfig 431
fsetxattr 7
fsmount 432
fsopen 430
fspick 433
fstat 80
fstat64
fstatat64
fstatfs 44
fstatfs64
fsync 82
ftruncate 46
ftruncate64
futex 98
futex_time64
futimesat
get_kernel_syms
get_mempolicy 236
get_robust_list 100
get_thread_area
getcpu 168
getcwd 17
getdents
getdents64 61
getdomainname
getdtablesize
getegid 177
getegid32
geteuid 175
geteuid32
getgid 176
getgid32
getgroups 158
getgroups32
gethostname
getitimer 102
getpagesize
getpeername 205
getpgid 155
getpgrp
getpid 172
getpmsg
getppid 173
getpriority 141
getrandom 278
getresgid 150
getresgid32
getresuid 148
getresuid32
getrlimit 163
getrusage 165
getsid 156
getsockname 204
getsockopt 209
gettid 178
gettimeofday 169
getuid 174
getuid32
getunwind
getxattr 8
getxgid
getxpid
getxuid
idle
init_module 105
inotify_add_watch 27
inotify_init
inotify_init1 26
inotify_rm_watch 28
io_cancel 3
io_destroy 1
io_getevents 4
io_pgetevents 292
io_pgetevents_time64
io_setup 0
io_submit 2
io_uring_enter 426
io_uring_register 427
io_uring_setup 425
ioctl 29
ioperm
iopl
ioprio_get 31
ioprio_set 30
ipc
kcmp 272
kern_features
kexec_file_load 294
kexec_load 104
keyctl 219
kill 129
lchown
lchown32
lgetxattr 9
link
linkat 37
listen 201
listxattr 11
llistxattr 12
lookup_dcookie 18
lremovexattr 15
lseek 62
lsetxattr 6
lstat
lstat64
madvise 233
mbind 235
membarrier 283
memfd_create 279
memory_ordering
migrate_pages 238
mincore 232
mkdir
mkdirat 34
mknod
mknodat 33
mlock 228
mlock2 284
mlockall 230
mmap 222
mmap2
modify_ldt
mount 40
mount_setattr 442
move_mount 429
move_pages 239
mprotect 226
mq_getsetattr 185
mq_notify 184
mq_open 180
mq_timedreceive 183
mq_timedreceive_time64
mq_timedsend 182
mq_timedsend_time64
mq_unlink 181
mremap 216
msgctl 187
msgget 186
msgrcv 188
msgsnd 189
msync 227
multiplexer
munlock 229
munlockall 231
munmap 215
name_to_handle_at 264
nanosleep 101
newfstatat 79
nfsservctl 42
nice
old_adjtimex
old_getpagesize
oldfstat
oldlstat
oldolduname
oldstat
oldumount
olduname
open
open_by_handle_at 265
open_tree 428
openat 56
openat2 437
or1k_atomic
osf_adjtime
osf_afs_syscall
osf_alt_plock
osf_alt_setsid
osf_alt_sigpending
osf_asynch_daemon
osf_audcntl
osf_audgen
osf_chflags
osf_execve
osf_exportfs
osf_fchflags
osf_fdatasync
osf_fpathconf
osf_fstat
osf_fstatfs
osf_fstatfs64
osf_fuser
osf_getaddressconf
osf_getdirentries
osf_getdomainname
osf_getfh
osf_getfsstat
osf_gethostid
osf_getitimer
osf_getlogin
osf_getmnt
osf_getrusage
osf_getsysinfo
osf_gettimeofday
osf_kloadcall
osf_kmodcall
osf_lstat
osf_memcntl
osf_mincore
osf_mount
osf_mremap
osf_msfs_syscall
osf_msleep
osf_mvalid
osf_mwakeup
osf_naccept
osf_nfssvc
osf_ngetpeername
osf_ngetsockname
osf_nrecvfrom
osf_nrecvmsg
osf_nsendmsg
osf_ntp_adjtime
osf_ntp_gettime
osf_old_creat
osf_old_fstat
osf_old_getpgrp
osf_old_killpg
osf_old_lstat
osf_old_open
osf_old_sigaction
osf_old_sigblock
osf_old_sigreturn
osf_old_sigsetmask
osf_old_sigvec
osf_old_stat
osf_old_vadvise
osf_old_vtrace
osf_old_wait
osf_oldquota
osf_pathconf
osf_pid_block
osf_pid_unblock
osf_plock
osf_priocntlset
osf_profil
osf_proplist_syscall
osf_reboot
osf_revoke
osf_sbrk
osf_security
osf_select
osf_set_program_attributes
osf_set_speculative
osf_sethostid
osf_setitimer
osf_setlogin
osf_setsysinfo
osf_settimeofday
osf_shmat
osf_signal
osf_sigprocmask
osf_sigsendset
osf_sigstack
osf_sigwaitprim
osf_sstk
osf_stat
osf_statfs
osf_statfs64
osf_subsys_info
osf_swapctl
osf_swapon
osf_syscall
osf_sysinfo
osf_table
osf_uadmin
osf_usleep_thread
osf_uswitch
osf_utc_adjtime
osf_utc_gettime
osf_utimes
osf_utsname
osf_wait4
osf_waitid
pause
pciconfig_iobase
pciconfig_read
pciconfig_write
perf_event_open 241
perfctr
perfmonctl
personality 92
pidfd_getfd 438
pidfd_open 434
pidfd_send_signal 424
pipe
pipe2 59
pivot_root 41
pkey_alloc 289
pkey_free 290
pkey_mprotect 288
poll
ppoll 73
ppoll_time64
prctl 167
pread64 67
preadv 69
preadv2 286
prlimit64 261
process_madvise 440
process_vm_readv 270
process_vm_writev 271
pselect6 72
pselect6_time64
ptrace 117
pwrite64 68
pwritev 70
pwritev2 287
query_module
quotactl 60
read 63
readahead 213
readdir
readlink
readlinkat 78
readv 65
reboot 142
recv
recvfrom 207
recvmmsg 243
recvmmsg_time64
recvmsg 212
remap_file_pages 234
removexattr 14
rename
renameat
renameat2 276
request_key 218
restart_syscall 128
riscv_flush_icache 259
rmdir
rseq 293
rt_sigaction 134
rt_sigpending 136
rt_sigprocmask 135
rt_sigqueueinfo 138
rt_sigreturn 139
rt_sigsuspend 133
rt_sigtimedwait 137
rt_sigtimedwait_time64
rt_tgsigqueueinfo 240
rtas
s390_guarded_storage
s390_pci_mmio_read
s390_pci_mmio_write
s390_runtime_instr
s390_sthyi
sched_get_affinity
sched_get_priority_max 125
sched_get_priority_min 126
sched_getaffinity 123
sched_getattr 275
sched_getparam 121
sched_getscheduler 120
sched_rr_get_interval 127
sched_rr_get_interval_time64
sched_set_affinity
sched_setaffinity 122
sched_setattr 274
sched_setparam 118
sched_setscheduler 119
sched_yield 124
seccomp 277
select
semctl 191
semget 190
semop 193
semtimedop 192
semtimedop_time64
send
sendfile 71
sendfile64
sendmmsg 269
sendmsg 211
sendto 206
set_mempolicy 237
set_robust_list 99
set_thread_area
set_tid_address 96
setdomainname 162
setfsgid 152
setfsgid32
setfsuid 151
setfsuid32
setgid 144
setgid32
setgroups 159
setgroups32
sethae
sethostname 161
setitimer 103
setns 268
setpgid 154
setpgrp
setpriority 140
setregid 143
setregid32
setresgid 149
setresgid32
setresuid 147
setresuid32
setreuid 145
setreuid32
setrlimit 164
setsid 157
setsockopt 208
settimeofday 170
setuid 146
setuid32
setxattr 5
sgetmask
shmat 196
shmctl 195
shmdt 197
shmget 194
shutdown 210
sigaction
sigaltstack 132
signal
signalfd
signalfd4 74
sigpending
sigprocmask
sigreturn
sigsuspend
socket 198
socketcall
socketpair 199
splice 76
spu_create
spu_run
ssetmask
stat
stat64
statfs 43
statfs64
statx 291
stime
subpage_prot
swapcontext
swapoff 225
swapon 224
switch_endian
symlink
symlinkat 36
sync 81
sync_file_range 84
sync_file_range2
syncfs 267
sys_debug_setcontext
syscall
sysfs
sysinfo 179
syslog 116
sysmips
tee 77
tgkill 131
time
timer_create 107
timer_delete 111
timer_getoverrun 109
timer_gettime 108
timer_gettime64
timer_settime 110
timer_settime64
timerfd
timerfd_create 85
timerfd_gettime 87
timerfd_gettime64
timerfd_settime 86
timerfd_settime64
times 153
tkill 130
truncate 45
truncate64
ugetrlimit
umask 166
umount
umount2 39
uname 160
unlink
unlinkat 35
unshare 97
uselib
userfaultfd 282
ustat
utime
utimensat 88
utimensat_time64
utimes
utrap_install
vfork
vhangup 58
vm86
vm86old
vmsplice 75
wait4 260
waitid 95
waitpid
write 64
writev 66