summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-09-23 04:37:54 +0000
committerpeter <peter@FreeBSD.org>1996-09-23 04:37:54 +0000
commitd984089805ee5a6c85d2d2e8a5b1752377482e38 (patch)
tree1e8956cb2e550adb393f11386f3f03d89f20763d /sys
parentcefec8a4339866211ae842360fc83d731b770376 (diff)
downloadFreeBSD-src-d984089805ee5a6c85d2d2e8a5b1752377482e38.zip
FreeBSD-src-d984089805ee5a6c85d2d2e8a5b1752377482e38.tar.gz
call srandom() during the boot to start the sequence with a slightly less
predictable seed.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/init_main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 8e2254c..cca436f 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
- * $Id: init_main.c,v 1.47 1996/08/31 15:05:58 asami Exp $
+ * $Id: init_main.c,v 1.48 1996/09/03 10:22:58 asami Exp $
*/
#include "opt_rlimit.h"
@@ -418,6 +418,8 @@ static void
proc0_post(dummy)
void *dummy;
{
+ struct timeval tv;
+
/*
* Now can look at time, having had a chance to verify the time
* from the file system. Reset p->p_rtime as it may have been
@@ -426,6 +428,12 @@ proc0_post(dummy)
proc0.p_stats->p_start = runtime = mono_time = boottime = time;
proc0.p_rtime.tv_sec = proc0.p_rtime.tv_usec = 0;
+ /*
+ * Give the ``random'' number generator a thump.
+ */
+ microtime(&tv);
+ srandom(tv.tv_sec ^ tv.tv_usec);
+
/* Initialize signal state for process 0. */
siginit(&proc0);
}
OpenPOWER on IntegriCloud