GETPAGESIZES(3)
π 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_elemis less than zero, orn_elemis greater than zero andpagesizesisNULL. 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. πβ¨π¦
π¦ where this page comes from
- debian bookworm: libhugetlbfs-dev 2.23-5 Β· LGPL-2.1-only
- debian trixie: libhugetlbfs-dev 2.24-1+b1 Β· LGPL-2.1-only
- nixpkgs unstable: libhugetlbfs 2.24
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libhugetlbfs-devel 2.24.0.g1322884-160000.3.2 Β· LGPL-2.1-or-later
- ubuntu jammy: libhugetlbfs-dev 2.23-4 Β· LGPL-2.1-only
- ubuntu noble: libhugetlbfs-dev 2.23-5build1 Β· LGPL-2.1-only
- ubuntu questing: libhugetlbfs-dev 2.24-1
- ubuntu resolute: libhugetlbfs-dev 2.24-1build1 Β· LGPL-2.1-only
- ubuntu stonking: libhugetlbfs-dev 2.24-1build1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms