xref: /minix3/minix/tests/test12.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /* test 12 */
2*433d6423SLionel Sambuc 
3*433d6423SLionel Sambuc /* Copyright (C) 1987 by Martin Leisner. All rights reserved. */
4*433d6423SLionel Sambuc /* Used by permission. */
5*433d6423SLionel Sambuc 
6*433d6423SLionel Sambuc #include <sys/types.h>
7*433d6423SLionel Sambuc #include <sys/wait.h>
8*433d6423SLionel Sambuc #include <stdlib.h>
9*433d6423SLionel Sambuc #include <unistd.h>
10*433d6423SLionel Sambuc #include <stdio.h>
11*433d6423SLionel Sambuc 
12*433d6423SLionel Sambuc #define NUM_TIMES	1000
13*433d6423SLionel Sambuc int max_error = 2;
14*433d6423SLionel Sambuc #include "common.h"
15*433d6423SLionel Sambuc 
16*433d6423SLionel Sambuc 
17*433d6423SLionel Sambuc 
18*433d6423SLionel Sambuc int main(void);
19*433d6423SLionel Sambuc 
main()20*433d6423SLionel Sambuc int main()
21*433d6423SLionel Sambuc {
22*433d6423SLionel Sambuc   register int i;
23*433d6423SLionel Sambuc   int k;
24*433d6423SLionel Sambuc 
25*433d6423SLionel Sambuc   start(12);
26*433d6423SLionel Sambuc 
27*433d6423SLionel Sambuc   for (i = 0; i < NUM_TIMES; i++) switch (fork()) {
28*433d6423SLionel Sambuc 	    case 0:	exit(1);	  		break;
29*433d6423SLionel Sambuc 	    case -1:
30*433d6423SLionel Sambuc 		printf("fork broke\n");
31*433d6423SLionel Sambuc 		exit(1);
32*433d6423SLionel Sambuc 	    default:	wait(&k);	  		break;
33*433d6423SLionel Sambuc 	}
34*433d6423SLionel Sambuc 
35*433d6423SLionel Sambuc   quit();
36*433d6423SLionel Sambuc   return(-1);			/* impossible */
37*433d6423SLionel Sambuc }
38*433d6423SLionel Sambuc 
39