1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 02:25:14 -07:00

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:
Lev Serebryakov 2016-05-18 23:04:09 +03:00
parent f01299a91b
commit 7a4c4459f8

View File

@ -50,6 +50,13 @@
#if defined(HAVE_ALIGNED_MALLOC) && (defined(WINAPI_DESKTOP) || defined(HAVE_MPROTECT))
# define HAVE_PAGE_PROTECTION
#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 unsigned char canary[CANARY_SIZE];