9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Passing a file descriptor between processes
@ 2010-11-05 10:29 Kirill A. Shutemov
  2010-11-05 10:57 ` Lucio De Re
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Kirill A. Shutemov @ 2010-11-05 10:29 UTC (permalink / raw)
  To: 9fans

One of the ugliest interface in Unix is passing a file descriptor between
processes [1]. Does Plan9 provide any mechanism for it?

[1] http://book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch17lev1sec4.html

--
 Kirill A. Shutemov



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 10:29 [9fans] Passing a file descriptor between processes Kirill A. Shutemov
@ 2010-11-05 10:57 ` Lucio De Re
  2010-11-05 10:58 ` erik quanstrom
  2010-11-05 11:03 ` roger peppe
  2 siblings, 0 replies; 9+ messages in thread
From: Lucio De Re @ 2010-11-05 10:57 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Nov 05, 2010 at 12:29:46PM +0200, Kirill A. Shutemov wrote:
>
> One of the ugliest interface in Unix is passing a file descriptor between
> processes [1]. Does Plan9 provide any mechanism for it?
>
You can pass fds in channels between threads, but for processes you
should look at #s for guidance.

++L



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 10:29 [9fans] Passing a file descriptor between processes Kirill A. Shutemov
  2010-11-05 10:57 ` Lucio De Re
@ 2010-11-05 10:58 ` erik quanstrom
  2010-11-05 11:03 ` roger peppe
  2 siblings, 0 replies; 9+ messages in thread
From: erik quanstrom @ 2010-11-05 10:58 UTC (permalink / raw)
  To: 9fans

On Fri Nov  5 06:32:55 EDT 2010, kirill@shutemov.name wrote:
> One of the ugliest interface in Unix is passing a file descriptor between
> processes [1]. Does Plan9 provide any mechanism for it?
>
> [1] http://book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch17lev1sec4.html

there is no mechanism similar to sending fds over a socket.
the two ways of file descriptor sharing are via
(a) rfork(2); and
(b) srv(3)

rfork (optionally) allows a process to share a file descriptor
table with a child process.  srv allows a process to post a file
descriptor by a given name in /srv.  the normal file operations
apply on that file.  in particular, it must be opened
before use.

- erik



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 10:29 [9fans] Passing a file descriptor between processes Kirill A. Shutemov
  2010-11-05 10:57 ` Lucio De Re
  2010-11-05 10:58 ` erik quanstrom
@ 2010-11-05 11:03 ` roger peppe
  2010-11-05 11:41   ` erik quanstrom
  2 siblings, 1 reply; 9+ messages in thread
From: roger peppe @ 2010-11-05 11:03 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

see srv(3)
http://plan9.bell-labs.com/magic/man2html/3/srv

On 5 November 2010 10:29, Kirill A. Shutemov <kirill@shutemov.name> wrote:
> One of the ugliest interface in Unix is passing a file descriptor between
> processes [1]. Does Plan9 provide any mechanism for it?
>
> [1] http://book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch17lev1sec4.html
>
> --
>  Kirill A. Shutemov
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 11:03 ` roger peppe
@ 2010-11-05 11:41   ` erik quanstrom
  2010-11-05 12:16     ` Venkatesh Srinivas
  0 siblings, 1 reply; 9+ messages in thread
From: erik quanstrom @ 2010-11-05 11:41 UTC (permalink / raw)
  To: 9fans

On Fri Nov  5 07:36:42 EDT 2010, rogpeppe@gmail.com wrote:
> see srv(3)
> http://plan9.bell-labs.com/magic/man2html/3/srv
>
> On 5 November 2010 10:29, Kirill A. Shutemov <kirill@shutemov.name> wrote:
> > One of the ugliest interface in Unix is passing a file descriptor between
> > processes [1]. Does Plan9 provide any mechanism for it?
> >
> > [1] http://book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch17lev1sec4.html

the op may have seen this: http://lwn.net/Articles/411845/
—which i found hard to read because the author's changing
definition of "unix".

