mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
configure: Check for mprotect(2).
This commit is contained in:
parent
d029de6a7a
commit
e9fe4f33bb
2 changed files with 13 additions and 0 deletions
|
@ -1188,6 +1188,7 @@ AC_CHECK_FUNCS([ \
|
||||||
mlock \
|
mlock \
|
||||||
mlock2 \
|
mlock2 \
|
||||||
mmap \
|
mmap \
|
||||||
|
mprotect \
|
||||||
msync \
|
msync \
|
||||||
posix_fadvise \
|
posix_fadvise \
|
||||||
posix_madvise \
|
posix_madvise \
|
||||||
|
|
|
@ -138,6 +138,7 @@ catch(const std::exception &e)
|
||||||
void
|
void
|
||||||
ircd::allocator::readonly(const mutable_buffer &buf,
|
ircd::allocator::readonly(const mutable_buffer &buf,
|
||||||
const bool enable)
|
const bool enable)
|
||||||
|
#if defined(HAVE_MPROTECT)
|
||||||
{
|
{
|
||||||
const int prot
|
const int prot
|
||||||
{
|
{
|
||||||
|
@ -149,7 +150,13 @@ ircd::allocator::readonly(const mutable_buffer &buf,
|
||||||
void *const ptr(mutable_cast(data(buf)));
|
void *const ptr(mutable_cast(data(buf)));
|
||||||
sys::call(::mprotect, ptr, size(buf), prot);
|
sys::call(::mprotect, ptr, size(buf), prot);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
#warning "mprotect(2) not available for this compilation."
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_MPROTECT)
|
||||||
void
|
void
|
||||||
ircd::allocator::protect(const const_buffer &buf,
|
ircd::allocator::protect(const const_buffer &buf,
|
||||||
const bool enable)
|
const bool enable)
|
||||||
|
@ -164,6 +171,11 @@ ircd::allocator::protect(const const_buffer &buf,
|
||||||
void *const ptr(mutable_cast(data(buf)));
|
void *const ptr(mutable_cast(data(buf)));
|
||||||
sys::call(::mprotect, ptr, size(buf), prot);
|
sys::call(::mprotect, ptr, size(buf), prot);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
#warning "mprotect(2) not available for this compilation."
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ircd::allocator::sync(const const_buffer &buf,
|
ircd::allocator::sync(const const_buffer &buf,
|
||||||
|
|
Loading…
Reference in a new issue