GETPAGESIZES(3)

πŸ“¦
version 2.24.0.g1322884 Β· 2 versions
  • 2.24.0.g1322884 Β· debian bookworm, debian trixie, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 15.1 Β· freebsd 14.5, freebsd 15.1
, in debian bookworm, debian trixie, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– GETPAGESIZES(3) πŸ’–

okay bestie, so this one lives in the Library Functions Manual and it's all about huge page sizes β€” like, how big your system's pages can go. it's giving sysadmin main character energy and i'm obsessed. πŸ¦‹


✨ NAME ✨

getpagesizes β€” Get the system supported huge page sizes


🌸 SYNOPSIS 🌸

#include <hugetlbfs.h>

int getpagesizes(long pagesizes[], int n_elem);

πŸ’… DESCRIPTION πŸ’…

so getpagesizes() is that girl who does two jobs at once, no cap. she returns either the number of system supported page sizes or the sizes themselves. literally depends on how you ask her. 😌

if pagesizes is NULL and n_elem is 0, then you get back the number of pages the system supports. that's it, that's the whole vibe.

otherwise, pagesizes gets filled with at most n_elem page sizes. at most!! don't come for her expecting more than you asked for. πŸŽ€


⭐ RETURN VALUE ⭐

on success, you get back either the number of page sizes supported by the system or the number of page sizes stored in pagesizes. slay. πŸ”₯

on failure? -1 is returned and errno is set appropriately. not the glow-up we wanted but okay. 😭


πŸ’€ ERRORS πŸ’€

  • EINVAL β€” n_elem is less than zero, or n_elem is greater than zero and pagesizes is NULL. yeah bestie, she does NOT play about that. πŸ™ˆ

also see opendir(3) for other possible values for errno. this error occurs when the sysfs directory exists but cannot be opened. it's there, it just won't let you in. the audacity fr fr. πŸ’…


🧚 NOTES 🧚

this call will return all page sizes as reported by the kernel. all of them. the full roster. πŸ‘‘

but here's the tea β˜• β€” not all of these sizes may be usable by the programmer since mount points may not be available for the huge page sizes. so like, she'll tell you every size that exists, but some of them are just... unavailable. not her fault. 🌈

to test whether a size will actually be usable by libhugetlbfs, you can call hugetlbfs_find_path_for_size() on a specific size to see if a mount point is configured. vibe check the size before you commit, iykyk. ✨


🫢 SEE ALSO 🫢


πŸŽ€ AUTHORS πŸŽ€

libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list. a whole group chat of icons, honestly. πŸ‘‘


this page is dated October 10, 2008 and comes from the Library Functions Manual. shoutout to the libhugetlbfs crew, periodt. πŸ’–βœ¨πŸ¦‹