9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Skip Tavakkolian <9nut@9netics.com>
To: 9fans@9fans.net
Subject: Re: [9fans] Namespace inheritance between processes
Date: Sat, 21 May 2016 01:49:13 -0700	[thread overview]
Message-ID: <1f9ba332a43a89accc422db5250bae01@9netics.com> (raw)
In-Reply-To: <CANLPe+O10qVKjd279LshD8PSCpUSQX3TQLyXzpVtMzbMdE975g@mail.gmail.com>

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 <casey@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	other threads:[~2016-05-21  8:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-21  7:26 Casey Rodarmor
2016-05-21  7:37 ` Casey Rodarmor
2016-05-21  8:49   ` Skip Tavakkolian [this message]
2016-05-21 10:01   ` Anthony Martin
2016-05-21 12:06     ` Anthony Martin
2016-05-22  3:01       ` Casey Rodarmor
2016-05-22  5:28         ` Skip Tavakkolian
2016-05-22  6:14           ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f9ba332a43a89accc422db5250bae01@9netics.com \
    --to=9nut@9netics.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).