aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/unix_procs/unix_procs.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-11-10 16:26:26 +0000
committerlloyd <[email protected]>2013-11-10 16:26:26 +0000
commit1f93e819b251483fa2e4e53494fedf34c5f451b2 (patch)
tree70091cef2fb7b32eed2fcc3afa07ec558259456e /src/entropy/unix_procs/unix_procs.cpp
parent8758cc592f01050f13618c24491acc86f36fc874 (diff)
Split off Unix_EntropySource's fast_poll to a new source
Diffstat (limited to 'src/entropy/unix_procs/unix_procs.cpp')
-rw-r--r--src/entropy/unix_procs/unix_procs.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/entropy/unix_procs/unix_procs.cpp b/src/entropy/unix_procs/unix_procs.cpp
index 8d7bf4e48..8a409ad9d 100644
--- a/src/entropy/unix_procs/unix_procs.cpp
+++ b/src/entropy/unix_procs/unix_procs.cpp
@@ -63,32 +63,13 @@ Unix_EntropySource::Unix_EntropySource(const std::vector<std::string>& trusted_p
{
}
-void Unix_EntropySource::fast_poll(Entropy_Accumulator& accum)
+void UnixProcessInfo_EntropySource::poll(Entropy_Accumulator& accum)
{
- const char* stat_targets[] = {
- "/",
- "/tmp",
- "/var/tmp",
- "/usr",
- "/home",
- "/etc/passwd",
- ".",
- "..",
- nullptr
- };
-
- for(size_t i = 0; stat_targets[i]; i++)
- {
- struct stat statbuf;
- clear_mem(&statbuf, 1);
- ::stat(stat_targets[i], &statbuf);
- accum.add(&statbuf, sizeof(statbuf), 0.0);
- }
-
accum.add(::getpid(), 0.0);
accum.add(::getppid(), 0.0);
accum.add(::getuid(), 0.0);
accum.add(::getgid(), 0.0);
+ accum.add(::getsid(0), 0.0);
accum.add(::getpgrp(), 0.0);
struct ::rusage usage;
@@ -196,8 +177,6 @@ const std::vector<std::string>& Unix_EntropySource::next_source()
void Unix_EntropySource::poll(Entropy_Accumulator& accum)
{
- //fast_poll(accum);
-
// refuse to run as root (maybe instead setuid to nobody before exec?)
// fixme: this should also check for setgid
if(::getuid() == 0 || ::geteuid() == 0)