aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ml_unix/mlock.cpp
blob: 98214a2154139d3a279b95c19b5f2b0a529d69a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*************************************************
* Memory Locking Functions Source File           *
* (C) 1999-2007 Jack Lloyd                       *
*************************************************/

#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);
   }

}