mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Inclusion of any nolibc header file should also bring all other headers. On the other hand it should also be possible to include any nolibc header files in any order. Currently this is implemented by including the catch-all nolibc.h after the headers own definitions. This is problematic if one nolibc header depends on another one. The first header has to include the other one before defining any symbols. That in turn will include the rest of nolibc while the current header has not defined anything yet. If any other part of nolibc depends on definitions from the current header, errors are encountered. This is already the case today. Effectively nolibc can only be included in the order of nolibc.h. Restructure the way "nolibc.h" is included. Move it to the beginning of the header files and before the include guards. Now any header will behave exactly like "nolibc.h" while the include guards prevent any duplicate definitions. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250424-nolibc-header-check-v1-2-011576b6ed6f@linutronix.de
19 lines
646 B
C
19 lines
646 B
C
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
|
/*
|
|
* syscall() definition for NOLIBC
|
|
* Copyright (C) 2024 Thomas Weißschuh <linux@weissschuh.net>
|
|
*/
|
|
|
|
/* make sure to include all global symbols */
|
|
#include "../nolibc.h"
|
|
|
|
#ifndef _NOLIBC_SYS_SYSCALL_H
|
|
#define _NOLIBC_SYS_SYSCALL_H
|
|
|
|
#define __syscall_narg(_0, _1, _2, _3, _4, _5, _6, N, ...) N
|
|
#define _syscall_narg(...) __syscall_narg(__VA_ARGS__, 6, 5, 4, 3, 2, 1, 0)
|
|
#define _syscall(N, ...) __sysret(my_syscall##N(__VA_ARGS__))
|
|
#define _syscall_n(N, ...) _syscall(N, __VA_ARGS__)
|
|
#define syscall(...) _syscall_n(_syscall_narg(__VA_ARGS__), ##__VA_ARGS__)
|
|
|
|
#endif /* _NOLIBC_SYS_SYSCALL_H */
|