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
This commit is contained in:
Andrew Turner 2022-04-07 17:20:04 +01:00
parent 271f6d52a6
commit 86c500937c

View File

@ -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];