This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Clear new space in fseek extended patches



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]