RFC - bootscript error reporting

Bryan Kadzban bryan at kadzban.is-a-geek.net
Thu Jan 29 19:34:33 PST 2004


Bill's LFS Login wrote:
> I only post conversationally at this time, as the wise thing is to get
> one of the guys who dabble in the kernel all the time to provide an
> answer. Not a lot of chance of that I think.
> 

Well, I don't "dabble in the kernel all the time", but I can read source
fairly well.  Or at least, I'd like to think so.  ;-)

In any case, in fs/fifo.c there are these comments inside the VFS open()
function for fifos:

<quote #1>
     /*
      *  O_RDONLY
      *  POSIX.1 says that O_NONBLOCK means return with the FIFO
      *  opened, even when there is no process writing the FIFO.
      */
</quote #1>

<quote #2>
     /*
      *  O_WRONLY
      *  POSIX.1 says that O_NONBLOCK means return -1 with
      *  errno=ENXIO when there is no process reading the FIFO.
      */
</quote #2>

<quote #3>
     /*
      *  O_RDWR
      *  POSIX.1 leaves this case "undefined" when O_NONBLOCK is set.
      *  This implementation will NEVER block on a O_RDWR open, since
      *  the process can at least talk to itself.
      */
</quote #3>

Now, this only applies to O_NONBLOCK.  If O_NONBLOCK is not specified,
then an O_RDONLY open will wait_for_partner, and so will O_WRONLY.  I
assume that wait_for_partner is what blocks, based on its name.

Opening the fifo with O_RDWR won't block in any case -- or at least,
it'll never call wait_for_partner directly.

This is from kernel 2.6.2-rc1.  Take it with a grain of salt, because I
didn't look at every function that gets called to see if it can block.

But it looks like opening a fifo for writing will either block, or
return -1 and set errno to ENXIO until a reader is available (depending
on whether O_NONBLOCK is specified).  In no case does it *appear* that
it'll do something like buffering writes.



More information about the lfs-dev mailing list