Support AutoConf for posix_madvise and POSIX_MADV_DONTNEED

This commit is contained in:
Jin Qian 2020-10-30 13:54:36 -07:00 committed by David Goldblatt
parent 96a59c3bb5
commit 26c1dc5a3a
2 changed files with 31 additions and 0 deletions

View file

@ -2204,6 +2204,26 @@ case "${host_cpu}" in
fi
;;
esac
else
dnl Check for posix_madvise.
JE_COMPILABLE([posix_madvise], [
#include <sys/mman.h>
], [
posix_madvise((void *)0, 0, 0);
], [je_cv_posix_madvise])
if test "x${je_cv_posix_madvise}" = "xyes" ; then
AC_DEFINE([JEMALLOC_HAVE_POSIX_MADVISE], [ ])
dnl Check for posix_madvise(..., POSIX_MADV_DONTNEED).
JE_COMPILABLE([posix_madvise(..., POSIX_MADV_DONTNEED)], [
#include <sys/mman.h>
], [
posix_madvise((void *)0, 0, POSIX_MADV_DONTNEED);
], [je_cv_posix_madv_dontneed])
if test "x${je_cv_posix_madv_dontneed}" = "xyes" ; then
AC_DEFINE([JEMALLOC_PURGE_POSIX_MADVISE_DONTNEED], [ ])
fi
fi
fi
dnl ============================================================================