GETPAGESIZE(3)
π GETPAGESIZE(3) β bestie's guide to the manual
Okay so real talk, this one lives in the Library Functions Manual section of your Unix life β the getpagesize page, and it is lowkey iconic for how much chaos one tiny function caused. Buckle up π
β¨ NAME β¨
getpagesize β get system page size. That's it. That's the whole vibe. She tells you how big a page is. Periodt. π
π LIBRARY π
Standard C Library (libc, -lc). So when you link with -lc (which like, you're already doing, bestie, don't even worry), she's right there. π«Ά
π§ SYNOPSIS π§
#include <unistd.h>
int
getpagesize(void);
No arguments. No drama. She takes void and she means it. π
πΈ DESCRIPTION πΈ
So getpagesize() returns the number of bytes in a page. That's the whole function. One number. But the way that number matters?? Chef's kiss. π₯
Page granularity is the granularity of many of the memory management calls β like, basically all your memory girlies are operating at this unit of measurement, so knowing it is genuinely useful, ngl.
β οΈ Key tea: the page size is a system page size and may not be the same as the underlying hardware page size. So don't go assuming your CPU's page size and your system's page size are the same bestie, they are not always matching, and that's just how it is. π
And now the part that lives rent free in my head π β IEEE Std 1003.1-2001 (βPOSIX.1β) removed getpagesize. Removed her!! She's deprecated-adjacent in the standards world, which is giving "still here but on thin ice."
So portable applications should use sysconf(_SC_PAGESIZE) instead. That's the glow-up version. If you want your code to travel well, that's the one to call. βοΈβ¨
π¦ SEE ALSO π¦
pagesize(1)β the command-line bestiesbrk(2)β the syscall era icongetpagesizes(3)β plural version, she's got optionssysconf(3)β the recommended replacement, main character energy π
β HISTORY β
The getpagesize() function appeared in 4.2BSD. Old money. Vintage. We respect her lineage. π°οΈπ
And that's the whole page, bestie β short, sweet, and slightly deprecated. Sending you love from the Debian edition, dated October 17, 2022, page GETPAGESIZE(3) β mwah ππ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms