File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 5050#include <signal.h> /* sig_atomic_t */
5151#include <sys/mman.h> /* see .feature.li in config.h */
5252#include <sys/types.h> /* mmap, munmap */
53- #include <unistd.h> /* getpagesize */
53+ #include <unistd.h> /* sysconf, _SC_PAGESIZE */
5454
5555SRCID (vmix , "$Id$" );
5656
@@ -59,10 +59,11 @@ SRCID(vmix, "$Id$");
5959
6060Size PageSize (void )
6161{
62- int pageSize ;
62+ long pageSize ;
6363
64- /* Find out the operating system page size */
65- pageSize = getpagesize ();
64+ /* Find out the operating system page size
65+ (see design.mps.vm.impl.ix.page.size) */
66+ pageSize = sysconf (_SC_PAGESIZE );
6667
6768 /* Check the page size will fit in a Size. */
6869 AVER ((unsigned long )pageSize <= (unsigned long )(Size )- 1 );
Original file line number Diff line number Diff line change @@ -269,7 +269,13 @@ Unix implementation
269269
270270_`.impl.ix `: In ``vmix.c ``.
271271
272- _`.impl.ix.page.size `: The page size is given by ``getpagesize() ``.
272+ _`.impl.ix.page.size `: The page size is given by
273+ ``sysconf(_SC_PAGESIZE) ``. We avoid ``getpagesize() ``, which is a
274+ legacy function in Posix:
275+
276+ Applications should use the sysconf() function instead.
277+
278+ — `The Single UNIX ® Specification, Version 2 <https://pubs.opengroup.org/onlinepubs/7908799/xsh/getpagesize.html >`__
273279
274280_`.impl.ix.param `: Decodes no keyword arguments.
275281
You can’t perform that action at this time.
0 commit comments