RFC - bootscript error reporting

Bill's LFS Login lfsbill at nospam.dot
Fri Jan 30 00:13:35 PST 2004


On Thu, 29 Jan 2004, Bryan Kadzban wrote:

> 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.

Ah! That sparks another little piece of memory. The test involved bash
scripts. Under normal circumstances, the writer would *not* open
non-blocking, so that would 'splain it patiently waiting for the reader
to start up.

I beginning to think this means I've only got half-heimers disease
instead of the full-blown version.  ;)

>
> 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.

I'd bet this is not much different from a 2.4 kernel. That's the one I
tested on. In fact it was for something to do with (B)LFS. I'll search
the archives tomorrow and refresh my memory.

>
> 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.

That seems silly (not buffering). And I seem to remember otherwise. But
don't waste more time on a guessing game by me. I'll do my homework
tomorrow.

I 'preciate you taking an interest and passing on the info.

Thanks!

-- 
NOTE: I'm on a new ISP, if I'm in your address book ...
Bill Maltby
lfsbillATearthlinkDOTnet
Fix line above & use it to mail me direct.



More information about the lfs-dev mailing list