xref: /freebsd/lib/libsys/getpagesizes.3 (revision 1edb7116)
1.\" Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd September 21, 2009
26.Dt GETPAGESIZES 3
27.Os
28.Sh NAME
29.Nm getpagesizes
30.Nd "get system page sizes"
31.Sh LIBRARY
32.Lb libc
33.Sh SYNOPSIS
34.In sys/mman.h
35.Ft int
36.Fn getpagesizes "size_t pagesize[]" "int nelem"
37.Sh DESCRIPTION
38The
39.Fn getpagesizes
40function retrieves page size information from the system.
41When it is called with
42.Fa pagesize
43specified as
44.Dv NULL
45and
46.Fa nelem
47specified as 0, it returns the number of distinct page sizes that are
48supported by the system.
49Otherwise, it assigns up to
50.Fa nelem
51of the system-supported page sizes to consecutive elements of the
52array referenced by
53.Fa pagesize .
54These page sizes are expressed in bytes.
55In this case,
56.Fn getpagesizes
57returns the number of such page sizes that it assigned to the array.
58.Sh RETURN VALUES
59If successful, the
60.Fn getpagesizes
61function returns either the number of page sizes that are supported by
62the system or the number of supported page sizes that it assigned to
63the array referenced by
64.Fa pagesize .
65Otherwise, it returns the value\~\-1 and sets
66.Va errno
67to indicate the error.
68.Sh ERRORS
69The
70.Fn getpagesizes
71function will succeed unless:
72.Bl -tag -width Er
73.It Bq Er EINVAL
74The
75.Fa pagesize
76argument is
77.Dv NULL
78and the
79.Fa nelem
80argument is non-zero.
81.It Bq Er EINVAL
82The
83.Fa nelem
84argument is less than zero.
85.El
86.Sh SEE ALSO
87.Xr getpagesize 3
88.Sh HISTORY
89The
90.Fn getpagesizes
91function first appeared in Solaris 9.
92This manual page was written in conjunction with a new but compatible
93implementation that was first released in
94.Fx 7.3 .
95.Sh AUTHORS
96This manual page was written by
97.An Alan L. Cox Aq Mt alc@cs.rice.edu .
98