Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / Shell / Commands / Inputs / sigchld.c
blobba8c5ef45365b0195d5e4827497749a6f7dc3b8a
1 #include <assert.h>
2 #include <signal.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <sys/wait.h>
7 void handler(int signo) {
8 printf("SIGCHLD\n");
11 int main() {
12 void *ret = signal(SIGINT, handler);
13 assert (ret != SIG_ERR);
15 pid_t child_pid = fork();
16 assert (child_pid != -1);
18 if (child_pid == 0) {
19 sleep(1);
20 _exit(14);
23 printf("signo = %d\n", SIGCHLD);
24 printf("code = %d\n", CLD_EXITED);
25 printf("child_pid = %d\n", child_pid);
26 printf("uid = %d\n", getuid());
27 pid_t waited = wait(NULL);
28 assert(waited == child_pid);
30 return 0;