From: Rob Landley <rob@landley.net>
To: Pavel Machek <pavel@ucw.cz>
Cc: "Jörn Engel" <joern@wohnheim.fh-wedel.de>, linux-kernel@vger.kernel.org
Subject: Re: [ANNOUNCEMENT PATCH COW] proof of concept impementation of cowlinks
Date: Tue, 25 May 2004 16:55:42 -0500 [thread overview]
Message-ID: <200405251655.43185.rob@landley.net> (raw)
In-Reply-To: <20040520134955.GA5215@openzaurus.ucw.cz>
On Thursday 20 May 2004 08:49, Pavel Machek wrote:
> Hi!
> > For years now I've wanted to use a sendfile variant to tell the system to
> > connect two filehandles from userspace. Not just web servers want to
> > marshall data from one filehandle into another, things like netcat want
> > to do it between a pipe and a network connection, and I've wrote a couple
> > of data dispatcher daemons that wanted to do it between two network
> > connections.
> >
> > Unfortunately, sendfile didn't work generically when I tried it (back
> > under 2.4). Would this infrastructure be a step in the right direction
> > to eliminate gratuitous poll loops (where nobody but me EVER seems to get
> > the "shutdown just one half of the connection" thing right. My netcat
> > can handle "echo 'GET /' | netcat www.slashdot.org 80". The standard
> > netcat can't. Yes, I plan to fix the one in busybox eventually...)
>
> Ugh. Yes, some syscalls like that were proposed... but to
> make programming easier, you'd need asynchronous
> sendfile to help you with programming, right?
>
> Pavel
Doesn't asynchronous sendfile has the little problem your process can exit
before the sendfile is complete?
I'm not sure how much of a help it really is, since fork() isn't brain surgery
if you want it to be asynchronous, and the lifetime rules are really explicit
then. (With a ps that does thread grouping, this isn't too bad from a
clutter standpoint, even. And you automatically get a SIGCHLD when the
sendfile is complete, too...)
Of course if the syscall can make the sendfile outlive the process that fired
it off, then by all means it sounds good. I dunno how much extra work that
is for the kernel, though.
I had a "star server" daemon that was allowing machines behind firewalls to
talk to each other by ssh-ing in to a machine that wasn't behind a firewall,
which would then route traffic between them. It boiled down to connecting
together incoming network sockets, which meant that each connection went
through five processes on the star server: incoming ssh, redirector program
that ssh ran (which sent it the data to a loopback network connection), the
dispatcher daemon that handled the loopback connections and figured out who
should connect to who, and then the redirector and the ssh session for the
"outgoing" connection. Both redirectors basically wanted to exit after
connecting their stdin and stdout to a network socket on loopback, but
couldn't because they had to run a poll loop to shovel data back and forth.
Similarly the dispatcher daemon had the mother of all poll loops that
basically implemented bidirectional sendfile by hand between pairs of network
sockets.
Anyway, real world example of something ugly that made me want sendfile to be
more generic. (Netcat's another.) I doubt the star server could have been
cleaned up _too_ much since it was an ugly idea to begin with (on many
levels), but my boss wanted it, and customers wanted it, so...
Rob
--
www.linucon.org: Linux Expo and Science Fiction Convention
October 8-10, 2004 in Austin Texas. (I'm the con chair.)
next prev parent reply other threads:[~2004-05-25 21:57 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-06 13:17 [ANNOUNCEMENT PATCH COW] proof of concept impementation of cowlinks Jörn Engel
2004-05-06 13:18 ` [PATCH COW] generic_sendpage Jörn Engel
2004-05-06 13:19 ` [PATCH COW] sendfile Jörn Engel
2004-05-06 13:19 ` [PATCH COW] copyfile Jörn Engel
2004-05-06 13:20 ` [PATCH COW] lock_flags Jörn Engel
2004-05-06 13:21 ` [PATCH COW] MAD COW Jörn Engel
2004-05-08 13:45 ` [ANNOUNCEMENT PATCH COW] proof of concept impementation of cowlinks Denis Vlasenko
2004-05-08 22:10 ` Pavel Machek
2004-05-09 14:09 ` Denis Vlasenko
2004-05-09 21:53 ` Pavel Machek
2004-05-10 15:44 ` Jörn Engel
2004-05-10 15:51 ` Pavel Machek
2004-05-10 15:56 ` Jörn Engel
2004-05-12 0:26 ` Jamie Lokier
2004-05-13 10:56 ` Jörn Engel
2004-05-12 20:29 ` Rob Landley
2004-05-08 22:48 ` Pavel Machek
2004-05-10 15:53 ` Jörn Engel
2004-05-10 19:26 ` Jan Harkes
2004-05-11 10:02 ` Jörn Engel
2004-05-11 14:08 ` Jan Harkes
2004-05-11 14:18 ` Jan Harkes
2004-05-11 14:33 ` Jörn Engel
2004-05-21 23:23 ` Rob Landley
2004-05-25 22:46 ` Jan Harkes
2004-05-11 15:40 ` Steve French
2004-05-11 15:58 ` Jörn Engel
2004-05-10 5:15 ` Eric W. Biederman
2004-05-10 15:59 ` Jörn Engel
2004-05-12 16:39 ` Rob Landley
2004-05-20 13:49 ` Pavel Machek
2004-05-25 21:55 ` Rob Landley [this message]
2004-05-25 22:08 ` Pavel Machek
2004-05-25 23:16 ` Rob Landley
2004-05-26 0:16 ` Ian Stirling
2004-05-26 9:52 ` Jörn Engel
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=200405251655.43185.rob@landley.net \
--to=rob@landley.net \
--cc=joern@wohnheim.fh-wedel.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
/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