From 86c500937c4514dda2319f193c4ccc043ffde2b3 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Thu, 7 Apr 2022 17:20:04 +0100 Subject: [PATCH] Use the existing page size in libthr Rather than calling getpagesize() twice use the value saved after the first call to size a mmap allocation. Reviewed by: kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34983 --- lib/libthr/thread/thr_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c index 1e6338657204..0b83b2dd5ac9 100644 --- a/lib/libthr/thread/thr_kern.c +++ b/lib/libthr/thread/thr_kern.c @@ -158,7 +158,7 @@ _thr_alloc_wake_addr(void) unsigned i; unsigned pagesize = getpagesize(); struct wake_addr *pp = (struct wake_addr *) - mmap(NULL, getpagesize(), PROT_READ|PROT_WRITE, + mmap(NULL, pagesize, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); for (i = 1; i < pagesize/sizeof(struct wake_addr); ++i) pp[i].link = &pp[i+1];