1 /* vi: set sw=4 ts=4: */
4 * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
19 #ifdef __ARCH_USE_MMU__
21 static void child_handler(int sig)
23 fprintf(stderr, "I got a SIGCHLD\n");
28 pid_t pid1, pid2, pid3;
29 int status, result, wpid;
31 signal(SIGCHLD, child_handler);
33 if ((pid1 = fork()) == 0) {
34 fprintf(stderr, "The child process sleeps 2 seconds...\n");
36 fprintf(stderr, "Child exiting.\n");
39 if ((pid2 = fork()) == 0) {
40 fprintf(stderr, "The child process sleeps 3 seconds...\n");
42 fprintf(stderr, "Child exiting.\n");
45 if ((pid3 = fork()) == 0) {
46 fprintf(stderr, "The child process sleeps 4 seconds...\n");
48 fprintf(stderr, "Child exiting.\n");
52 fprintf(stderr, "Parent: waiting for the child to die.\n");
55 wpid = waitpid(pid1, &result, WNOHANG);
59 wpid = waitpid(pid2, &result, WNOHANG);
63 wpid = waitpid(pid3, &result, WNOHANG);
67 if (status == (GOT1 | GOT2 | GOT3))
71 fprintf(stderr, "Child process exited.\nGoodbye.\n");
79 printf("Skipping test on non-mmu host!\n");