9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: roger peppe <rogpeppe@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] ideas for helpful system io functions
Date: Mon,  7 Dec 2009 21:03:49 +0000	[thread overview]
Message-ID: <df49a7370912071303ibd5e6bfw5825bfe7801f16cc@mail.gmail.com> (raw)
In-Reply-To: <20091207191129.GD17192@gradx.cs.jhu.edu>

2009/12/7 Nathaniel W Filardo <nwf@cs.jhu.edu>:
>> fd1 := open("/foo1", ORDWR);
>> fd2 := open("/foo2", ORDWR);
>> fd3 := fdjoin(fd1, fd2);
>>
>> what is going to happen?
>> something has got to initiate the requests to actually
>> shift the data, and it's not clear which direction the
>> data will flow.
>
> "file to file" joins like that are not the typical case and might even be an
> error to attempt.

in plan 9, everything is a file - whether it's generated by opening '#p/data1'
or '/foo1'.

>  Linux's equivalent APIs (yes, plural, sigh) always hook
> an "active" component somewhere...  sendfile() for example is typically
> employed as a crude hook on the TCP stack's "I could accept some bytes from
> a write() from userland now" "event" and turn that into a read() of the
> sendfile()d thing (which must be a pagecacheable thing... wtf.  splice()
> fixes at least some or perhaps all of that).  splice()d file descriptors
> just forward read()s and write()s across the splice.

i see why you might want to send file descriptors around
the place, (for instance, one could theoretically add a control
request to /net/tcp that said "treat this fd as your source of data",
though it wouldn't work across the network),
but i still don't see how "splice" could work in general.

>> this is an optimisation, right? what parts of the current system
>> could be speeded up by the use of this primitive?
>
> A typical *nix use case is sending a prefix and static file to a socket
> (e.g. nonencrypting, nonchunked httpds, ftpds, etc.).

well, that case is easily dealt with with something like devjoin.

> Of note, more generally, splice() and friends are approximating something
> possible and (relatively) easy in the capability kernel world: some process
> has capabilities to two objects and wishes to introduce those objects to
> each other (and further wishes that those objects would stop bothering it.
> :) ).  i.e. "Please resend all outstanding and forward all future requests
> to this other capability."

i see that.
but i think that fdjoin(fd1, fd2) is more like introducing two capabilities
to each other, which doesn't really make sense, than talking to the
objects behind the scenes.
the objects behind the scenes in plan 9 are servers and device drivers.

it might be interesting to provide a nice (not /srv based) way of passing
file descriptors between unrelated processes. the challenge comes when
you want to make it
work on a remote file server...



  reply	other threads:[~2009-12-07 21:03 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-05  3:17 Sam Watkins
2009-12-05  3:36 ` Lyndon Nerenberg
2009-12-05  3:56   ` Sam Watkins
2009-12-05  4:03     ` Lyndon Nerenberg
2009-12-05 18:16 ` Tim Newsham
2009-12-05 18:24   ` Tim Newsham
2009-12-05 19:47     ` Bakul Shah
2009-12-07 12:24       ` roger peppe
2009-12-07 12:32         ` Charles Forsyth
2009-12-07 12:35           ` Francisco J Ballesteros
2009-12-07 13:42             ` Charles Forsyth
2009-12-07 16:10             ` erik quanstrom
2009-12-07 16:14               ` Francisco J Ballesteros
2009-12-07 14:13         ` Sam Watkins
2009-12-07 14:36           ` roger peppe
2009-12-07 19:11             ` Nathaniel W Filardo
2009-12-07 21:03               ` roger peppe [this message]
2009-12-08 12:51           ` matt
2009-12-07 12:06     ` Mechiel Lukkien
2009-12-07 12:31       ` roger peppe
2010-01-05 13:48     ` Enrico Weigelt
2010-01-05 15:53       ` Steve Simon
     [not found] <<alpine.BSF.2.00.0912042029370.66255@legolas.yyc.orthanc.ca>
2009-12-05  4:47 ` erik quanstrom
2009-12-05  5:09   ` Lyndon Nerenberg
2009-12-05  5:11     ` Lyndon Nerenberg
2009-12-05  8:10   ` Sam Watkins
2009-12-05 11:44     ` Francisco J Ballesteros
2009-12-05 16:32       ` ron minnich
2009-12-05 17:01         ` Francisco J Ballesteros
2009-12-05 17:09           ` ron minnich
     [not found] <<alpine.BSF.2.00.0912042210290.81688@legolas.yyc.orthanc.ca>
2009-12-05 13:26 ` erik quanstrom
2009-12-05 14:22   ` Sam Watkins
2009-12-05 17:47     ` Skip Tavakkolian
2009-12-05 17:56       ` Skip Tavakkolian
     [not found] <<20091205081032.GJ8759@nipl.net>
2009-12-05 13:51 ` erik quanstrom
     [not found] <<20091205194741.0697D5B76@mail.bitblocks.com>
2009-12-05 20:03 ` erik quanstrom
2009-12-05 20:24   ` Bakul Shah
     [not found] <<20091205202420.855AD5B77@mail.bitblocks.com>
2009-12-05 20:27 ` erik quanstrom
2009-12-05 20:59   ` Bakul Shah
2009-12-06  7:45     ` Sam Watkins
2009-12-05 20:30 ` erik quanstrom
     [not found] <<20091207120652.GB16320@knaagkever.ueber.net>
2009-12-07 12:19 ` erik quanstrom
2009-12-07 14:41 Francisco J Ballesteros
2009-12-07 15:11 ` roger peppe
     [not found] <<8ccc8ba40912070814o2f2c7eb9s5887a31810eab12e@mail.gmail.com>
2009-12-07 16:24 ` erik quanstrom
2009-12-07 16:48   ` Francisco J Ballesteros

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=df49a7370912071303ibd5e6bfw5825bfe7801f16cc@mail.gmail.com \
    --to=rogpeppe@gmail.com \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).