Tue Apr 14 11:59:40 2015 UTC ()
Fix comment.


(riastradh)
diff -r1.47 -r1.48 src/sys/kern/kern_rndq.c

cvs diff -r1.47 -r1.48 src/sys/kern/Attic/kern_rndq.c (expand / switch to unified diff)

--- src/sys/kern/Attic/kern_rndq.c 2015/04/13 22:43:41 1.47
+++ src/sys/kern/Attic/kern_rndq.c 2015/04/14 11:59:40 1.48
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_rndq.c,v 1.47 2015/04/13 22:43:41 riastradh Exp $ */ 1/* $NetBSD: kern_rndq.c,v 1.48 2015/04/14 11:59:40 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1997-2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Michael Graff <explorer@flame.org> and Thor Lancelot Simon. 8 * by Michael Graff <explorer@flame.org> and Thor Lancelot Simon.
9 * This code uses ideas and algorithms from the Linux driver written by 9 * This code uses ideas and algorithms from the Linux driver written by
10 * Ted Ts'o. 10 * Ted Ts'o.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE. 31 * POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.47 2015/04/13 22:43:41 riastradh Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.48 2015/04/14 11:59:40 riastradh Exp $");
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/atomic.h> 38#include <sys/atomic.h>
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include <sys/fcntl.h> 40#include <sys/fcntl.h>
41#include <sys/select.h> 41#include <sys/select.h>
42#include <sys/poll.h> 42#include <sys/poll.h>
43#include <sys/kmem.h> 43#include <sys/kmem.h>
44#include <sys/mutex.h> 44#include <sys/mutex.h>
45#include <sys/proc.h> 45#include <sys/proc.h>
46#include <sys/kernel.h> 46#include <sys/kernel.h>
47#include <sys/conf.h> 47#include <sys/conf.h>
48#include <sys/systm.h> 48#include <sys/systm.h>
@@ -208,27 +208,27 @@ rnd_printf(const char *fmt, ...) @@ -208,27 +208,27 @@ rnd_printf(const char *fmt, ...)
208 rnd_printing = 0; 208 rnd_printing = 0;
209} 209}
210 210
211void 211void
212rnd_init_softint(void) { 212rnd_init_softint(void) {
213 rnd_process = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE, 213 rnd_process = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE,
214 rnd_intr, NULL); 214 rnd_intr, NULL);
215 rnd_wakeup = softint_establish(SOFTINT_CLOCK|SOFTINT_MPSAFE, 215 rnd_wakeup = softint_establish(SOFTINT_CLOCK|SOFTINT_MPSAFE,
216 rnd_wake, NULL); 216 rnd_wake, NULL);
217 rnd_schedule_process(); 217 rnd_schedule_process();
218} 218}
219 219
220/* 220/*
221 * Generate a 64-bit counter. 221 * Generate a 32-bit counter.
222 */ 222 */
223static inline uint32_t 223static inline uint32_t
224rnd_counter(void) 224rnd_counter(void)
225{ 225{
226 struct timespec ts; 226 struct timespec ts;
227 uint32_t ret; 227 uint32_t ret;
228 228
229#if defined(__HAVE_CPU_COUNTER) 229#if defined(__HAVE_CPU_COUNTER)
230 if (cpu_hascounter()) 230 if (cpu_hascounter())
231 return cpu_counter32(); 231 return cpu_counter32();
232#endif 232#endif
233 if (rnd_ready) { 233 if (rnd_ready) {
234 nanouptime(&ts); 234 nanouptime(&ts);