GETPAGESIZE(3)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… 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 bestie
  • sbrk(2) β€” the syscall era icon
  • getpagesizes(3) β€” plural version, she's got options
  • sysconf(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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms