getpagesizes(3)

getpagesizes3

Get system page sizes

Usage

#include <sys/mman.h>

int

getpagesizes(size_t pagesize[], int nelem);

Library

Standard C Library (libc, -lc)

Overview

The getpagesizes() function retrieves page size information from the system. When it is called with pagesize specified as NULL and nelem specified as 0, it returns the number of distinct page sizes that are supported by the system. Otherwise, it assigns up to nelem of the system-supported page sizes to consecutive elements of the array referenced by pagesize. These page sizes are expressed in bytes. In this case, getpagesizes() returns the number of such page sizes that it assigned to the array.

Return values

If successful, the getpagesizes() function returns either the number of page sizes that are supported by the system or the number of supported page sizes that it assigned to the array referenced by pagesize. Otherwise, it returns the value -1 and sets errno to indicate the error.

Errors

The getpagesizes() function will succeed unless:

[EINVAL]

The pagesize argument is NULL and the nelem argument is non-zero.

[EINVAL]

The nelem argument is less than zero.

Releases

40 releases since FreeBSD 7.3-RELEASE; the text changed 26 times.

  1. 7.3
  2. 7.4
  3. 8.1
  4. 8.2
  5. 8.3
  6. 8.4
  7. 9.0
  8. 9.1
  9. 9.2
  10. 9.3
  11. 10.0
  12. 10.1
  13. 10.2
  14. 10.3
  15. 10.4
  16. 11.0
  17. 11.1
  18. 11.2
  19. 11.3
  20. 11.4
  21. 12.0
  22. 12.1
  23. 12.2
  24. 12.3
  25. 12.4
  26. 13.0–13.2
  27. 13.3–16.0

History

The getpagesizes() function first appeared in Solaris 9. This manual page was written in conjunction with a new but compatible implementation that was first released in FreeBSD 7.3.

Authors

This manual page was written by Alan L. Cox ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.