9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Re: bug in aux/listen
@ 1997-09-16 18:57 G.David
  0 siblings, 0 replies; 3+ messages in thread
From: G.David @ 1997-09-16 18:57 UTC (permalink / raw)


From: forsyth@plan9.cs.york.ac.uk
Date: 	Wed, 12 Jun 1996 08:53:05 -0400
subject: bug in aux/listen

>aux/listen does an rfork sharing memory to create the listener for
>each service.  that also ensures that
>	Subsequent forks by the parent will then
>	propagate the shared data and bss between children.
>	[rfork(2)]
>aux/listen later forks a process to handle each incoming call.
>that doesn't specify RFMEM, but is still sharing memory.

Going through some old stuff and I found this one.  I think you
are miss reading the above line from rfork(2).  I think it is
saying that subsequent forks by the *parent*, if called with RFMEM,
will share data and bss between children of the *parent*.  Subsequent
forks of the children are not affected unless they too do a RFMEM.

I verified this behavour by the code in sysproc.c and segment.c.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] Re: bug in aux/listen
@ 1997-09-16 20:00 G.David
  0 siblings, 0 replies; 3+ messages in thread
From: G.David @ 1997-09-16 20:00 UTC (permalink / raw)


From: rob@plan9.bell-labs.com
>
>> saying that subsequent forks by the *parent*, if called with RFMEM,
>> will share data and bss between children of the *parent*.  Subsequent
>> forks of the children are not affected unless they too do a RFMEM.
>
>The flag gets set on the segment, not the process.  Any process created
>with that segment mapped will see the same segment.

Let me look again.  Hmmm...  Ah, there it is, hiding at the top...

switch(s->type&SG_TYPE) {
case SG_TEXT:
case SG_SHARED:
case SG_PHYSICAL:
case SG_SHDATA:
	incref(s);
	return s;

Ok, once it is marked shared any new fork, no matter what the share
flag is set to, will get the *same* segment.  Wow, you need to be
careful with RFMEM!!!

I stand corrected.

David Butler




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] Re: bug in aux/listen
@ 1997-09-16 19:25 rob
  0 siblings, 0 replies; 3+ messages in thread
From: rob @ 1997-09-16 19:25 UTC (permalink / raw)


> Going through some old stuff and I found this one.  I think you
> are miss reading the above line from rfork(2).  I think it is
> saying that subsequent forks by the *parent*, if called with RFMEM,
> will share data and bss between children of the *parent*.  Subsequent
> forks of the children are not affected unless they too do a RFMEM.

The flag gets set on the segment, not the process.  Any process created
with that segment mapped will see the same segment.

-rob




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-09-16 20:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-16 18:57 [9fans] Re: bug in aux/listen G.David
1997-09-16 19:25 rob
1997-09-16 20:00 G.David

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).