[rfa] Add the bfd_iovec

Andrew Cagney cagney@gnu.org
Mon Apr 12 23:21:00 GMT 2004


> Andrew Cagney <cagney@gnu.org> writes:
> 
> 
>>>> > * I'm not crazy about the berror entry point.  Right now it is used in
>>>> >   exactly one place, to indicate whether a short read is an error or
>>>> >   simply a truncated file.  Since bfd_iovec is only going to be called
>>>> >   by BFD routines, I think it would be quite reasonable to make the
>>>> >   bread entry point responsible for calling bfd_set_error.  Then the
>>>> >   caller does not need to go back in to find out what a short read
>>>> >   means.  Note also that berror is the only function which doesn't
>>>> >   have an obvious mapping to a Unix system call.
>>
>>> 
>>> There are three cases here:
>>> 
>>> - error
>>> - eof
>>> - partial read (as in the next read should yield more data)
>>> 
>>> I guess BFD isn't set up for partial transfers and retrys so the third
>>> case doesn't apply?
> 
> 
> Yes.  Or, to put it another way, the bread routine should be
> responsible for handling partial reads, if they are possible for the
> underlying I/O structure.

Which leads to the next question, what should that return value be? 
read(2) or fread(3) or ??? semantics?  At present it is system dependant 
(see the #ifdef code in cache_bread in my patch).

Andrew




More information about the Binutils mailing list