1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
6 * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
7 * Written by Erik Andersen <andersen@uclibc.org>
9 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
22 #ifdef __ARCH_USE_MMU__
24 void child_handler(int sig)
26 fprintf(stderr, "I got a SIGCHLD\n");
31 pid_t pid1, pid2, pid3;
32 int status, result, wpid;
34 signal(SIGCHLD, child_handler);
36 if ((pid1 = fork()) == 0) {
37 fprintf(stderr, "The child process sleeps 2 seconds...\n");
39 fprintf(stderr, "Child exiting.\n");
42 if ((pid2 = fork()) == 0) {
43 fprintf(stderr, "The child process sleeps 3 seconds...\n");
45 fprintf(stderr, "Child exiting.\n");
48 if ((pid3 = fork()) == 0) {
49 fprintf(stderr, "The child process sleeps 4 seconds...\n");
51 fprintf(stderr, "Child exiting.\n");
55 fprintf(stderr, "Parent: waiting for the child to die.\n");
58 wpid = waitpid(pid1, &result, WNOHANG);
62 wpid = waitpid(pid2, &result, WNOHANG);
66 wpid = waitpid(pid3, &result, WNOHANG);
70 if (status == (GOT1 | GOT2 | GOT3))
74 fprintf(stderr, "Child process exited.\nGoodbye.\n");
82 printf("Skipping test on non-mmu host!\n");