Stdio and DragonFly changes

Oliver Fromme check+inl4si00rsbhddo4 at fromme.com
Thu Sep 29 09:15:32 PDT 2005


Jonas Trollvik <jontro at xxxxxxxxx> wrote:
 > Dave Hayes <dave at xxxxxxxxxxx> wrote:
 > > I'm looking at a codefragment like this:
 > > 
 > >    if (stdin->_bf._size > 0)
 > >        return 1;
 > > 
 > > DragonFly's FILE struct has no _bf record. I think this code is
 > > trying to see if anything is in the stdin buffer. What would the
 > > proper way be on DragonFly? I'm thinking:
 > > 
 > >    if (stdin->_lbfsize > 0)
 > >        return 1;
 > > 
 > > as a wild uneducated guess.
 > 
 > Cant this be done with select or an ioctl?

No, select() and ioctl() work on file descriptors, not on
FILE*, so they don't know anything about stdio and its
buffering.  Dave's question was about the stdio buffer.

 > As far as I understand the application shouldnt depend on the fields
 > in FILE since these might change.

That's right.

In my opinion, an application which wants to know the size
of stdio's buffer is badly designed.

Best regards
   Oliver

-- 





More information about the Users mailing list