Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d06188f45c
Fetching contributors…

Cannot retrieve contributors at this time

file 25 lines (22 sloc) 0.368 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include "apue.h"
#include <fcntl.h>

int
main(void)
{
int i, n;
int fd[2];

if (pipe(fd) < 0)
err_sys("pipe error");
set_fl(fd[1], O_NONBLOCK);

/*
* Write 1 byte at a time until pipe is full.
*/
for (n = 0; ; n++) {
if ((i = write(fd[1], "a", 1)) != 1) {
printf("write ret %d, ", i);
break;
}
}
printf("pipe capacity = %d\n", n);
exit(0);
}
Something went wrong with that request. Please try again.