- erik



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 11:41   ` erik quanstrom
@ 2010-11-05 12:16     ` Venkatesh Srinivas
  2010-11-05 12:21       ` erik quanstrom
  2010-11-05 12:27       ` Lucio De Re
  0 siblings, 2 replies; 9+ messages in thread
From: Venkatesh Srinivas @ 2010-11-05 12:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On Fri, Nov 5, 2010 at 7:41 AM, erik quanstrom <quanstro@labs.coraid.com>wrote:

> On Fri Nov  5 07:36:42 EDT 2010, rogpeppe@gmail.com wrote:
> > see srv(3)
> > http://plan9.bell-labs.com/magic/man2html/3/srv
> >
> > On 5 November 2010 10:29, Kirill A. Shutemov <kirill@shutemov.name>
> wrote:
> > > One of the ugliest interface in Unix is passing a file descriptor
> between
> > > processes [1]. Does Plan9 provide any mechanism for it?
> > >
> > > [1]
> http://book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch17lev1sec4.html
>
> the op may have seen this: http://lwn.net/Articles/411845/
> —which i found hard to read because the author's changing
> definition of "unix".
>
> - erik
>
>
There was a discussion here a while ago about it too: search for 'sendfd on
native Plan 9' from december 2008. Start here:
http://9fans.net/archive/2008/12/515, follow till January 2009.

Currently, if your processes have a common parent, you can use rfork; if
not, you must resort to #s. '#s' is a pretty unfortunate interface,
though...

-- vs

[-- Attachment #2: Type: text/html, Size: 1938 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 12:16     ` Venkatesh Srinivas
@ 2010-11-05 12:21       ` erik quanstrom
  2010-11-05 21:40         ` Skip Tavakkolian
  2010-11-05 12:27       ` Lucio De Re
  1 sibling, 1 reply; 9+ messages in thread
From: erik quanstrom @ 2010-11-05 12:21 UTC (permalink / raw)
  To: 9fans

> Currently, if your processes have a common parent, you can use rfork; if
> not, you must resort to #s. '#s' is a pretty unfortunate interface,
> though...

okay, practicially speaking, what's wrong with #s, and what do you propose?

- erik



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 12:16     ` Venkatesh Srinivas
  2010-11-05 12:21       ` erik quanstrom
@ 2010-11-05 12:27       ` Lucio De Re
  1 sibling, 0 replies; 9+ messages in thread
From: Lucio De Re @ 2010-11-05 12:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, Nov 05, 2010 at 08:16:30AM -0400, Venkatesh Srinivas wrote:
>
> '#s' is a pretty unfortunate interface,
> though...
>
Maybe.  But it is only a tool and as such it can be replaced or augmented.
It's unlikely that Plan 9 will retain its integrity without #s, but
that does not mean that an alternative can't be installed with similar,
but more friendly semantics.  Hm, let me try this: it means that an
alternative can be installed, more suitable to a slightly different
application.  It does need to be a kernel device.

++L



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] Passing a file descriptor between processes
  2010-11-05 12:21       ` erik quanstrom
@ 2010-11-05 21:40         ` Skip Tavakkolian
  0 siblings, 0 replies; 9+ messages in thread
From: Skip Tavakkolian @ 2010-11-05 21:40 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

i wish #s had a directory structure and enforced group permissions.

On Fri, Nov 5, 2010 at 5:21 AM, erik quanstrom <quanstro@quanstro.net> wrote:
>> Currently, if your processes have a common parent, you can use rfork; if
>> not, you must resort to #s. '#s' is a pretty unfortunate interface,
>> though...
>
> okay, practicially speaking, what's wrong with #s, and what do you propose?
>
> - erik
>
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-11-05 21:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-05 10:29 [9fans] Passing a file descriptor between processes Kirill A. Shutemov
2010-11-05 10:57 ` Lucio De Re
2010-11-05 10:58 ` erik quanstrom
2010-11-05 11:03 ` roger peppe
2010-11-05 11:41   ` erik quanstrom
2010-11-05 12:16     ` Venkatesh Srinivas
2010-11-05 12:21       ` erik quanstrom
2010-11-05 21:40         ` Skip Tavakkolian
2010-11-05 12:27       ` Lucio De Re

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).