vfork() problems

Nicholas Clark nick at ccl4.org
Thu Oct 25 16:38:18 BST 2001


On Thu, Oct 25, 2001 at 05:05:27PM +0200, Stefan Bellon wrote:
> Nicholas Clark <nick at ccl4.org> wrote:
> > Use two pipes, one for each direction?
> 
> Yes, of course, this would work.
> 
> But then I misunderstood the description of pipe() in the Single UNIX
> Specification Version 2:
> 
>  "Data can be written to the file descriptor fildes[1] and read from
>  file descriptor fildes[0]. A read on the file descriptor fildes[0]
>  will access data written to file descriptor fildes[1] on a
>  first-in-first-out basis. [...]"

I think this description is for a bi-directional pipe.

> >From this I concluded that when reading from fildes[1] once, the same
> content can't be read again when reading another time from fildes[1]
> regardless of whether this happens in the same process or in the parent
> process.
> 
> Am I wrong in concluding this from the above quoted description?

Your conclusion is correct (I think).
However, unixlib is only implementing single direction pipes,
(and probably buggily. This seems to ring a bell. I guess that there should
be an error on writing to the read end)

Nicholas Clark



More information about the gcc mailing list