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 <ca...@rodarmor.com> 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.


Reply via email to