8 #include <botan/internal/mlock.h>
10 #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK)
11 #include <sys/types.h>
13 #elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK)
33 #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK)
34 return (::mlock(static_cast<char*>(ptr), bytes) == 0);
35 #elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK)
36 return (::VirtualLock(ptr, bytes) != 0);
47 #if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK)
48 ::munlock(static_cast<char*>(ptr), bytes);
49 #elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK)
50 ::VirtualUnlock(ptr, bytes);
void unlock_mem(void *ptr, size_t bytes)
bool lock_mem(void *ptr, size_t bytes)