From owner-svn-src-head@FreeBSD.ORG Thu Jan 26 17:55:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D14C106566C; Thu, 26 Jan 2012 17:55:39 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from fep24.mx.upcmail.net (fep24.mx.upcmail.net [62.179.121.44]) by mx1.freebsd.org (Postfix) with ESMTP id 5CEBB8FC18; Thu, 26 Jan 2012 17:55:36 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep17-int.chello.at (InterMail vM.8.01.05.04 201-2260-151-105-20111014) with ESMTP id <20120126173414.PLWI25410.viefep17-int.chello.at@edge04.upcmail.net>; Thu, 26 Jan 2012 18:34:14 +0100 Received: from mole.fafoe.narf.at ([213.47.85.26]) by edge04.upcmail.net with edge id SHaD1i0150a5KZh04HaDPn; Thu, 26 Jan 2012 18:34:14 +0100 X-SourceIP: 213.47.85.26 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 9BE666D44A; Thu, 26 Jan 2012 18:34:13 +0100 (CET) Date: Thu, 26 Jan 2012 18:34:13 +0100 From: Stefan Farfeleder To: John Baldwin Message-ID: <20120126173413.GD1345@mole.fafoe.narf.at> References: <20120126143819.GA88677@vniz.net> <20120126155626.GA92229@vniz.net> <201201261132.38320.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201261132.38320.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, Andrey Chernov , svn-src-all@freebsd.org, svn-src-head@freebsd.org, David Schultz , Mark Murray Subject: Re: svn commit: r230230 - head/sys/dev/random X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2012 17:55:39 -0000 On Thu, Jan 26, 2012 at 11:32:38AM -0500, John Baldwin wrote: > On Thursday, January 26, 2012 10:56:27 am Andrey Chernov wrote: > > > On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote: > > > > atomic_cmpset_int(&iniseed_state, ARC4_ENTER_NONE, > ARC4_ENTER_HAVE); > > > > break; > > > > Updated version (I hope, final): > > > > --- sys/libkern.h.old 2012-01-16 07:15:12.000000000 +0400 > > +++ sys/libkern.h 2012-01-26 19:38:06.000000000 +0400 > > @@ -72,6 +72,8 @@ static __inline quad_t qabs(quad_t a) { > > > > /* Prototypes for non-quad routines. */ > > struct malloc_type; > > +enum arc4_is { ARC4_ENTR_NONE, ARC4_ENTR_HAVE, ARC4_ENTR_DONE }; > > +extern volatile enum arc4_is arc4rand_iniseed_state; > > Atomics don't operate on enums. You'll need to make it an int and just use > #define's for the 3 states. The type of an enumerator actually is `int', so it should be fine. > > > uint32_t arc4random(void); > > void arc4rand(void *ptr, u_int len, int reseed); > > int bcmp(const void *, const void *, size_t); > > --- dev/random/randomdev_soft.c.old 2011-03-02 01:42:19.000000000 +0300 > > +++ dev/random/randomdev_soft.c 2012-01-26 19:35:12.000000000 +0400 > > @@ -366,6 +366,8 @@ random_yarrow_unblock(void) > > selwakeuppri(&random_systat.rsel, PUSER); > > wakeup(&random_systat); > > } > > + (void)atomic_cmpset_int(&arc4rand_iniseed_state, > > + ARC4_ENTR_NONE, ARC4_ENTR_HAVE); > > } Stefan