mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 07:47:50 +00:00
tools/nolibc: move wait() and friends to sys/wait.h
This is the location regular userspace expects these definitions. 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-10-a069a3f1d145@linutronix.de Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
This commit is contained in:
committed by
Thomas Weißschuh
parent
ffb94910c3
commit
6d1724ec86
@@ -50,6 +50,7 @@ all_files := \
|
||||
sys/syscall.h \
|
||||
sys/time.h \
|
||||
sys/types.h \
|
||||
sys/wait.h \
|
||||
time.h \
|
||||
types.h \
|
||||
unistd.h \
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
#include "sys/stat.h"
|
||||
#include "sys/syscall.h"
|
||||
#include "sys/time.h"
|
||||
#include "sys/wait.h"
|
||||
#include "ctype.h"
|
||||
#include "elf.h"
|
||||
#include "signal.h"
|
||||
|
||||
@@ -1054,59 +1054,6 @@ int unlink(const char *path)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* pid_t wait(int *status);
|
||||
* pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
|
||||
* pid_t waitpid(pid_t pid, int *status, int options);
|
||||
*/
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage)
|
||||
{
|
||||
#ifdef __NR_wait4
|
||||
return my_syscall4(__NR_wait4, pid, status, options, rusage);
|
||||
#else
|
||||
return __nolibc_enosys(__func__, pid, status, options, rusage);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t wait(int *status)
|
||||
{
|
||||
return __sysret(sys_wait4(-1, status, 0, NULL));
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage)
|
||||
{
|
||||
return __sysret(sys_wait4(pid, status, options, rusage));
|
||||
}
|
||||
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t waitpid(pid_t pid, int *status, int options)
|
||||
{
|
||||
return __sysret(sys_wait4(pid, status, options, NULL));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
|
||||
*/
|
||||
|
||||
static __attribute__((unused))
|
||||
int sys_waitid(int which, pid_t pid, siginfo_t *infop, int options, struct rusage *rusage)
|
||||
{
|
||||
return my_syscall5(__NR_waitid, which, pid, infop, options, rusage);
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
int waitid(int which, pid_t pid, siginfo_t *infop, int options)
|
||||
{
|
||||
return __sysret(sys_waitid(which, pid, infop, options, NULL));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ssize_t write(int fd, const void *buf, size_t count);
|
||||
*/
|
||||
|
||||
71
tools/include/nolibc/sys/wait.h
Normal file
71
tools/include/nolibc/sys/wait.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* wait definitions for NOLIBC
|
||||
* Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_SYS_WAIT_H
|
||||
#define _NOLIBC_SYS_WAIT_H
|
||||
|
||||
#include "../arch.h"
|
||||
#include "../std.h"
|
||||
#include "../types.h"
|
||||
|
||||
/*
|
||||
* pid_t wait(int *status);
|
||||
* pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage);
|
||||
* pid_t waitpid(pid_t pid, int *status, int options);
|
||||
*/
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage)
|
||||
{
|
||||
#ifdef __NR_wait4
|
||||
return my_syscall4(__NR_wait4, pid, status, options, rusage);
|
||||
#else
|
||||
return __nolibc_enosys(__func__, pid, status, options, rusage);
|
||||
#endif
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t wait(int *status)
|
||||
{
|
||||
return __sysret(sys_wait4(-1, status, 0, NULL));
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage)
|
||||
{
|
||||
return __sysret(sys_wait4(pid, status, options, rusage));
|
||||
}
|
||||
|
||||
|
||||
static __attribute__((unused))
|
||||
pid_t waitpid(pid_t pid, int *status, int options)
|
||||
{
|
||||
return __sysret(sys_wait4(pid, status, options, NULL));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
|
||||
*/
|
||||
|
||||
static __attribute__((unused))
|
||||
int sys_waitid(int which, pid_t pid, siginfo_t *infop, int options, struct rusage *rusage)
|
||||
{
|
||||
return my_syscall5(__NR_waitid, which, pid, infop, options, rusage);
|
||||
}
|
||||
|
||||
static __attribute__((unused))
|
||||
int waitid(int which, pid_t pid, siginfo_t *infop, int options)
|
||||
{
|
||||
return __sysret(sys_waitid(which, pid, infop, options, NULL));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "../nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_SYS_WAIT_H */
|
||||
Reference in New Issue
Block a user