64-bit VFS_LSEEK_OFF
[minix3.git] / test / test13.c
blob772751ffc1a362342757a0ddcd147def154260ef
1 /* test 13 */
3 /* File: pipes.c - created by Marty Leisner */
4 /* Leisner.Henr 1-Dec-87 8:55:04 */
6 /* Copyright (C) 1987 by Martin Leisner. All rights reserved. */
7 /* Used by permission. */
9 #include <sys/types.h>
10 #include <sys/wait.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include <stdio.h>
15 #define BLOCK_SIZE 1000
16 #define NUM_BLOCKS 1000
18 char buffer[BLOCK_SIZE];
20 int max_error = 2;
21 #include "common.h"
24 int main(void);
25 void quit(void);
27 int main()
29 int stat_loc, pipefd[2];
30 register int i;
32 start(13);
34 pipe(pipefd);
36 switch (fork()) {
37 case 0:
38 /* Child code */
39 for (i = 0; i < NUM_BLOCKS; i++)
40 if (read(pipefd[0], buffer, BLOCK_SIZE) != BLOCK_SIZE) break;
41 exit(0);
43 case -1:
44 perror("fork broke");
45 exit(1);
47 default:
48 /* Parent code */
49 for (i = 0; i < NUM_BLOCKS; i++) write(pipefd[1], buffer, BLOCK_SIZE);
50 wait(&stat_loc);
51 break;
53 quit();
54 return(-1); /* impossible */