Re: sendfile() (Was Re: Thread Implementations)

Luca Lizzeri (ll@niche.it)
Fri, 26 Jun 1998 21:05:50 +0200


On Wed, Jun 24, 1998 at 08:55:15AM -0700, Larry McVoy wrote:
> : Consider the asynchronous kernel call
> : int connectfd(int fd1, int fd2, int options)
>
> Take a look at ftp://ftp.bitmover.com/pub/splice.ps - I started writing up
> your idea about a year ago at SGI. it never went anywhere, but I think you
> have the right idea.
>

The idea I like most is using sendmsg.

Like for BSD file descriptor passing we feed it a list of fds. It's enough to
concoct the appropriate cmsg_{level,type} and we have an interface for sending
whole files down the pipe. A convention could be established so that if
elements of the iovec are left null, the contents of the fds from the
ancillary data are intercalated between the contents of the scatter/gather
array. Thus in a webserver we could have:

First element of the iovec is the http header, second element is left null so
out go the contents of the file referred to by the first fd. The third element
of the iovec is left null also and the second fd refers to a unix domain
socket which is the output of some program.

This could go to even more insane lengths with http 1.1 ...

With a scheme like this, sendfile could be a library wrapper.

Only things remaining are knowing whether I have spouted enough nonsense,
deciding whether the scheme is actually feasible/desirable and, last but not
least, implementing the mechanism :)

Bye,
Luca

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu