getpagesizes - Get the system supported huge page sizes
Contents
Description
The getpagesizes() function returns either the number of system supported page sizes or the sizes
themselves. If pagesizes is NULL and n_elem is 0, then the number of pages the system supports is
returned. Otherwise, pagesizes is filled with at most n_elem page sizes.
Errors
EINVALn_elem is less than zero or n_elem is greater than zero and pagesizes is NULL.
Also see opendir(3) for other possible values for errno. This error occurs when the sysfs directory
exists but cannot be opened.
Name
getpagesizes - Get the system supported huge page sizes
Notes
This call will return all page sizes as reported by the kernel. Not all of these sizes may be usable by
the programmer since mount points may not be available for the huge page sizes. To test whether a size
will be usable by libhugetlbfs, hugetlbfs_find_path_for_size() can be called on a specific size to see if
a mount point is configured.
Return Value
On success, either the number of page sizes supported by the system or the number of page sizes stored in
pagesizes is returned. On failure, -1 is returned and errno is set appropriately.
See Also
oprofile(1),opendir(3),gethugepagesizes(3),libhugetlbfs(7)
Synopsis
#include<hugetlbfs.h>
int getpagesizes(long pagesizes[], int n_elem);
