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