summaryrefslogtreecommitdiffstats
path: root/sys/teken
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2011-10-07 12:42:03 +0000
committered <ed@FreeBSD.org>2011-10-07 12:42:03 +0000
commite229f3cc32b2ef700cda399cee0a4076c942f68f (patch)
treee55051793f98f39a47a61947cd477b489904a586 /sys/teken
parent193a5b8d4431b7bda70260d3385daaab68cb07d8 (diff)
downloadFreeBSD-src-e229f3cc32b2ef700cda399cee0a4076c942f68f.zip
FreeBSD-src-e229f3cc32b2ef700cda399cee0a4076c942f68f.tar.gz
Simply let teken_stress use arc4random.
This makes it run quite a bit faster, since it makes system calls less often.
Diffstat (limited to 'sys/teken')
-rw-r--r--sys/teken/stress/teken_stress.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/sys/teken/stress/teken_stress.c b/sys/teken/stress/teken_stress.c
index 203c35b..a74cd8b 100644
--- a/sys/teken/stress/teken_stress.c
+++ b/sys/teken/stress/teken_stress.c
@@ -99,24 +99,14 @@ int
main(int argc __unused, char *argv[] __unused)
{
teken_t t;
- int rnd;
unsigned int i, iteration = 0;
unsigned char buf[2048];
- rnd = open("/dev/urandom", O_RDONLY);
- if (rnd < 0) {
- perror("/dev/urandom");
- exit(1);
- }
teken_init(&t, &tf, NULL);
for (;;) {
- if (read(rnd, buf, sizeof buf) != sizeof buf) {
- perror("read");
- exit(1);
- }
-
+ arc4random_buf(buf, sizeof buf);
for (i = 0; i < sizeof buf; i++) {
if (buf[i] >= 0x80)
buf[i] =
OpenPOWER on IntegriCloud