From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1f9ba332a43a89accc422db5250bae01@9netics.com> To: 9fans@9fans.net Date: Sat, 21 May 2016 01:49:13 -0700 From: Skip Tavakkolian <9nut@9netics.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Namespace inheritance between processes Topicbox-Message-UUID: 916d8d50-ead9-11e9-9d60-3106f5b1d025 lets create a couple of shell scripts like this: 1) ns_shared: #! /bin/rc cat /n/tmp/foo ramfs -m /n/tmp # start another ramfs in the child's namespace echo something > /n/tmp/foo cat /n/tmp/foo exit 2) ns_RFNAMEG #! /bin/rc rfork n cat /n/tmp/foo ramfs -m /n/tmp # start another ramfs in the child's namespace echo anotherthing > /n/tmp/foo cat /n/tmp/foo exit then in an interactive rc: % ramfs -m /n/tmp % echo 123 > /n/tmp/foo % touch /n/tmp/bar % ls -l /n/tmp --rw-rw-r-- M 14458 fst fst 0 May 21 01:46 /n/tmp/bar --rw-rw-r-- M 14458 fst fst 4 May 21 01:45 /n/tmp/foo % ns_RFNAMEG 123 anotherthing % ls -l /n/tmp --rw-rw-r-- M 14458 fst fst 0 May 21 01:46 /n/tmp/bar --rw-rw-r-- M 14458 fst fst 4 May 21 01:45 /n/tmp/foo % cat /n/tmp/foo 123 % ns_shared 123 something % ls -l /n/tmp --rw-rw-r-- M 14462 fst fst 10 May 21 01:46 /n/tmp/foo % cat /n/tmp/foo something % > On Sat, May 21, 2016 at 12:26 AM, Casey Rodarmor wrote: >> Hi 9 fans, >> >> I'm trying to figure out how namespace inheritance between process groups works. >> >> Let's say I have a process A which forks a child process B with the >> RFNAMEG so it receives a copy of A's namespace. >> >> If process A then makes a change to its namespace, will process B see >> that change? Or does B receive a distinct copy that A then can't >> change? >> >> Thanks! >> >> Best, >> Casey > > Also, whatever the answer is, how can I test this for myself? I was > struggling to come up with a combination of commands, short of writing > some C programs, which would let me have two interactive rc shells > that inherit from one another, since rc doesn't have job control and > new rio windows are in a new process group.