tools/nolibc: move syscall() to sys/syscall.h
This is the location regular userspace expects the definition. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250416-nolibc-split-sys-v1-7-a069a3f1d145@linutronix.de Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
committed by
Thomas Weißschuh
parent
c6e6c2c4d7
commit
0fd55773f4
@@ -47,6 +47,7 @@ all_files := \
|
||||
sys/auxv.h \
|
||||
sys/mman.h \
|
||||
sys/stat.h \
|
||||
sys/syscall.h \
|
||||
time.h \
|
||||
types.h \
|
||||
unistd.h \
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
#include "sys/auxv.h"
|
||||
#include "sys/mman.h"
|
||||
#include "sys/stat.h"
|
||||
#include "sys/syscall.h"
|
||||
#include "ctype.h"
|
||||
#include "elf.h"
|
||||
#include "signal.h"
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* syscall() definition for NOLIBC
|
||||
* Copyright (C) 2024 Thomas Weißschuh <linux@weissschuh.net>
|
||||
*/
|
||||
|
||||
#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__)
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "../nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_SYS_SYSCALL_H */
|
||||
@@ -56,12 +56,6 @@ int tcsetpgrp(int fd, pid_t pid)
|
||||
return ioctl(fd, TIOCSPGRP, &pid);
|
||||
}
|
||||
|
||||
#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__)
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "nolibc.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user