From: Enrik Berkhan <Enrik.Berkhan@ge.com>
To: "Марк Коренберг" <socketpair@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: splice between non-pipe (tcp socket) fds
Date: Wed, 23 Sep 2009 09:33:24 +0200 [thread overview]
Message-ID: <4AB9CF44.1030301@ge.com> (raw)
In-Reply-To: <b8f627e0909212323mbeb0fd1yba25aafb58ef686b@mail.gmail.com>
Марк Коренберг wrote:
> I want splice() to work with two tcp sockets().I think to implement
> this. Two questions:
This works already by introducing a pipe between the two:
while (0 < (len = splice(sock1, 0, pipe, 0, max_len, some_flags)))
splice(pipe, 0, sock2, 0, len, some_flags);
Just like with read(2) and write(2), but without copy to/from userspace.
> 1. Is any work in this direction?
> 2. Why this functionality does not implemented now? any difficulties?
>
> I think API should consist of 2 main functions:
> 1. detach available buffers from fd1 (and save info in some struct)
> 2. attach buffers to fd2 (from this struct)
> this functions should be called under some lock to guarantee
> atomicity. if something happen, return buffers back to original file.
What about full duplex?
> At now, I think that the most quick way to acheive my results, is to
> create intermediate temporary pipe inside kernel and splice from
> non-pipe fd to pipe, and than from pipe to second non-pipe fd.
Have a look at the "sendfile emulation" in fs/splice.c. Maybe you can
generalize that in some way or the other.
Enrik
prev parent reply other threads:[~2009-09-23 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-22 6:23 splice between non-pipe (tcp socket) fds Марк Коренберг
2009-09-22 6:24 ` Марк Коренберг
2009-09-23 7:33 ` Enrik Berkhan [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=4AB9CF44.1030301@ge.com \
--to=enrik.berkhan@ge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=socketpair@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox