Date: Thu, 23 Jan 2003 08:31:19 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Richard Dawe cc: djgpp-workers AT delorie DOT com Subject: Re: readv, writev [PATCH] In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk On Wed, 22 Jan 2003, Richard Dawe wrote: > The calls allocate a buffer big enough to store all the data > for the I/O vector, so that a single read or write call can be used. > This seemed like the simplest and most robust way of doing it, since > there are no readv or writev system calls. This design worries me a bit. The buffer you allocate can be quite large, in which case we are talking some major heap exercising. The function could even unjustly fail (for lack of enough memory) in some borderline cases, like if the file is much smaller than what you tell the function about the buffers' length. What exactly are the problems in doing this straightforwardly, i.e. read into the buffers directly one by one? What am I missing? > + /* Read in the data. */ > + ret = read(fd, buf, maxbytes); Can't you use _read instead? Is readv supposed to handle text files and do CRLF->NL conversions? The same holds for _write in writev. > + @subheading Syntax > + > + @example > + #include > + > + ssize_t readv(int fd, const struct iovec *iov, int iovcnt); > + @end example [...] > + @code{struct iovec} is defined as follows: Since we are about to add index entries to the manual, how about having @findex at the beginning of the node and @tindex for `struct iovec'? > + Otherwise, a value of -1 is returned and @var{errno} is set appropriately. `errno' is the actual name of a variable, it does not stand for something else. So it should be in @code, not in @var. And please don't forget an entry in wc204.txi. Last but not least, thanks for working on this.