cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: FILE * => fd ?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 10 Aug 2001 10:01:31 +0200 (MET DST)

On Fri, 10 Aug 2001, SM wrote:

> Using mmap() would be more efficient. mmap is not supported under Win32.
> The equivalent is MapViewOfFile(). Under Win32, cURL would have to use
> HANDLE instead of fd.

In general, I don't mind adding support for different ways to access files.
Although I doubt there's much point in optimizing for speed to this degree in
disk I/O when we're writing a network utility.

mmap() is certainly not as portable as the fopen() of today or even the
suggested file descriptor approach. libcurl runs on numerous platforms, and
several of those won't have a mmap() equivalent. It would introduce more
platform specific client-side stuff that would make libcurl-using
applications less portable than they are today, and this without gaining very
much.

Another reason I chose to read/write streams in libcurl, instead of plain
files, is that libcurl can both upload from stdin and download to stdout.
And this is made without any special code or conditions.

-- 
     Daniel Stenberg -- curl dude -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
http://curl.haxx.se/libcurl/
Received on 2001-08-10