]>
Commit | Line | Data |
---|---|---|
5ba3f43e A |
1 | #include <signal.h> |
2 | #include <stdio.h> | |
3 | #include <stdlib.h> | |
4 | #include <unistd.h> | |
5 | #include <errno.h> | |
6 | ||
7 | #include <darwintest.h> | |
8 | ||
cb323159 A |
9 | T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true)); |
10 | ||
5ba3f43e A |
11 | T_DECL(sigcontreturn, "checks that a call to waitid() for a child that is stopped and then continued returns correctly") |
12 | { | |
0a7de745 A |
13 | pid_t pid; |
14 | siginfo_t siginfo; | |
15 | pid = fork(); | |
16 | T_QUIET; T_ASSERT_NE_INT(pid, -1, "fork() failed!"); | |
5ba3f43e | 17 | |
0a7de745 A |
18 | if (pid == 0) { |
19 | while (1) { | |
20 | } | |
21 | } | |
5ba3f43e | 22 | |
0a7de745 A |
23 | kill(pid, SIGSTOP); |
24 | kill(pid, SIGCONT); | |
25 | sleep(1); | |
5ba3f43e | 26 | |
0a7de745 | 27 | T_QUIET; T_ASSERT_POSIX_SUCCESS(waitid(P_PID, pid, &siginfo, WCONTINUED), "Calling waitid() failed for pid %d", pid); |
5ba3f43e | 28 | |
0a7de745 A |
29 | T_ASSERT_EQ_INT(siginfo.si_status, SIGCONT, "A call to waitid() for stopped and continued child returns 0x%x, expected SIGCONT (0x%x)", siginfo.si_status, SIGCONT ); |
30 | kill(pid, SIGKILL); | |
5ba3f43e | 31 | } |