]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl> |
2 | .\" | |
5fbde956 | 3 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da | 4 | .\" |
4c1c5274 | 5 | .TH getpagesize 2 (date) "Linux man-pages (unreleased)" |
fea681da MK |
6 | .SH NAME |
7 | getpagesize \- get memory page size | |
c18bf8b2 AC |
8 | .SH LIBRARY |
9 | Standard C library | |
8fc3b2cf | 10 | .RI ( libc ", " \-lc ) |
fea681da | 11 | .SH SYNOPSIS |
4653ec6e | 12 | .nf |
fea681da | 13 | .B #include <unistd.h> |
c6d039a3 | 14 | .P |
fea681da | 15 | .B int getpagesize(void); |
4653ec6e | 16 | .fi |
c6d039a3 | 17 | .P |
d39ad78f | 18 | .RS -4 |
cc4615cc MK |
19 | Feature Test Macro Requirements for glibc (see |
20 | .BR feature_test_macros (7)): | |
d39ad78f | 21 | .RE |
c6d039a3 | 22 | .P |
cc4615cc | 23 | .BR getpagesize (): |
c8fab0f0 | 24 | .nf |
3754620f | 25 | Since glibc 2.20: |
9e8a25d7 | 26 | _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L) |
75c018a1 | 27 | glibc 2.12 to glibc 2.19: |
9e8a25d7 MK |
28 | _BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L) |
29 | Before glibc 2.12: | |
5c10d2c5 MK |
30 | _BSD_SOURCE || _XOPEN_SOURCE >= 500 |
31 | .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED | |
c8fab0f0 | 32 | .fi |
fea681da MK |
33 | .SH DESCRIPTION |
34 | The function | |
63aa9df0 | 35 | .BR getpagesize () |
e13cd31c MK |
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). | |
c1e10426 EH |
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. | |
3113c7f3 | 53 | .SH STANDARDS |
4131356c AC |
54 | None. |
55 | .SH HISTORY | |
56 | This call first appeared in 4.2BSD. | |
fea681da MK |
57 | SVr4, 4.4BSD, SUSv2. |
58 | In SUSv2 the | |
63aa9df0 | 59 | .BR getpagesize () |
c1e10426 EH |
60 | call was labeled LEGACY, |
61 | and it was removed in POSIX.1-2001. | |
c6d039a3 | 62 | .P |
c1e10426 | 63 | glibc 2.0 returned a constant |
74cd9f69 | 64 | even on architectures with multiple page sizes. |
47297adb | 65 | .SH SEE ALSO |
fea681da MK |
66 | .BR mmap (2), |
67 | .BR sysconf (3) |