Support madvise() on FreeBSD
FreeBSD have madvise() behaviors equivalent to MADV_DONTDUMP and MADV_DODUMP but with its own names. Add definitions for these behaviors used in sodium_mlock() and sodium_munlock() if FreeBSD names are found and Linux ones don't.
This commit is contained in:
parent
f01299a91b
commit
7a4c4459f8
@ -50,6 +50,13 @@
|
|||||||
#if defined(HAVE_ALIGNED_MALLOC) && (defined(WINAPI_DESKTOP) || defined(HAVE_MPROTECT))
|
#if defined(HAVE_ALIGNED_MALLOC) && (defined(WINAPI_DESKTOP) || defined(HAVE_MPROTECT))
|
||||||
# define HAVE_PAGE_PROTECTION
|
# define HAVE_PAGE_PROTECTION
|
||||||
#endif
|
#endif
|
||||||
|
/* FreeBSD defines these with its own names */
|
||||||
|
if !defined(MADV_DONTDUMP) && defined(HAVE_MADVISE)
|
||||||
|
# define MADV_DONTDUMP MADV_NOCORE
|
||||||
|
#endif
|
||||||
|
if !defined(MADV_DODUMP) && defined(HAVE_MADVISE)
|
||||||
|
# define MADV_DODUMP MADV_CORE
|
||||||
|
#endif
|
||||||
|
|
||||||
static size_t page_size;
|
static size_t page_size;
|
||||||
static unsigned char canary[CANARY_SIZE];
|
static unsigned char canary[CANARY_SIZE];
|
||||||
|
Loading…
Reference in New Issue
Block a user