Is fork() hook ever possible?

Andrey Chernov ache at
Wed Sep 17 09:32:44 UTC 2008

On Wed, Sep 17, 2008 at 09:24:01AM +0000, Poul-Henning Kamp wrote:
> >The performance issue happens when application tries to call arc4random() 
> >in the loop.
> That is not what we are talking about, we are talking about the calls
> in mktemp and similar.

There are two things needed to be separated. mktemp etc. calls are the 
reason for the check. The check (in its current form) is the reason for 
slowing down in the loops because syscall overhead.

> >We can control our own arc4random() internal calls inside our own libs in 
> >such way but can't control 3rd party libs or programs arc4random() calls 
> >(consider ports).
> We are not obliged to control these calls.  If their authors do something
> stupid, it's not our problem.

The problem is that we are not authors of that API but currently OpenBSD 
are. We just integrate their API. Perhaps their API is stupid in this 
point (so they resolve it by non-efficient way), but people will try to 
follow their API because they are the authors, not ours.

> Just have the FreeBSD library calls, call the wrapper function that
> does a pid check and be done with it.

I understand your idea and it was first idea that comes to me too, but 
since API is not ours, it does not work that way.


More information about the freebsd-current mailing list