[Linux-ha-dev] FIFOs, buffering, bugs, etc.
Alan Robertson
alanr@unix.sh
Tue, 06 Mar 2001 20:38:07 -0700
bmartin@penguincomputing.com wrote:
>
> On Tue, Mar 06, 2001 at 07:24:03PM -0800, bmartin@penguincomputing.com wrote:
> > On Tue, Mar 06, 2001 at 08:06:53PM -0700, Alan Robertson wrote:
> > > Hi,
> > >
> > > I renamed one of the FIFOs, and put lots more comments on what they are and
> > > how they work in the code. I believe that I put the appropriate buffering
> > > patch into the code according to the current theory. It now reads like
> > > this:
> > >
> > > #if 0
> > > /* Probably a bad idea ;-) */
> > > setvbuf(pi->ReplyFIFO, ReplyFdBuf, _IOLBF, sizeof(ReplyFdBuf));
> > > #else
> > > setvbuf(pi->ReplyFIFO, NULL, _IONBF, 0);
> > > #endif
> > >
> > > I left it as a #if just to make it clearer and highlight the change for
> > > now. If it works, then we'll remove the #if 0 construction...
> > >
> > > This is all in CVS now (as is a nice fix for the Baytech RPC3a from Juri
> > > Haberland).
> > >
> > Awesome. I was just in the process of trying to figure what was going on :)
> >
> > If I understand this setvbuf stuff correctly, then previously clients should
> > have been line buffered by default on the input, which is most certainly not
> > the case in my current straces. I'll do an update and see what happens.
> >
> Okey Dokey.
>
> First off, the fix is working. My straces are now much bigger as there is
> one read for every character.
You mean the BUG IS FINALLY FIXED??
HURRAY!!
> My only remaining confusion about the topic is about the line buffering.
> The setvbuf manpage doesn't really explain the difference between line
> and full buffering.
On output, I understand it completely. It means that every time you send a
'\n' it does a flush. On input, I think I'm confused too.. I put it in
probably out of wishful thinking, and knowing I didn't want full buffering,
and not thinking too clearly.
>
> I assumed it meant that it would call read() up until a new line. In
> retrospect that doesn't make as much sense. How would you call read like
> that? You would have to call read a bunch of times with size = 1, which
> what not what was happening.
>
> Anyhow, thanks for all the help, I don't think I could have squashed this
> one on my own.
It was my bug. You did all the hard work. Sorry for the bad naming of the
FIFOs, and lack of documentation.
Thanks again, A WHOLE LOT!
Because of your valiant efforts, these fixes will be in the next stable
release!!
-- Alan Robertson
alanr@unix.sh