panthema / 2009 / cryptote / cryptote-0.5.390 / libenctain / botan-1.6 / modules / ml_unix / mlock_unix.cpp (Download File)
/*************************************************
* Memory Locking Functions Source File           *
* (C) 1999-2007 The Botan Project                *
*************************************************/

#include "botan-1.6/include/util.h"

#ifndef _POSIX_C_SOURCE
  #define _POSIX_C_SOURCE 199309
#endif

#include <sys/types.h>
#include <sys/mman.h>

namespace Enctain {
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);
   }

}
}