xref: /trueos/lib/libc/gen/getpagesizes.3 (revision 94d2b7f64912987093f1a98573737a32e4e5d8d1)
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.\" $FreeBSD$
26.\"
27.Dd September 21, 2009
28.Dt GETPAGESIZES 3
29.Os
30.Sh NAME
31.Nm getpagesizes
32.Nd "get system page sizes"
33.Sh LIBRARY
34.Lb libc
35.Sh SYNOPSIS
36.In sys/mman.h
37.Ft int
38.Fn getpagesizes "size_t pagesize[]" "int nelem"
39.Sh DESCRIPTION
40The
41.Fn getpagesizes
42function retrieves page size information from the system.
43When it is called with
44.Fa pagesize
45specified as
46.Dv NULL
47and
48.Fa nelem
49specified as 0, it returns the number of distinct page sizes that are
50supported by the system.
51Otherwise, it assigns up to
52.Fa nelem
53of the system-supported page sizes to consecutive elements of the
54array referenced by
55.Fa pagesize .
56These page sizes are expressed in bytes.
57In this case,
58.Fn getpagesizes
59returns the number of such page sizes that it assigned to the array.
60.Sh RETURN VALUES
61If successful, the
62.Fn getpagesizes
63function returns either the number of page sizes that are supported by
64the system or the number of supported page sizes that it assigned to
65the array referenced by
66.Fa pagesize .
67Otherwise, it returns the value\~\-1 and sets
68.Va errno
69to indicate the error.
70.Sh ERRORS
71The
72.Fn getpagesizes
73function will succeed unless:
74.Bl -tag -width Er
75.It Bq Er EINVAL
76The
77.Fa pagesize
78argument is
79.Dv NULL
80and the
81.Fa nelem
82argument is non-zero.
83.It Bq Er EINVAL
84The
85.Fa nelem
86argument is less than zero.
87.El
88.Sh SEE ALSO
89.Xr getpagesize 3
90.Sh HISTORY
91The
92.Fn getpagesizes
93function first appeared in Solaris 9.
94This manual page was written in conjunction with a new but compatible
95implementation that was first released in
96.Fx 7.3 .
97.Sh AUTHORS
98This manual page was written by
99.An Alan L. Cox Aq alc@cs.rice.edu .
100