From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <39af85b31163336146dbce1dd8364418@gmx.de> Date: Mon, 31 Oct 2011 23:47:32 +0100 From: cinap_lenrek@gmx.de To: 9fans@9fans.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] native (mostly) go for plan9 Topicbox-Message-UUID: 3d5bf64a-ead7-11e9-9d60-3106f5b1d025 for 9front page, i wrote a function that implements inferno style pctl filedescriptor passing. basicly, you fork and then give it a list of filedescriptors you want in the process like: dupfds(foofd, 1, 2, -1); // redirect foofd to stdin of this process, keep stdout/stderr all the other filedescriptors get closed so you wont leak any fds. i find this style mutch cleaner than flags on filedescriptors. here i say exactly what i want at the time of the exec/fork instead of having to worry about it in some random place where i open it. the implementation uses /fd to figure out what filedescriptors are open. a kernel based version of this would be nice :) -- cinap