From: Thomas Weißschuh Date: Sat, 15 Apr 2023 21:28:47 +0000 (+0200) Subject: tools/nolibc: s390: provide custom implementation for sys_fork X-Git-Tag: v6.5-rc1~208^2~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=404fa87c0eafbd420c2a016b964facb92250ae85;p=thirdparty%2Fkernel%2Flinux.git tools/nolibc: s390: provide custom implementation for sys_fork On s390 the first two arguments to the clone() syscall are swapped, as documented in clone(2). Signed-off-by: Thomas Weißschuh Cc: Sven Schnelle Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- diff --git a/tools/include/nolibc/arch-s390.h b/tools/include/nolibc/arch-s390.h index c62ee2472407e..a738e7f3f8e80 100644 --- a/tools/include/nolibc/arch-s390.h +++ b/tools/include/nolibc/arch-s390.h @@ -5,6 +5,7 @@ #ifndef _NOLIBC_ARCH_S390_H #define _NOLIBC_ARCH_S390_H +#include #include /* The struct returned by the stat() syscall, equivalent to stat64(). The @@ -223,4 +224,12 @@ void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd, return (void *)my_syscall1(__NR_mmap, &args); } #define sys_mmap sys_mmap + +static __attribute__((unused)) +pid_t sys_fork(void) +{ + return my_syscall5(__NR_clone, 0, SIGCHLD, 0, 0, 0); +} +#define sys_fork sys_fork + #endif /* _NOLIBC_ARCH_S390_H */ diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 1b9b91cd8b570..60dffb1cbf961 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -336,6 +336,7 @@ void exit(int status) * pid_t fork(void); */ +#ifndef sys_fork static __attribute__((unused)) pid_t sys_fork(void) { @@ -351,6 +352,7 @@ pid_t sys_fork(void) #error Neither __NR_clone nor __NR_fork defined, cannot implement sys_fork() #endif } +#endif static __attribute__((unused)) pid_t fork(void)