0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-18 10:53:48 +02:00

configure: Check for mprotect(2).

This commit is contained in:
Jason Volk 2022-02-21 11:03:21 -08:00
parent d029de6a7a
commit e9fe4f33bb
2 changed files with 13 additions and 0 deletions

View file

@ -1188,6 +1188,7 @@ AC_CHECK_FUNCS([ \
mlock \
mlock2 \
mmap \
mprotect \
msync \
posix_fadvise \
posix_madvise \

View file

@ -138,6 +138,7 @@ catch(const std::exception &e)
void
ircd::allocator::readonly(const mutable_buffer &buf,
const bool enable)
#if defined(HAVE_MPROTECT)
{
const int prot
{
@ -149,7 +150,13 @@ ircd::allocator::readonly(const mutable_buffer &buf,
void *const ptr(mutable_cast(data(buf)));
sys::call(::mprotect, ptr, size(buf), prot);
}
#else
{
#warning "mprotect(2) not available for this compilation."
}
#endif
#if defined(HAVE_MPROTECT)
void
ircd::allocator::protect(const const_buffer &buf,
const bool enable)
@ -164,6 +171,11 @@ ircd::allocator::protect(const const_buffer &buf,
void *const ptr(mutable_cast(data(buf)));
sys::call(::mprotect, ptr, size(buf), prot);
}
#else
{
#warning "mprotect(2) not available for this compilation."
}
#endif
size_t
ircd::allocator::sync(const const_buffer &buf,