Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Mar 2004 17:39:41 -0800
From:      David Schultz <das@FreeBSD.ORG>
To:        Brian Feldman <green@FreeBSD.ORG>
Cc:        cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/gen arc4random.c
Message-ID:  <20040325013941.GA65920@VARK.homeunix.com>
In-Reply-To: <200403241444.i2OEiv86083617@repoman.freebsd.org>
References:  <200403241444.i2OEiv86083617@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 24, 2004, Brian Feldman wrote:
> green       2004/03/24 06:44:57 PST
> 
>   FreeBSD src repository
> 
>   Modified files:
>     lib/libc/gen         arc4random.c 
>   Log:
>   Add locking so that arc4random(3) functions are all reentrant for
>   pthreads.

I think you mean thread-safe, not reentrant.  Also:
PR:	63287

AFAIK, there's no standard for how arc4random() is supposed to
behave, but the new behavior is a break from that of other BSDs,
and from the behavior of random(), so the change should probably
be documented in the manpage.

FWIW, on my UP Pentium 4 with SMT, this adds roughly 3% overhead
for unthreaded apps and 52% overhead for threaded apps.  It is
conceivable that an application writer would want access to the
raw interface in order to serialize calls manually for efficiency,
but I'm not such an application writer, so I won't complain.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040325013941.GA65920>