Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.unix.programmer Subject: Re: How do I keep a pipe from buffering I/O? Keywords: pipe() exec() Message-ID: <15347@smoke.brl.mil> Date: 27 Feb 91 21:30:49 GMT References: <1585@gufalet.let.rug.nl> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 15 In article <1585@gufalet.let.rug.nl> bert@let.rug.nl (Bert Bos) writes: >Problem is, the pipes appear to buffer such large amounts of text, >that one process only gets input after the other has already finished. >How do I force the pipes to pass on text one line at a time? >I'm using calls such as pipe(), dup2(), select(), read(), etc, but I >couldn't find anything in the manuals. Since (unless your pipe implementation is horribly broken) each write() produces an independent chunk in the pipeline, I would guess that what you are actually having trouble with is buffering in the applications, not in the kernel. If stdio is being used, be sure to fflush() the output to ensure that it is write()n to the pipe, and use setbuf() to disable input buffering on the reader. Obviously, if either or both of the communicating processes are provided by somebody else, you may not be able to change how they operate.