delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/03/16/23:46:53

From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Fri, 16 Mar 2001 23:46:10 -0500
MIME-Version: 1.0
Subject: Re: zero fill the eof gap 2
Message-ID: <3AB2A5C2.26334.21D45F@localhost>
In-reply-to: <200103170057.TAA09098@envy.delorie.com>
References: <3AB26D06 DOT 10811 DOT 1650EF AT localhost> (snowball3 AT bigfoot DOT com)
X-mailer: Pegasus Mail for Win32 (v3.12c)
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 
> > Index: src/libc/compat/unistd/llseek.c
> Why the blank line?

My bad.

> > Index: src/libc/dos/io/_write.c
> > +   
> > +   /* Fill the transfer buffer with zeros.  */
[snip]
> > !   return write_int(fd, NULL, fill_count);
> > ! }
> 
> What if the gap is bigger than the transfer buffer size?

In that case, _write_fill_seek_gap() will stuff the entire transfer buffer 
with zeros. Then write_int() will write out the entire transfer buffer 
'fill_size / tbsize' amount of times and then write out the remainder to 
reach 'fill_size'. The NULL in the write_int call above tells write_int to 
write out the transfer buffer as-is. Anything else tells write_int to stuff 
the transfer buffer with the data it points to and write it out.

> Why can't write() use this also?

Good point. I see no reason why write() can't join the party.

Mark

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019