From: "David Härdeman" <david@hardeman.nu>
To: linux-kernel@vger.kernel.org
Subject: Re: splice question
Date: Sun, 12 Aug 2007 22:56:14 +0200 [thread overview]
Message-ID: <20070812205614.GA29485@hardeman.nu> (raw)
In-Reply-To: <alpine.LFD.0.999.0708121238390.30176@woody.linux-foundation.org>
On Sun, Aug 12, 2007 at 12:41:54PM -0700, Linus Torvalds wrote:
>On Sun, 12 Aug 2007, David H?rdeman wrote:
>> Otherwise I guess I'd have to add a second pipe, then (in a loop)
>> tee() from the first to the second pipe and then splice from the second pipe
>> to a socket. Doesn't sound very elegant and would need quite a lot of extra
>> syscalls.
>
>You really should think of this as a memcpy(), and you'll be in the right
>mindframe. The system calls themselves are cheap.
Ok, I've implemented it using two pipes, and it works. But it does seem
a bit wasteful...in case one client is not keeping up, the data will
have to be tee():ed first from pipe1 to pipe2, only to then find out
that the splice() from pipe2 to socket only does a partial transfer
after which the data in pipe2 has to be thrown away and then the loop
starts over with the next client.
A tee() from pipe1 to the socket could (I imagine) realize immediately
that the socket does not have enough buffer space and return EWOULDBLOCK
and avoid at least one copy?
--
David Härdeman
prev parent reply other threads:[~2007-08-12 20:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-12 16:28 splice question David Härdeman
2007-08-12 19:41 ` Linus Torvalds
2007-08-12 20:56 ` David Härdeman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070812205614.GA29485@hardeman.nu \
--to=david@hardeman.nu \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.