Skip to content

Commit a0bc894

Browse files
committed
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>
1 parent 7f89bc5 commit a0bc894

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/testing/selftests/nolibc/nolibc-test.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,8 @@ static int run_protection(int min __attribute__((unused)),
13231323
int max __attribute__((unused)))
13241324
{
13251325
pid_t pid;
1326-
int llen = 0, status;
1326+
int llen = 0, ret;
1327+
siginfo_t siginfo = {};
13271328
struct rlimit rlimit = { 0, 0 };
13281329

13291330
llen += printf("0 -fstackprotector ");
@@ -1361,10 +1362,11 @@ static int run_protection(int min __attribute__((unused)),
13611362
return 1;
13621363

13631364
default:
1364-
pid = waitpid(pid, &status, 0);
1365+
ret = waitid(P_PID, pid, &siginfo, WEXITED);
13651366

1366-
if (pid == -1 || !WIFSIGNALED(status) || WTERMSIG(status) != SIGABRT) {
1367-
llen += printf("waitpid()");
1367+
if (ret != 0 || siginfo.si_signo != SIGCHLD ||
1368+
siginfo.si_code != CLD_KILLED || siginfo.si_status != SIGABRT) {
1369+
llen += printf("waitid()");
13681370
result(llen, FAIL);
13691371
return 1;
13701372
}

0 commit comments

Comments
 (0)