Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Guard global `rnd_mempool' against interrupts.



details:   https://anonhg.NetBSD.org/src/rev/58cb407a2d04
branches:  trunk
changeset: 473644:58cb407a2d04
user:      pk <pk%NetBSD.org@localhost>
date:      Sat Jun 12 10:58:47 1999 +0000

description:
Guard global `rnd_mempool' against interrupts.
Use appropriate flags in pool_get().

diffstat:

 sys/dev/rnd.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r 0809752ab3e0 -r 58cb407a2d04 sys/dev/rnd.c
--- a/sys/dev/rnd.c     Sat Jun 12 00:21:13 1999 +0000
+++ b/sys/dev/rnd.c     Sat Jun 12 10:58:47 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rnd.c,v 1.15 1999/04/01 19:07:40 explorer Exp $        */
+/*     $NetBSD: rnd.c,v 1.16 1999/06/12 10:58:47 pk Exp $      */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -671,8 +671,11 @@
 rnd_sample_allocate(rndsource_t *source)
 {
        rnd_sample_t *c;
+       int s;
 
-       c = pool_get(&rnd_mempool, M_WAITOK);
+       s = splhigh();
+       c = pool_get(&rnd_mempool, PR_WAITOK);
+       splx(s);
        if (c == NULL)
                return (NULL);
 
@@ -690,8 +693,11 @@
 rnd_sample_allocate_isr(rndsource_t *source)
 {
        rnd_sample_t *c;
+       int s;
 
+       s = splhigh();
        c = pool_get(&rnd_mempool, 0);
+       splx(s);
        if (c == NULL)
                return (NULL);
 
@@ -705,8 +711,12 @@
 static void
 rnd_sample_free(rnd_sample_t *c)
 {
+       int s;
+
        memset(c, 0, sizeof(rnd_sample_t));
+       s = splhigh();
        pool_put(&rnd_mempool, c);
+       splx(s);
 }
 
 /*



Home | Main Index | Thread Index | Old Index