Botan  1.10.9
mlock.h
Go to the documentation of this file.
1 /*
2 * Memory Locking Functions
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_MLOCK_H__
9 #define BOTAN_MLOCK_H__
10 
11 #include <botan/types.h>
12 
13 namespace Botan {
14 
15 /**
16 * Check if we can at least potentially lock memory
17 */
18 bool has_mlock();
19 
20 /**
21 * Lock memory into RAM if possible
22 * @param addr the start of the memory block
23 * @param length the length of the memory block in bytes
24 * @returns true if successful, false otherwise
25 */
26 bool lock_mem(void* addr, size_t length);
27 
28 /**
29 * Unlock memory locked with lock_mem()
30 * @param addr the start of the memory block
31 * @param length the length of the memory block in bytes
32 */
33 void unlock_mem(void* addr, size_t length);
34 
35 }
36 
37 #endif
bool has_mlock()
Definition: mlock.cpp:19
void unlock_mem(void *ptr, size_t bytes)
Definition: mlock.cpp:45
bool lock_mem(void *ptr, size_t bytes)
Definition: mlock.cpp:31