1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH GETPAGESIZE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
27 getpagesize \- get memory page size
29 .B #include <unistd.h>
31 .B int getpagesize(void);
34 Feature Test Macro Requirements for glibc (see
35 .BR feature_test_macros (7)):
45 _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE\ >=\ 200112L)
48 From glibc 2.12 to 2.19:
50 _BSD_SOURCE || ! (_POSIX_C_SOURCE\ >=\ 200112L)
54 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
55 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
62 returns the number of bytes in a memory page,
63 where "page" is a fixed-length block,
64 the unit for memory allocation and file mapping performed by
67 .\" This call first appeared in 4.2BSD.
72 call is labeled LEGACY, and in POSIX.1-2001
74 HP-UX does not have this call.
76 Portable applications should employ
77 .I sysconf(_SC_PAGESIZE)
84 long sz = sysconf(_SC_PAGESIZE);
88 (Most systems allow the synonym
95 is present as a Linux system call depends on the architecture.
96 If it is, it returns the kernel symbol
98 whose value depends on the architecture and machine model.
99 Generally, one uses binaries that are dependent on the architecture but not
100 on the machine model, in order to have a single binary
101 distribution per architecture.
102 This means that a user program
105 at compile time from a header file,
106 but use an actual system call, at least for those architectures
107 (like sun4) where this dependency exists.
108 Here glibc 2.0 fails because its
110 returns a statically derived value, and does not use a system call.
111 Things are OK in glibc 2.1.