1 /* Check that writing an inordinate amount of data works (somewhat).
3 #output: got: a\nexit: 0\n
4 This test-case will *not* work on host (or for real): the first
5 pipemax+1 bytes will be successfully written. It's just for
6 exercising a rare execution path. */
16 #include <sys/types.h>
27 char *buf = calloc (pipemax * 100, 1);
35 ret = write (pip[1], buf, pipemax * 100);
36 if (ret != -1 || errno != EFBIG)
58 fprintf (stderr, "Bad pipe %d\n", retcode);
65 pipemax = fpathconf (pip[1], _PC_PIPE_BUF);
70 fprintf (stderr, "Bad pipemax %d\n", pipemax);
74 pid = clone (process, (char *) stack + sizeof (stack) - 64,
75 (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
79 fprintf (stderr, "Bad clone %d\n", pid);
83 while ((retcode = read (pip[0], buf, 1)) == 0)
88 fprintf (stderr, "Bad read 1: %d\n", retcode);
92 printf ("got: %c\n", buf[0]);
94 if (close (pip[0]) != 0)
100 retcode = waitpid (pid, &st, __WALL);
102 if (retcode != pid || !WIFEXITED (st))
104 fprintf (stderr, "Bad wait %d:%d %x\n", pid, retcode, st);
109 printf ("exit: %d\n", WEXITSTATUS (st));