aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ml_unix/mlock.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-18 18:33:19 +0000
committerlloyd <[email protected]>2006-05-18 18:33:19 +0000
commita2c99d3270eb73ef2db5704fc54356c6b75096f8 (patch)
treead3d6c4fcc8dd0f403f8105598943616246fe172 /modules/ml_unix/mlock.cpp
Initial checkin1.5.6
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);
+ }
+
+}