diff options
author | 2024-12-21 15:44:29 +0100 | |
---|---|---|
committer | 2025-01-13 22:21:34 +0100 | |
commit | a0bc8947ac731ff95a56e0c1737e69e8c56d5b78 (patch) | |
tree | ea8a8e7b611d3fcc0389fc3a6fbd03fb372c1fe8 | |
parent | tools/nolibc: add support for waitid() (diff) | |
download | wireguard-linux-a0bc8947ac731ff95a56e0c1737e69e8c56d5b78.tar.xz wireguard-linux-a0bc8947ac731ff95a56e0c1737e69e8c56d5b78.zip |
selftests/nolibc: use waitid() over waitpid()
Newer archs like riscv32 don't provide waitpid() anymore.
Switch to waitid() which is available everywhere.
Link: https://lore.kernel.org/r/20241221-nolibc-rv32-v1-2-d9ef6dab7c63@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
-rw-r--r-- | tools/testing/selftests/nolibc/nolibc-test.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 6fba7025c5e3..60c50968d363 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -1323,7 +1323,8 @@ static int run_protection(int min __attribute__((unused)), int max __attribute__((unused))) { pid_t pid; - int llen = 0, status; + int llen = 0, ret; + siginfo_t siginfo = {}; struct rlimit rlimit = { 0, 0 }; llen += printf("0 -fstackprotector "); @@ -1361,10 +1362,11 @@ static int run_protection(int min __attribute__((unused)), return 1; default: - pid = waitpid(pid, &status, 0); + ret = waitid(P_PID, pid, &siginfo, WEXITED); - if (pid == -1 || !WIFSIGNALED(status) || WTERMSIG(status) != SIGABRT) { - llen += printf("waitpid()"); + if (ret != 0 || siginfo.si_signo != SIGCHLD || + siginfo.si_code != CLD_KILLED || siginfo.si_status != SIGABRT) { + llen += printf("waitid()"); result(llen, FAIL); return 1; } |