Scientific Operations Bellum Gratia Artis

testing - 2015 - September - this message

[ previous , next ]

Subject: Re: [9fans] Privalloc(2) and rfork(RFPROC|RFMEM) (was: a pair nec

From: Giacomo Tesio <giacomo@[REDACTED]>
Date: Sun, 6 Sep 2015 01:03:38 +0200
found text part

2015-09-05 20:47 GMT+02:00 erik quanstrom :

> > May be my problem is that p is global in my case?
>
> global variables are in the bss, and thus shared. p will have
> the same value in each thread, but *p should point into the
> stack, and thus the same virtual address will be mapped to
> different physical pages of memory.
>
> however, if *p is assigned to a non-zero value before the process
> is created, the new page allocated for the new process' stack will
> have a copy of the old value, and thus not be 0.
>
> - erik
>
>
That's exactly what happened.
I misread privalloc(2), and assumed that privalloc()ed addresses were
somehow reset on rfork.
This is probably something to explicitly state the man page.

Thanks you all!


Giacomo