diff options
author | lloyd <[email protected]> | 2014-01-10 03:41:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-10 03:41:59 +0000 |
commit | 6894dca64c04936d07048c0e8cbf7e25858548c3 (patch) | |
tree | 5d572bfde9fe667dab14e3f04b5285a85d8acd95 /src/lib/entropy/beos_stats | |
parent | 9efa3be92442afb3d0b69890a36c7f122df18eda (diff) |
Move lib into src
Diffstat (limited to 'src/lib/entropy/beos_stats')
-rw-r--r-- | src/lib/entropy/beos_stats/es_beos.cpp | 63 | ||||
-rw-r--r-- | src/lib/entropy/beos_stats/es_beos.h | 28 | ||||
-rw-r--r-- | src/lib/entropy/beos_stats/info.txt | 17 |
3 files changed, 108 insertions, 0 deletions
diff --git a/src/lib/entropy/beos_stats/es_beos.cpp b/src/lib/entropy/beos_stats/es_beos.cpp new file mode 100644 index 000000000..e514eb121 --- /dev/null +++ b/src/lib/entropy/beos_stats/es_beos.cpp @@ -0,0 +1,63 @@ +/* +* BeOS EntropySource +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/internal/es_beos.h> + +#include <kernel/OS.h> +#include <kernel/image.h> +#include <interface/InterfaceDefs.h> + +namespace Botan { + +/** +* BeOS entropy poll +*/ +void BeOS_EntropySource::poll(Entropy_Accumulator& accum) + { + system_info info_sys; + get_system_info(&info_sys); + accum.add(info_sys, 2); + + key_info info_key; // current state of the keyboard + get_key_info(&info_key); + accum.add(info_key, 0); + + team_info info_team; + int32 cookie_team = 0; + + while(get_next_team_info(&cookie_team, &info_team) == B_OK) + { + accum.add(info_team, 2); + + team_id id = info_team.team; + int32 cookie = 0; + + thread_info info_thr; + while(get_next_thread_info(id, &cookie, &info_thr) == B_OK) + accum.add(info_thr, 1); + + cookie = 0; + image_info info_img; + while(get_next_image_info(id, &cookie, &info_img) == B_OK) + accum.add(info_img, 1); + + cookie = 0; + sem_info info_sem; + while(get_next_sem_info(id, &cookie, &info_sem) == B_OK) + accum.add(info_sem, 1); + + cookie = 0; + area_info info_area; + while(get_next_area_info(id, &cookie, &info_area) == B_OK) + accum.add(info_area, 2); + + if(accum.polling_goal_achieved()) + break; + } + } + +} diff --git a/src/lib/entropy/beos_stats/es_beos.h b/src/lib/entropy/beos_stats/es_beos.h new file mode 100644 index 000000000..5ccb430a5 --- /dev/null +++ b/src/lib/entropy/beos_stats/es_beos.h @@ -0,0 +1,28 @@ +/* +* BeOS EntropySource +* (C) 1999-2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_ENTROPY_SRC_BEOS_H__ +#define BOTAN_ENTROPY_SRC_BEOS_H__ + +#include <botan/entropy_src.h> + +namespace Botan { + +/** +* BeOS Entropy Source +*/ +class BeOS_EntropySource : public EntropySource + { + private: + std::string name() const { return "BeOS Statistics"; } + + void poll(Entropy_Accumulator& accum); + }; + +} + +#endif diff --git a/src/lib/entropy/beos_stats/info.txt b/src/lib/entropy/beos_stats/info.txt new file mode 100644 index 000000000..9ae527f49 --- /dev/null +++ b/src/lib/entropy/beos_stats/info.txt @@ -0,0 +1,17 @@ +define ENTROPY_SRC_BEOS 20131128 + +<source> +es_beos.cpp +</source> + +<header:internal> +es_beos.h +</header:internal> + +<os> +haiku +</os> + +<libs> +haiku -> root,be +</libs> |