Check for mmap()
Apparently there exist systems with mprotect(), but not mmap()?
This commit is contained in:
parent
4053f3f788
commit
5be7d047f6
|
@ -34,7 +34,7 @@ AC_SUBST(HB_VERSION)
|
||||||
|
|
||||||
|
|
||||||
# Functions and headers
|
# Functions and headers
|
||||||
AC_CHECK_FUNCS(mprotect sysconf getpagesize)
|
AC_CHECK_FUNCS(mprotect sysconf getpagesize mmap)
|
||||||
AC_CHECK_HEADERS(unistd.h sys/mman.h)
|
AC_CHECK_HEADERS(unistd.h sys/mman.h)
|
||||||
|
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
/* Unit tests for hb-blob.h */
|
/* Unit tests for hb-blob.h */
|
||||||
|
|
||||||
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT)
|
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT) && defined(HAVE_MMAP)
|
||||||
|
|
||||||
# define TEST_MMAP 1
|
# define TEST_MMAP 1
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ free_up_free (fixture_t *fixture)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef TEST_MMAP
|
||||||
static uintptr_t
|
static uintptr_t
|
||||||
get_pagesize (void)
|
get_pagesize (void)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +134,7 @@ free_up_munmap (fixture_t *fixture)
|
||||||
free_up (fixture);
|
free_up (fixture);
|
||||||
munmap (fixture->data, get_pagesize ());
|
munmap (fixture->data, get_pagesize ());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
static void
|
static void
|
||||||
|
@ -164,7 +166,7 @@ fixture_init (fixture_t *fixture, gconstpointer user_data)
|
||||||
free_func = (hb_destroy_func_t) free_up_free;
|
free_func = (hb_destroy_func_t) free_up_free;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if TEST_MMAP
|
#ifdef TEST_MMAP
|
||||||
case HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE:
|
case HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE:
|
||||||
{
|
{
|
||||||
uintptr_t pagesize = get_pagesize ();
|
uintptr_t pagesize = get_pagesize ();
|
||||||
|
|
Loading…
Reference in New Issue