aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/mlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/mlock.cpp')
-rw-r--r--src/utils/mlock.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils/mlock.cpp b/src/utils/mlock.cpp
index 5d6fc3591..bc6ddc67e 100644
--- a/src/utils/mlock.cpp
+++ b/src/utils/mlock.cpp
@@ -16,6 +16,15 @@
namespace Botan {
+bool has_mlock()
+ {
+ byte buf[4096];
+ if(!lock_mem(&buf, sizeof(buf)))
+ return false;
+ unlock_mem(&buf, sizeof(buf));
+ return true;
+ }
+
/*
* Lock an area of memory into RAM
*/