mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Make mlock() and munlock() portable to systems that require the address to be on a page boundary.
This commit is contained in:
parent
c1aacf0be3
commit
a48c671957
@ -38,6 +38,18 @@ typedef unsigned long long uint64;
|
|||||||
#define munlock(p, n) VirtualUnlock((p), (n));
|
#define munlock(p, n) VirtualUnlock((p), (n));
|
||||||
#else
|
#else
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <limits.h>
|
||||||
|
/* This comes from limits.h if it's not defined there set a sane default */
|
||||||
|
#ifndef PAGESIZE
|
||||||
|
#include <unistd.h>
|
||||||
|
#define PAGESIZE sysconf(_SC_PAGESIZE)
|
||||||
|
#endif
|
||||||
|
#define mlock(a,b) \
|
||||||
|
mlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
|
||||||
|
(((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
|
||||||
|
#define munlock(a,b) \
|
||||||
|
munlock(((void *)(((size_t)(a)) & (~((PAGESIZE)-1)))),\
|
||||||
|
(((((size_t)(a)) + (b) - 1) | ((PAGESIZE) - 1)) + 1) - (((size_t)(a)) & (~((PAGESIZE) - 1))))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CScript;
|
class CScript;
|
||||||
|
Loading…
Reference in New Issue
Block a user