Subject: Re: [9fans] Privalloc(2) and rfork(RFPROC|RFMEM) (was: a pair nec
From: Charles Forsyth <charles.forsyth@[REDACTED]>
Date: Sat, 5 Sep 2015 23:45:53 +0100
found text part
On 5 September 2015 at 15:03, Giacomo Tesio wrote:
> For extra safety I added an assert(*p == nil) just after rfork, and after
> a few (apparently?) successful spawns, the assert fails.
The stack is a logical copy of the parent process's stack at rfork, even
with RFMEM, since the stack's not shared,
so if you've previously assigned it in the parent, its child will see the
non-nil value after the fork. It doesn't get a completely fresh stack.