-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Bruno Haible on 7/27/2007 4:11 PM: > Thanks for this idea. Eric, here is a proposed patch for gnulib, that > additionally: > > - uses the #ifdef for BSD systems, > > - not only sets __SNPT but also resets __SOPT. __SOPT tells fseek that > it can use block-alignment as for regular files, __SNPT tells fseek > that it must not do so. Since it is undocumented which of the two > flags is tested first by fseek(), it is safer to reset __SOPT. > > - restores the previous flags after calling fseeko. Setting __SNPT > means to disable block-aligned reading for *all* future fseek calls, > but we need it only for the next one.
I've finally had time to look at this. Your patch is on par with what was done in the newlib library last year (the newlib library currently does not require the fflush/fseek replacement), so I think it is worth applying, after addressing any nits. It would be nice if NetBSD could fold these sorts of patches in upstream (ie. make fflush work on input streams, and make fflush and fseek cooperate so that fseek can continue to optimize in all cases except where an fflush has just happened), but until then, the ./configure script will still pick up that gnulib's rpl_fflush still requires the use of rpl_fseeko for correct semantics. > 2007-07-27 Bruno Haible <[EMAIL PROTECTED]> > > * lib/fflush.c (rpl_fflush): On BSD systems, use the __SNPT flag. > Suggested by Joerg Sonnenberger <[EMAIL PROTECTED]>. ... > > + int saved_flags = stream->_flags & (__SOPT | __SNPT); > + stream->_flags &= ~__SOPT; > + stream->_flags |= __SNPT; Is it more efficient to write it like this? stream->_flags = (stream->_flags & ~__SOPT) | __SNPT; - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGrymi84KuGfSFAYARAvqtAJ9iQV8x+hqjxH9U0I5fgtgP3JS2+gCfToqD uyCy4vW0WQurv4gBswA1a88= =8Xjk -----END PGP SIGNATURE----- _______________________________________________ Bug-m4 mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-m4
