Skip to content

Centralize page size info in platform abstraction

Page size is currently hardcoded independently in header::unistd and in ld_so. This MR centralizes page size info in a new method, getpagesize(), in the Pal trait.

dlmalloc also needs to know about page size but will grab it the canonical POSIX way, sysconf(_SC_PAGE_SIZE).

The new getpagesize() method does not directly correspond to a POSIX-specified function. Internally in relibc, page size is generally needed as a usize, which is what the implemented method provides. The getpagesize name already exists as a legacy POSIX function returning an int, and it seems the Linux kernel on some platforms (alpha, ia64, m68k, sparc) has a getpagesize syscall, returning either int or long.

For maximum flexibility, I've implemented a method rather than an associated constant. Let me know if you disagree with the design decisions here.

Merge request reports