]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
randread: don't require -lrt
authorPaul R. Eggert <eggert@cs.ucla.edu>
Fri, 16 Jul 2010 21:02:08 +0000 (14:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 Jul 2010 22:49:05 +0000 (15:49 -0700)
Programs like 'sort' were linking to -lrt in order to get
clock_gettime, but this was misguided: it wasted considerable
resources while gaining at most 10 bits of entropy.  Almost nobody
needs the entropy, and there are better ways to get much better
entropy for people who do need it.
* gl/lib/rand-isaac.c (isaac_seed): Include <sys/time.h> not
"gethrxtime.h".
(isaac_seed): Use gettimeofday rather than gethrxtime.
* gl/modules/randread (Depends-on): Depend on gettimeofday
and not gethrxtime.
* src/Makefile.am (mktemp_LDADD, shred_LDADD, shuf_LDADD, sort_LDADD):
(tac_LDADD): Omit $(LIB_GETHRXTIME); no longer needed.

gl/lib/rand-isaac.c
gl/modules/randread
src/Makefile.am

index 52d53a393ce8573b7c00ce418c9d991dc4d71b25..377caa6050b9487517eecf916e778fb774afe294 100644 (file)
 #include "rand-isaac.h"
 
 #include <string.h>
+#include <sys/time.h>
 #include <unistd.h>
 
-#include "gethrxtime.h"
-
 
 /* This index operation is more efficient on many processors */
 #define ind(mm, x) \
@@ -292,7 +291,8 @@ isaac_seed (struct isaac_state *s)
   { gid_t t = getgid ();   ISAAC_SEED (s, t); }
 
   {
-    xtime_t t = gethrxtime ();
+    struct timeval t;
+    gettimeofday (&t, NULL);
     ISAAC_SEED (s, t);
   }
 
index 9870cc8f334e900c417e08bb98e61a0be009d141..efc7958262b1fe0226b443ddf3135fec4c9d92f8 100644 (file)
@@ -11,7 +11,7 @@ Depends-on:
 error
 exitfail
 fopen-safer
-gethrxtime
+gettimeofday
 quotearg
 stdbool
 stdint
index d87fbb5b31236629c046247f5cf35856932fad86..1a19fa61162274b9c7920f3404895d1638f4ba50 100644 (file)
@@ -328,13 +328,8 @@ ls_LDADD += $(LIB_CLOCK_GETTIME)
 pr_LDADD += $(LIB_CLOCK_GETTIME)
 touch_LDADD += $(LIB_CLOCK_GETTIME)
 
-# for gethrxtime, randint, randread, gen_tempname, mkstemp
+# for gethrxtime
 dd_LDADD += $(LIB_GETHRXTIME)
-mktemp_LDADD += $(LIB_GETHRXTIME)
-shred_LDADD += $(LIB_GETHRXTIME)
-shuf_LDADD += $(LIB_GETHRXTIME)
-sort_LDADD += $(LIB_GETHRXTIME)
-tac_LDADD += $(LIB_GETHRXTIME)
 
 # for cap_get_file
 ls_LDADD += $(LIB_CAP)