Use getpagesize(3) under FreeBSD.

This avoids sysctl(2) syscall during binary startup, using the value
passed in the ELF aux vector instead.

Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
This commit is contained in:
Edward Tomasz Napierala 2017-10-22 12:04:59 +01:00 committed by David Goldblatt
parent 58eba024c0
commit d591df05c8

View File

@ -357,6 +357,8 @@ os_page_detect(void) {
SYSTEM_INFO si; SYSTEM_INFO si;
GetSystemInfo(&si); GetSystemInfo(&si);
return si.dwPageSize; return si.dwPageSize;
#elif defined(__FreeBSD__)
return getpagesize();
#else #else
long result = sysconf(_SC_PAGESIZE); long result = sysconf(_SC_PAGESIZE);
if (result == -1) { if (result == -1) {