Blob Blame History Raw
.\"                                      Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH GETPAGESIZES 3 "October 10, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh        disable hyphenation
.\" .hy        enable hyphenation
.\" .ad l      left justify
.\" .ad b      justify to both left and right margins
.\" .nf        disable filling
.\" .fi        enable filling
.\" .br        insert line break
.\" .sp <n>    insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
getpagesizes - Get the system supported huge page sizes
.SH SYNOPSIS
.B #include <hugetlbfs.h>
.br

.br
int getpagesizes(long pagesizes[], int n_elem);

.SH DESCRIPTION

The getpagesizes() function returns either the number of system supported
page sizes or the sizes  themselves. If \fBpagesizes\fP is NULL and
\fBn_elem\fP is 0, then the number of pages the system supports is
returned. Otherwise, \fBpagesizes\fP is filled with at most \fBn_elem\fP
page sizes.

.SH RETURN VALUE

On success, either the number of page sizes supported by the system or the
number of page sizes stored in \fBpagesizes\fP is returned. On failure,
-1 is returned and errno is set appropriately.

.SH ERRORS

.TP
.B EINVAL
\fBn_elem\fP is less than zero or \fBn_elem\fP is greater than zero and
\fBpagesizes\fP is NULL.

.PP

Also see opendir(3) for other possible values for errno. This error occurs
when the sysfs directory exists but cannot be opened.

.SH 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 \fBlibhugetlbfs\fP, hugetlbfs_find_path_for_size() can be called on a
specific size to see if a mount point is configured.

.SH SEE ALSO
.I oprofile(1),
.I opendir(3),
.I gethugepagesizes(3),
.I libhugetlbfs(7)

.SH AUTHORS
libhugetlbfs was written by various people on the libhugetlbfs-devel
mailing list.