delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/24/13:58:47

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10301241900.AA20687@clio.rice.edu>
Subject: Re: readv, writev [PATCH]
To: djgpp-workers AT delorie DOT com
Date: Fri, 24 Jan 2003 13:00:57 -0600 (CST)
In-Reply-To: <3E317EB3.9259E0A9@phekda.freeserve.co.uk> from "Richard Dawe" at Jan 24, 2003 05:58:11 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
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

> By returning what the first write() wrote we are hiding the fact that the
> second write() failed. 

No.  The return value from writev() will not be equal to the total bytes
sent in the array elements, so it's clear it didn't complete - but it
did do a partial write.  This is completely consistent with the way
write behaves.

And since we internally break up any write() over the transfer buffer 
size anyway, putting it into a single buffer doesn't fix anything - 
write just does it 16K at a time instead.

So there is no strong reason to copy it to a single buffer; you could
just do a loop.  If you want to minimize interrupts you could copy
it into a buffer == tb size and do the loop that way (essentially what
write does internally).

- Raw text -


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