aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ml_unix/mlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ml_unix/mlock.cpp')
-rw-r--r--modules/ml_unix/mlock.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/ml_unix/mlock.cpp b/modules/ml_unix/mlock.cpp
new file mode 100644
index 000000000..937308739
--- /dev/null
+++ b/modules/ml_unix/mlock.cpp
@@ -0,0 +1,33 @@
+/*************************************************
+* Memory Locking Functions Source File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#include <botan/util.h>
+
+#ifndef _POSIX_C_SOURCE
+ #define _POSIX_C_SOURCE 199309
+#endif
+
+#include <sys/types.h>
+#include <sys/mman.h>
+
+namespace Botan {
+
+/*************************************************
+* Lock an area of memory into RAM *
+*************************************************/
+void lock_mem(void* ptr, u32bit bytes)
+ {
+ mlock(ptr, bytes);
+ }
+
+/*************************************************
+* Unlock a previously locked region of memory *
+*************************************************/
+void unlock_mem(void* ptr, u32bit bytes)
+ {
+ munlock(ptr, bytes);
+ }
+
+}