Debian Codegraph @

upstream/debian-trixie/man2/getpagesize.2

raw
1 .\" Copyright (C) 2001 Andries Brouwer <[email protected]>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH getpagesize 2 2024-05-02 "Linux man-pages 6.9.1"
6 .SH NAME
7 getpagesize \- get memory page size
8 .SH LIBRARY
9 Standard C library
10 .RI ( libc ", " \-lc )
11 .SH SYNOPSIS
12 .nf
13 .B #include <unistd.h>
14 .P
15 .B int getpagesize(void);
16 .fi
17 .P
18 .RS -4
19 Feature Test Macro Requirements for glibc (see
20 .BR feature_test_macros (7)):
21 .RE
22 .P
23 .BR getpagesize ():
24 .nf
25 Since glibc 2.20:
26 _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
27 glibc 2.12 to glibc 2.19:
28 _BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
29 Before glibc 2.12:
30 _BSD_SOURCE || _XOPEN_SOURCE >= 500
31 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
32 .fi
33 .SH DESCRIPTION
34 The function
35 .BR getpagesize ()
36 returns the number of bytes in a memory page,
37 where "page" is a fixed-length block,
38 the unit for memory allocation and file mapping performed by
39 .BR mmap (2).
40 .SH VERSIONS
41 A user program should not hard-code a page size,
42 neither as a literal nor using the
43 .B PAGE_SIZE
44 macro,
45 because some architectures support multiple page sizes.
46 .P
47 This manual page is in section 2 because
48 Alpha, SPARC, and SPARC64
49 all have a Linux system call
50 .BR getpagesize ()
51 though other architectures do not,
52 and use the ELF auxiliary vector instead.
53 .SH STANDARDS
54 None.
55 .SH HISTORY
56 This call first appeared in 4.2BSD.
57 SVr4, 4.4BSD, SUSv2.
58 In SUSv2 the
59 .BR getpagesize ()
60 call was labeled LEGACY,
61 and it was removed in POSIX.1-2001.
62 .P
63 glibc 2.0 returned a constant
64 even on architectures with multiple page sizes.
65 .SH SEE ALSO
66 .BR mmap (2),
67 .BR sysconf (3)