On Thu, Sep 27, 2007 at 05:15:04PM -0300, Henrique de Moraes Holschuh wrote: > On Thu, 27 Sep 2007, Maupard Pierre wrote: > > the computer I am usig rngd is an embedded system and I cant afford for > > the hard drive to spin up hourly in order to print out the rngd entropy > > report to the syslog. Could you please add a switch to turn off logging > > altogether or at least some way to set a larger time interval between > > reports ? > > You could switch any useless logging off using a proper syslog daemon, btw. > I suggest you try something more modern than sysklogd :-) > > > If I have some free time Ill try to look the source myself and maybe > > submit a patch. > > Plese do. It should be trivial to fix it in the source, actually. Also, > look at the one in experimental, I don't recall if it has an option to tweak > the reports, but it just might. > > -- > "One disk to rule them all, One disk to find them. One disk to bring > them all and in the darkness grind them. In the Land of Redmond > where the shadows lie." -- The Silicon Valley Tarot > Henrique Holschuh
Hi again, here is a quick patch, kept the default value of 3600s if no interval is set. -- Pierre MAUPARD EFREI P2010 B1 Responsable serveur WEDUS Responsable projo ASIANEFREI Tresorier EFREI LINUX
diff -ru rng-tools-2-unofficial-mt.10/rngd.c rng-tools-2-unofficial-mt.10.new/rngd.c --- rng-tools-2-unofficial-mt.10/rngd.c 2005-05-11 11:43:18.000000000 +0200 +++ rng-tools-2-unofficial-mt.10.new/rngd.c 2007-09-28 20:33:12.000000000 +0200 @@ -71,8 +71,6 @@ * Globals */ -#define RNGD_STAT_SLEEP_TIME 3600 - /* Statistics */ struct rng_stats rng_stats; @@ -150,6 +148,10 @@ "bits of entropy are available in the pool. n can be the absolute " "number of bits, or a percentage of the pool size (default: 50%), " "0 <= n <= kernel random pool size, or 0% <= n <= 100%" }, + + { "stats-interval", 'S', "n", 0, + "Write stats to output channel every n seconds. (default: 3600)," + "10 <= n <= UINT_MAX" }, { 0 }, }; @@ -164,6 +166,7 @@ .daemon = 1, .rng_entropy = 1.0, .rng_buffers = 3, + .stats_interval = 3600, }; struct arguments *arguments = &default_arguments; @@ -233,6 +236,16 @@ static unsigned int seen_opt = 0; switch(key) { + case 'S': { + long int n; + char *p; + n = strtol(arg, &p, 10); + if ((p == arg) || (*p != 0) || (n < 10) || (n >= UINT_MAX)) + argp_usage(state); + else + arguments->stats_interval = n; + break; + } case 'o': arguments->random_name = arg; break; @@ -608,12 +621,10 @@ * All we can do now is spin around waiting for a hit to the head. * Dump stats every hour, and at exit... */ - sleeptime = RNGD_STAT_SLEEP_TIME; + sleeptime = arguments->stats_interval; while (!gotsigterm) { - sleeptime = sleep(sleeptime); - if ((sleeptime == 0) || gotsigusr1 || gotsigterm) { + if (!sleep(sleeptime) || gotsigusr1 || gotsigterm) { dump_rng_stats(); - sleeptime = RNGD_STAT_SLEEP_TIME; gotsigusr1 = 0; } } diff -ru rng-tools-2-unofficial-mt.10/rngd.h rng-tools-2-unofficial-mt.10.new/rngd.h --- rng-tools-2-unofficial-mt.10/rngd.h 2004-11-02 06:32:58.000000000 +0100 +++ rng-tools-2-unofficial-mt.10.new/rngd.h 2007-09-28 20:33:13.000000000 +0200 @@ -59,6 +59,7 @@ double rng_entropy; int rng_buffers; + int stats_interval; }; extern struct arguments *arguments;