getpagesize() vs. sysconf(_SC_PAGESIZE)
Asked Answered
L

1

8

Both in general and with regard to cross-platform support, is one function -- getpagesize() vs. sysconf(_SC_PAGESIZE) -- more reliable than the other?

Laundes answered 12/5, 2016 at 17:29 Comment(0)
L
8

After some additional searching, I've discovered that getpagesize() was deprecated in POSIX issue 6, and removed in POSIX issue 7. It's recommended to use sysconf(_SC_PAGESIZE) instead.

Laundes answered 12/5, 2016 at 17:41 Comment(1)
Thanks! This is also what man getpagesize says: "In SUSv2 the getpagesize() call is labeled LEGACY, and in POSIX.1-2001 it has been dropped" and: "Portable applications should employ sysconf(_SC_PAGESIZE) instead of getpagesize()"Inhalator

© 2022 - 2024 — McMap. All rights reserved.