aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorlloyd <[email protected]>2007-10-19 13:34:14 +0000
committerlloyd <[email protected]>2007-10-19 13:34:14 +0000
commit15c4cb75243aaf70dadf5c2a8f76332f0a24a7d5 (patch)
tree292d6f373ba940d8d101578820fc19b457e68b9c /modules
parentc9761e6b9773d7eeea3f12c888a782d3bbe33446 (diff)
Add stats of '/', '/tmp', '.', and '..' to the es_unix fast poll.
Use u32bit instead of uint32_t
Diffstat (limited to 'modules')
-rw-r--r--modules/es_unix/es_unix.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/es_unix/es_unix.cpp b/modules/es_unix/es_unix.cpp
index 8c4b8984b..cb2ded840 100644
--- a/modules/es_unix/es_unix.cpp
+++ b/modules/es_unix/es_unix.cpp
@@ -9,6 +9,7 @@
#include <botan/config.h>
#include <algorithm>
#include <sys/time.h>
+#include <sys/stat.h>
#include <sys/resource.h>
#include <unistd.h>
@@ -46,6 +47,16 @@ void Unix_EntropySource::add_sources(const Unix_Program srcs[], u32bit count)
*************************************************/
void Unix_EntropySource::do_fast_poll()
{
+ const char* STAT_TARGETS[] = { "/", "/tmp", ".", "..", 0 };
+
+ for(u32bit j = 0; STAT_TARGETS[j]; j++)
+ {
+ struct stat statbuf;
+ clear_mem(&statbuf, 1);
+ stat(STAT_TARGETS[j], &statbuf);
+ add_bytes(&statbuf, sizeof(statbuf));
+ }
+
add_bytes(getpid());
add_bytes(getppid());
@@ -90,7 +101,7 @@ void Unix_EntropySource::do_slow_poll()
DataSource_Command pipe(sources[j].name_and_args, PATH);
SecureVector<byte> buffer(DEFAULT_BUFFERSIZE);
- uint32_t got_from_src = 0;
+ u32bit got_from_src = 0;
while(!pipe.end_of_data())
{