From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Fri, 5 Nov 2010 06:58:33 -0400 To: 9fans@9fans.net Message-ID: <3c5bbf46c1bea0e36235f391b63b969f@plug.quanstro.net> In-Reply-To: <20101105102946.GA12171@shutemov.name> References: <20101105102946.GA12171@shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Passing a file descriptor between processes Topicbox-Message-UUID: 77a74544-ead6-11e9-9d60-3106f5b1d025 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