summaryrefslogtreecommitdiffstats
path: root/sys/dev/random
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2000-10-27 06:06:04 +0000
committermarkm <markm@FreeBSD.org>2000-10-27 06:06:04 +0000
commit6458d733a983150ebfc10b03d7734c3b42c6e303 (patch)
treebf869d324cadd5843af844a6c6d36a999b8a1278 /sys/dev/random
parenta01491f9047180a93bb215af3fbb93771305357b (diff)
downloadFreeBSD-src-6458d733a983150ebfc10b03d7734c3b42c6e303.zip
FreeBSD-src-6458d733a983150ebfc10b03d7734c3b42c6e303.tar.gz
As the blocking model has seems to be troublesome for many, disable
it for now with an option. This option is already deprecated, and will be removed when the entropy-harvesting code is fast enough to warrant it.
Diffstat (limited to 'sys/dev/random')
-rw-r--r--sys/dev/random/randomdev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c
index c8d2eba..2f3e4a3 100644
--- a/sys/dev/random/randomdev.c
+++ b/sys/dev/random/randomdev.c
@@ -49,6 +49,8 @@
#include <dev/random/hash.h>
#include <dev/random/yarrow.h>
+#include "opt_noblockrandom.h"
+
static d_open_t random_open;
static d_read_t random_read;
static d_write_t random_write;
@@ -109,6 +111,8 @@ random_read(dev_t dev, struct uio *uio, int flag)
int error = 0;
void *random_buf;
+/* XXX Temporary ifndef to allow users to have a nonblocking device */
+#ifndef NOBLOCKRANDOM
while (!random_state.seeded) {
if (flag & IO_NDELAY)
error = EWOULDBLOCK;
@@ -117,6 +121,7 @@ random_read(dev_t dev, struct uio *uio, int flag)
if (error != 0)
return error;
}
+#endif
c = min(uio->uio_resid, PAGE_SIZE);
random_buf = (void *)malloc(c, M_TEMP, M_WAITOK);
while (uio->uio_resid > 0 && error == 0) {
OpenPOWER on IntegriCloud