Skip to content

Commit 7f89bc5

Browse files
committed
tools/nolibc: add support for waitid()
waitid() is the modern variant of the family of wait-like syscalls. Some architectures have dropped support for wait(), wait4() and waitpid() but all of them support waitid(). It is more flexible and easier to use than the older ones. Link: https://lore.kernel.org/r/20241221-nolibc-rv32-v1-1-d9ef6dab7c63@weissschuh.net Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
1 parent 4b92b79 commit 7f89bc5

File tree

1 file changed

+18
-0
lines changed
  • tools/include/nolibc

1 file changed

+18
-0
lines changed

tools/include/nolibc/sys.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/prctl.h>
2424
#include <linux/resource.h>
2525
#include <linux/utsname.h>
26+
#include <linux/signal.h>
2627

2728
#include "arch.h"
2829
#include "errno.h"
@@ -1225,6 +1226,23 @@ pid_t waitpid(pid_t pid, int *status, int options)
12251226
}
12261227

12271228

1229+
/*
1230+
* int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
1231+
*/
1232+
1233+
static __attribute__((unused))
1234+
int sys_waitid(int which, pid_t pid, siginfo_t *infop, int options, struct rusage *rusage)
1235+
{
1236+
return my_syscall5(__NR_waitid, which, pid, infop, options, rusage);
1237+
}
1238+
1239+
static __attribute__((unused))
1240+
int waitid(int which, pid_t pid, siginfo_t *infop, int options)
1241+
{
1242+
return __sysret(sys_waitid(which, pid, infop, options, NULL));
1243+
}
1244+
1245+
12281246
/*
12291247
* ssize_t write(int fd, const void *buf, size_t count);
12301248
*/

0 commit comments

Comments
 (0)