GETHUGEPAGESIZES(3)
π GETHUGEPAGESIZES π
okay bestie, so this one is from the Library Functions Manual, section 3, and it's called gethugepagesizes β yes, it's giving "how big are the huge pages around here" energy and honestly? iconic. π
β¨ NAME β¨
gethugepagesizes β Get the system supported huge page sizes π¦
πΈ SYNOPSIS πΈ
#include <hugetlbfs.h>
int gethugepagesizes(long pagesizes[], int n_elem);
like. that's the whole vibe. two args, one dream. π
π DESCRIPTION π
So here's the tea, bestie: gethugepagesizes() does one of two things, and it's very much a "pick your own adventure" moment.
- It returns the number of huge page sizes your system supports, OR
- It returns the sizes themselves. β¨
Which one you get depends entirely on what you pass in:
- If
pagesizesisNULLandn_elemis0, then the number of huge pages the system supports is returned. (just the count, no numbers, no drama) - Otherwise,
pagesizesgets filled with at mostn_elempage sizes. no more than that, bestie, we respect the boundary. π«Ά
π₯ RETURN VALUE π₯
On success, you get back either:
- the number of huge page sizes supported by the system, or
- the number of huge page sizes stored in
pagesizes
(whichever one applies to your little call, iykyk)
On failure? -1 is returned and errno is set appropriately. π that's the sad path, we don't go there.
π ERRORS π
EINVALβn_elemis less than zero, orn_elemis greater than zero andpagesizesisNULL.
Also, go peek at opendir(3) for other possible values for errno. This error occurs when the sysfs directory exists but cannot be opened. (so close yet so far π₯²)
π NOTES π
This call will return all huge page sizes as reported by the kernel. Not all of these sizes may be usable by the programmer, since mount points may not be available for all sizes. β οΈ
So if you wanna 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. main character move, honestly. β
π SEE ALSO π
π§ AUTHORS π§
libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list. π (a whole group chat of legends, fr fr)
and that's the whole page bestie!! this one's dated October 10, 2008, from the GETHUGEPAGESIZES(3) crew π slay, go read a huge page, you got this πβ¨
π¦ 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