Is fork() hook ever possible?

John Baldwin jhb at freebsd.org
Tue Sep 16 20:33:21 UTC 2008


On Tuesday 16 September 2008 03:42:18 pm Poul-Henning Kamp wrote:
> In message <20080916193347.GA43665 at nagual.pp.ru>, Andrey Chernov writes:
> 
> >That was my original idea - to set the flag variable (not a new inteface) 
> >in the fork() wrapper which arc4random() will check later. I'll think 
> >about, what is better: getpid() speedup looks like more general solution 
> >for all similar cases while the flag will be for arc4random() only.
> 
> Not to be devils advocate here, but isn't the process pid about the
> worst seed you can use for a random generator, considering that it
> is publically visible ?

The PID isn't the seed, he's using a PID change as a notification that the 
process needs to do a re-stir the next time it wants a psuedo-random number 
(b/c the PID change means it is now a new process).

-- 
John Baldwin


More information about the freebsd-current mailing list