cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Info request about the zero copy interface

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 1 Dec 2005 16:48:20 +0100 (CET)

On Thu, 1 Dec 2005, Legolas wrote:

>> "every" ? What other operations than read or write do you think it needs?
>>
> I don't understand your question, however passing libcurl an object with
> assigned read/write methods (and others if needed) will avoid the file
> writing or reading memory copy bottleneck (data would not be cached into
> memory and passed to libcurl, but directly read/written from libcurl itself
> through the read/write method).

No, that is _not_ what a zero copy interface does as it does not avoid the
extra copy. We already have that kind of callbacks, and they are call read and
write callbacks.

To me, it looks like you are too focused on squeezing your own ideas into
libcurl than to actually provide a usable zero copy interface.

> 1) Example of possible libcurl source snippet (WRITE operation, maybe a
> download):

You say we call the write callback. In what way does this write callback
differ from the write callback libcurl already features?

Your write callback seems to take a pointer to a buffer as one of its
arguments. What buffer? Wouldn't libcurl need to store data in that when it
receives data from a peer? How would the write callback get and use the data
without copying it?

> I think this is really the best way to create an actual zero copy interface,
> in case (1, WRITE) the eventual subsequent buffers needed would be handled
> automatically by the RWops object.

How?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-12-01