basic C question

Tim Writer tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Wed Jul 14 00:42:26 UTC 2004


Henry Spencer <henry-lqW1N6Cllo0sV2N9l4h3zg at public.gmane.org> writes:

> On Tue, 13 Jul 2004, Bob Findlay wrote:
> > Unfortunately,  when you open a fifo O_RDONLY and the other end isn't yet 
> > opened for writing the open() call blocks.      This little tidbit makes a 
> > mess of any select() logic one wants to initialize around that file 
> > descriptor.

Although it does make some sense.  Without this behaviour, how would you
distinguish between a read() without a writer and a read() after the writer
has closed the fifo?

> I believe you can get around that with O_RDONLY|O_NONBLOCK, although I can't
> say I've tried it lately...  See the fifo(4) manpage.

Yes, and you should be able to subsequently select().  I can't immediately
put my finger on documentation but I would expect a fifo opened with
O_RDONLY|O_NONBLOCK to become readable (according to select()) once it's been
opened (and written to) by a writer.

-- 
tim writer <tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org>                                  starnix inc.
905.771.0017 ext. 225                           thornhill, ontario, canada
http://www.starnix.com              professional linux services & products
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list