]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
Revert "selftests/nolibc: use waitid() over waitpid()"
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Fri, 11 Apr 2025 09:00:46 +0000 (11:00 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Tue, 22 Apr 2025 08:58:22 +0000 (10:58 +0200)
nolibc's waitpid() now uses the waitid() syscall internally.
This removes the original reasoning for the reverted commit as
waitpid() is now available on all platforms and has an easier interface.

Switch back to waitpid().

This reverts commit a0bc8947ac731ff95a56e0c1737e69e8c56d5b78.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
tools/testing/selftests/nolibc/nolibc-test.c

index b6f736fdeadf3b99b5e203824d3c211e22ee92f4..64f88b49202992e5bbd6dee77c8e5389422651b6 100644 (file)
@@ -1462,8 +1462,7 @@ static int run_protection(int min __attribute__((unused)),
                          int max __attribute__((unused)))
 {
        pid_t pid;
-       int llen = 0, ret;
-       siginfo_t siginfo = {};
+       int llen = 0, status;
        struct rlimit rlimit = { 0, 0 };
 
        llen += printf("0 -fstackprotector ");
@@ -1501,11 +1500,10 @@ static int run_protection(int min __attribute__((unused)),
                return 1;
 
        default:
-               ret = waitid(P_PID, pid, &siginfo, WEXITED);
+               pid = waitpid(pid, &status, 0);
 
-               if (ret != 0 || siginfo.si_signo != SIGCHLD ||
-                   siginfo.si_code != CLD_KILLED || siginfo.si_status != SIGABRT) {
-                       llen += printf("waitid()");
+               if (pid == -1 || !WIFSIGNALED(status) || WTERMSIG(status) != SIGABRT) {
+                       llen += printf("waitpid()");
                        result(llen, FAIL);
                        return 1;
                }