diff options
author | 2016-03-20 02:32:39 +0000 | |
---|---|---|
committer | 2016-03-20 02:32:39 +0000 | |
commit | 5af055cd66b5450a4935ae30e5716331ca3b13d5 (patch) | |
tree | 6fa66dcb9c9653fb1659c185234178493d593968 /lib/libc/gen/getpagesize.c | |
parent | Prepare for future ld.so/libc bump: update <tib.h> with the definitions (diff) | |
download | wireguard-openbsd-5af055cd66b5450a4935ae30e5716331ca3b13d5.tar.xz wireguard-openbsd-5af055cd66b5450a4935ae30e5716331ca3b13d5.zip |
Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc to process the auxv
and to either register the ld.so cleanup function (in dynamic links) or
initialize environ and __progname and do MC_DISABLE_KBIND (in static links).
In libc, get pagesize from auxv; cache that between getpagesize() and
sysconf(_SC_PAGESIZE)
ok mpi@ "good time" deraadt@
Diffstat (limited to 'lib/libc/gen/getpagesize.c')
-rw-r--r-- | lib/libc/gen/getpagesize.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libc/gen/getpagesize.c b/lib/libc/gen/getpagesize.c index 3c81d64209e..aa2919032fa 100644 --- a/lib/libc/gen/getpagesize.c +++ b/lib/libc/gen/getpagesize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getpagesize.c,v 1.8 2015/09/12 14:56:50 guenther Exp $ */ +/* $OpenBSD: getpagesize.c,v 1.9 2016/03/20 02:32:40 guenther Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -35,18 +35,16 @@ int getpagesize(void) { - static int pagsz; - - if (pagsz == 0) { + if (_pagesize == 0) { int mib[2]; size_t size; mib[0] = CTL_HW; mib[1] = HW_PAGESIZE; - size = sizeof pagsz; - if (sysctl(mib, 2, &pagsz, &size, NULL, 0) == -1) + size = sizeof _pagesize; + if (sysctl(mib, 2, &_pagesize, &size, NULL, 0) == -1) return (-1); } - return (pagsz); + return (_pagesize); } DEF_WEAK(getpagesize); |