1 #define _POSIX_SOURCE 1
16 int subtest
= 0, errct
= 0;
17 int child_is_dead
= 0;
19 void dead_child(int n
);
28 printf("Subtest %d, error %d\n", subtest
, n
);
30 if (errct
++ > MAX_ERROR
) {
31 printf("Too many errors; test aborted\n");
42 printf("%d errors\n", errct
);
60 foo
= a
* b
; /* 2.42 */
61 bar
= c
* d
; /* 14.52 */
66 foo
*= d
; /* 25.168 */
67 foo
/= e
; /* 4.5760 */
69 bar
*= b
; /* 29.524 */
70 bar
/= e
; /* 5.3680 */
84 if (fabs(foo
- (a
* b
)) > 0.0001) err(1);
85 if (fabs(bar
- (c
* d
)) > 0.0001) err(2);
88 void dead_child(int n
)
94 if (wait(&status
) == -1) err(1);
96 if (!WIFEXITED(status
)) {
100 errct
+= WEXITSTATUS(status
);
118 write(pipefdp
[1], buf
, 1);
120 /* Wait for parent to wake me up */
121 read(pipefdc
[0], buf
, 1);
135 sa
.sa_handler
= dead_child
;
137 if (sigaction(SIGCHLD
, &sa
, NULL
) == -1) err(1);
144 /* Wait for child to wake me up */
145 read(pipefdp
[0], buf
, 1);
150 write(pipefdc
[1], buf
, 1);
154 while(child_is_dead
== 0) { fflush(stdout
); } /* Busy wait */
165 printf("Test 52 (GCC) ");
167 printf("Test 52 (ACK) ");
171 if (pipe(pipefdc
) == -1) err(1);
172 if (pipe(pipefdp
) == -1) err(2);
185 return(0); /* Never reached */