This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libgfortran] READ from the terminal is broken - 2nd patch - urgent review, please.


On Wed, Oct 12, 2005 at 11:57:56PM +0200, Thomas Koenig wrote:
> On Wed, Oct 12, 2005 at 07:17:28PM +0300, Janne Blomqvist wrote:
> 
> > No, not really. Your patch still touches fd_seek(). Attached patch is
> > my proposal for a fix.
>  
> Is this really necessary?  This breaks one of the aims of your
> original patch, which was to provide >2GB- records on 64-bit
> systems.

Not really, big transfers are currently only relevant for unformatted,
since the formatted transfer routines all transfer one element at a
time. And unformatted read uses fd_read() which calls do_read() if the
transfer size is bigger than BUFFER_SIZE (8 KB at the moment IIRC).

> If possible, I would prefer the following patch.  This only uses
> a single read() for special files (like terminals) and do_read()
> otherwise.

Indeed, this is nice. Perhaps not relevant for big transfers at the
moment as I explained above, but in a correctness sense since
do_read() restarts read() if the program recieves a signal.

> This is regression-tested on i686-pc-linux-gnu.  I would appreciate
> if somebody could test it on a BSD-derived system to see that this
> does fix the original problem.

Considering that I'm on the same platform, I won't ok this, although I
think it looks correct (with a small change, see below).

> !   if (s->special_file)
> !     {
> !       int n;

To be pedantic, this really should be of type ssize_t and not int
(sorry I missed it in my fix too).

> !       n = s->len - s->active;

The above statement is unnecessary, since n is immediately overwritten
with the return value from read() below.

> !       n = read (s->fd, s->buffer + s->active, s->len - s->active);


-- 
Janne Blomqvist


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