Deleted Added
full compact
randomdev_soft.c (153575) randomdev_soft.c (157815)
1/*-
2 * Copyright (c) 2000-2004 Mark R V Murray
3 * Copyright (c) 2004 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 13 unchanged lines hidden (view full) ---

22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000-2004 Mark R V Murray
3 * Copyright (c) 2004 Robert N. M. Watson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 13 unchanged lines hidden (view full) ---

22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/random/randomdev_soft.c 153575 2005-12-20 21:41:52Z ps $");
30__FBSDID("$FreeBSD: head/sys/dev/random/randomdev_soft.c 157815 2006-04-17 18:20:38Z jhb $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/conf.h>
36#include <sys/fcntl.h>
37#include <sys/kernel.h>
38#include <sys/kthread.h>

--- 167 unchanged lines hidden (view full) ---

206
207 /* Deregister the randomness harvesting routine */
208 random_yarrow_deinit_harvester();
209
210 /*
211 * Command the hash/reseed thread to end and wait for it to finish
212 */
213 random_kthread_control = -1;
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/conf.h>
36#include <sys/fcntl.h>
37#include <sys/kernel.h>
38#include <sys/kthread.h>

--- 167 unchanged lines hidden (view full) ---

206
207 /* Deregister the randomness harvesting routine */
208 random_yarrow_deinit_harvester();
209
210 /*
211 * Command the hash/reseed thread to end and wait for it to finish
212 */
213 random_kthread_control = -1;
214 tsleep((void *)&random_kthread_control, curthread->td_priority, "term",
215 0);
214 tsleep((void *)&random_kthread_control, 0, "term", 0);
216
217 /* Destroy the harvest fifos */
218 while (!STAILQ_EMPTY(&emptyfifo.head)) {
219 np = STAILQ_FIRST(&emptyfifo.head);
220 STAILQ_REMOVE_HEAD(&emptyfifo.head, next);
221 free(np, M_ENTROPY);
222 }
223 for (e = RANDOM_START; e < ENTROPYSOURCE; e++) {

--- 56 unchanged lines hidden (view full) ---

280 }
281 mtx_unlock_spin(&harvest_mtx);
282
283 KASSERT(local_count == 0, ("random_kthread: local_count %d",
284 local_count));
285
286 /* Found nothing, so don't belabour the issue */
287 if (!active)
215
216 /* Destroy the harvest fifos */
217 while (!STAILQ_EMPTY(&emptyfifo.head)) {
218 np = STAILQ_FIRST(&emptyfifo.head);
219 STAILQ_REMOVE_HEAD(&emptyfifo.head, next);
220 free(np, M_ENTROPY);
221 }
222 for (e = RANDOM_START; e < ENTROPYSOURCE; e++) {

--- 56 unchanged lines hidden (view full) ---

279 }
280 mtx_unlock_spin(&harvest_mtx);
281
282 KASSERT(local_count == 0, ("random_kthread: local_count %d",
283 local_count));
284
285 /* Found nothing, so don't belabour the issue */
286 if (!active)
288 tsleep(&harvestfifo, curthread->td_priority, "-",
289 hz / 10);
287 tsleep(&harvestfifo, 0, "-", hz / 10);
290
291 }
292
293 random_set_wakeup_exit(&random_kthread_control);
294 /* NOTREACHED */
295}
296
297/* Entropy harvesting routine. This is supposed to be fast; do

--- 113 unchanged lines hidden ---
288
289 }
290
291 random_set_wakeup_exit(&random_kthread_control);
292 /* NOTREACHED */
293}
294
295/* Entropy harvesting routine. This is supposed to be fast; do

--- 113 unchanged lines hidden ---