On Mon, Sep 13, 2004 at 02:09:37PM -0400, Bob Byrnes wrote: >>Or what if a read from a pipe always asks for the number of available >>bytes using NtQueryInformationFile and then only actually reads this >>number of bytes and returns that to the caller? >> >-- End of excerpt from Corinna Vinschen > >That's similar to nonblocking reads, and it might work, and I guess for >blocking reads we would never attempt to read more than the size of the >pipe minus PIPE_BUF. If we don't want to return partial data, then we >could redo reads until all of the data is delivered to the calling >program, but I think partial reads should be OK.
The only problem with that scenario is that there is a race there where you may end up reading fewer bytes than are actually on the pipe but I guess that all pipe I/O is inherently racy to some extent. cgf
