Re: Is sendfile all that sexy?

Olivier Galibert (galibert@pobox.com)
Wed, 17 Jan 2001 21:34:59 -0500


On Wed, Jan 17, 2001 at 11:32:35AM -0800, Linus Torvalds wrote:
> However, for socket->socket, we would not have such an advantage. A
> socket->socket sendfile() would not avoid any copies the way the
> networking is done today. That _may_ change, of course. But it might
> not. And I'd rather tell people using sendfile() that you get EINVAL if
> it isn't able to optimize the transfer..

On the other hand you could consider sendfile to be a concept rather
than an optimization. That is, "move n bytes from this fd to that
one". That would be very nice for this like tar (file <-> file or
tty), cp (file <-> file), application-level routing (socket <->
socket). Hey, even cat(1) would be simplified.

Whether the kernel can optimize it in zero-copy mode is another
problem that will change with time anyway. But the "I want to move x
amount of data from here to there, and I don't need to see the actual
contents" is something that happens quite often, and to be able to do
it with one syscall that does not muck with page tables (aka no mmap
nor malloc) would be both more readable and scale better on smp.

OG.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/