1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
6 * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
7 * Written by Erik Andersen <andersen@uclibc.org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Library General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
19 * You should have received a copy of the GNU Library General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
35 #ifdef __ARCH_USE_MMU__
37 void child_handler(int sig)
39 fprintf(stderr, "I got a SIGCHLD\n");
44 pid_t pid1, pid2, pid3;
45 int status, result, wpid;
47 signal(SIGCHLD, child_handler);
49 if ((pid1 = fork()) == 0) {
50 fprintf(stderr, "The child process sleeps 2 seconds...\n");
52 fprintf(stderr, "Child exiting.\n");
55 if ((pid2 = fork()) == 0) {
56 fprintf(stderr, "The child process sleeps 3 seconds...\n");
58 fprintf(stderr, "Child exiting.\n");
61 if ((pid3 = fork()) == 0) {
62 fprintf(stderr, "The child process sleeps 4 seconds...\n");
64 fprintf(stderr, "Child exiting.\n");
68 fprintf(stderr, "Parent: waiting for the child to die.\n");
71 wpid = waitpid(pid1, &result, WNOHANG);
75 wpid = waitpid(pid2, &result, WNOHANG);
79 wpid = waitpid(pid3, &result, WNOHANG);
83 if (status == (GOT1 | GOT2 | GOT3))
87 fprintf(stderr, "Child process exited.\nGoodbye.\n");
95 printf("Skipping test on non-mmu host!\n");
103 c-file-style: "linux"