Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!newspump.sol.net!www.nntp.primenet.com!nntp.primenet.com!nntp.coast.net!news2.acs.oakland.edu!newsfeed.concentric.net!news-master!news From: averba@eden.rutgers.edu (Andrew Verba) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Blocking with pipes. Date: 28 Sep 1996 21:08:24 GMT Organization: Rutgers University Lines: 26 Message-ID: <52k448$sjj@herald.concentric.net> NNTP-Posting-Host: cnc000209.concentric.net Mime-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII X-Newsreader: WinVN 0.99.7 In a program that I am trying to write, I have switch(fork()) { case 0: dup2(fd[1],STDOUT_FILENO); dup2(fd[0],STDIN_FILENO); close(fd[1]); close(fd[0]); execvp(argv[0],argv); perror("BLA"); exit(0); default: write(fd[1],buffer,counter); close(fd[1]); while(read(fd[0],string,50) > 0 ) { do something with string; } close(fd[0]); break; } Why does this read some of the input from the executing file and then hang (block) ?