This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Clear new space in fseek extended patches
- To: nickc at redhat dot com
- Subject: Re: Clear new space in fseek extended patches
- From: DJ Delorie <dj at delorie dot com>
- Date: Wed, 30 Aug 2000 20:17:04 -0400
- CC: binutils at sources dot redhat dot com, fnf at ninemoons dot com
- References: <200008310004.RAA05566@elmo.cygnus.com>
> I am planning to apply the patch below unless there are any
> objections.
I object to the logic. The only time you should write out the zeros
is if you *write* after an fseek. Merely fseeking past EOF shouldn't
modify the file. You will also find a severe performance loss if you
do fseek/ftell/fseek on every fseek, especially since we seek a lot
during *reads*.
Cygwin has a similar fix, but it uses this logic:
* When seeking, set a flag on that file that says we seeked.
* When writing, if the flag is set, check for seek past EOF and
fill. Then reset the flag.
Also, has anyone tested the relevent operating systems to see if the
os's seek() past EOF remembers where it *should* be, rather than
truncating at EOF? If they all preserve the file position beyond EOF,
the logic is a lot simpler.
Also, NT doesn't have this problem while Win9X does. However,
detecting the difference isn't worth the performance difference, and
cygwin is *not* one of those platforms (it fixes it internally) BFD
will be "fixing".
> * configure.host (*-*-beos): New entry, define
> CLEAR_FSEEK_SPACE.
> (*-*-windows): Add CLEAR_FSEEK_SPACE.
DJGPP also. i[3-7]86-pc-msdosdjgpp.