1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH getpagesize 2 (date) "Linux man-pages (unreleased)"
7 getpagesize \- get memory page size
10 .RI ( libc ", " \-lc )
13 .B #include <unistd.h>
15 .B int getpagesize(void);
19 Feature Test Macro Requirements for glibc (see
20 .BR feature_test_macros (7)):
26 _DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
27 glibc 2.12 to glibc 2.19:
28 _BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
30 _BSD_SOURCE || _XOPEN_SOURCE >= 500
31 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
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
43 This call first appeared in 4.2BSD.
47 call is labeled LEGACY, and in POSIX.1-2001
49 HP-UX does not have this call.
51 Portable applications should employ
52 .I sysconf(_SC_PAGESIZE)
59 long sz = sysconf(_SC_PAGESIZE);
63 (Most systems allow the synonym
70 is present as a Linux system call depends on the architecture.
71 If it is, it returns the kernel symbol
73 whose value depends on the architecture and machine model.
74 Generally, one uses binaries that are dependent on the architecture but not
75 on the machine model, in order to have a single binary
76 distribution per architecture.
77 This means that a user program
80 at compile time from a header file,
81 but use an actual system call, at least for those architectures
82 (like sun4) where this dependency exists.
83 Here glibc 2.0 fails because its
85 returns a statically derived value, and does not use a system call.
86 Things are OK in glibc 2.1.