aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/random/randomdev.c
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2000-07-25 21:18:47 +0000
committerMark Murray <markm@FreeBSD.org>2000-07-25 21:18:47 +0000
commit7aa4389a6c7429f679ba5d0348c4251242ed4702 (patch)
treee0df1733752dbf98e34078500989835c49d8aaa4 /sys/dev/random/randomdev.c
parentf94bf02fdbcc9446be623773c7bcfdf7a21b4e88 (diff)
Notes
Diffstat (limited to 'sys/dev/random/randomdev.c')
-rw-r--r--sys/dev/random/randomdev.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c
index c84f4bd67030..645cfb066725 100644
--- a/sys/dev/random/randomdev.c
+++ b/sys/dev/random/randomdev.c
@@ -46,6 +46,7 @@
#include <dev/randomdev/yarrow.h>
+static d_open_t random_open;
static d_read_t random_read;
static d_write_t random_write;
@@ -54,7 +55,7 @@ static d_write_t random_write;
#define URANDOM_MINOR 4
static struct cdevsw random_cdevsw = {
- /* open */ (d_open_t *)nullop,
+ /* open */ random_open,
/* close */ (d_close_t *)nullop,
/* read */ random_read,
/* write */ random_write,
@@ -83,11 +84,20 @@ SYSCTL_INT(_kern_random_yarrow, OID_AUTO, bins, CTLFLAG_RW,
SYSCTL_INT(_kern_random_yarrow, OID_AUTO, fastthresh, CTLFLAG_RW,
&random_state.pool[0].thresh, 100, "Fast pool reseed threshhold");
SYSCTL_INT(_kern_random_yarrow, OID_AUTO, slowthresh, CTLFLAG_RW,
- &random_state.pool[1].thresh, 100, "Slow pool reseed threshhold");
+ &random_state.pool[1].thresh, 160, "Slow pool reseed threshhold");
SYSCTL_INT(_kern_random_yarrow, OID_AUTO, slowoverthresh, CTLFLAG_RW,
&random_state.slowoverthresh, 2, "Slow pool over-threshhold reseed");
static int
+random_open(dev_t dev, int flags, int fmt, struct proc *p)
+{
+ if ((flags & FWRITE) && (securelevel > 0 || suser(p)))
+ return EPERM;
+ else
+ return 0;
+}
+
+static int
random_read(dev_t dev, struct uio *uio, int flag)
{
u_int c, ret;