From owner-svn-src-all@FreeBSD.ORG Fri Oct 7 12:42:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B08E61065674; Fri, 7 Oct 2011 12:42:03 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A09798FC08; Fri, 7 Oct 2011 12:42:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p97Cg36E011054; Fri, 7 Oct 2011 12:42:03 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p97Cg3u5011052; Fri, 7 Oct 2011 12:42:03 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201110071242.p97Cg3u5011052@svn.freebsd.org> From: Ed Schouten Date: Fri, 7 Oct 2011 12:42:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226100 - head/sys/teken/stress X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2011 12:42:03 -0000 Author: ed Date: Fri Oct 7 12:42:03 2011 New Revision: 226100 URL: http://svn.freebsd.org/changeset/base/226100 Log: Simply let teken_stress use arc4random. This makes it run quite a bit faster, since it makes system calls less often. Modified: head/sys/teken/stress/teken_stress.c Modified: head/sys/teken/stress/teken_stress.c ============================================================================== --- head/sys/teken/stress/teken_stress.c Fri Oct 7 12:21:50 2011 (r226099) +++ head/sys/teken/stress/teken_stress.c Fri Oct 7 12:42:03 2011 (r226100) @@ -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] =