c++ - Linux API to get Hugepagesize -


how can the hugepagesize value in /proc/meminfo

hugepagesize: 2048 kb

without parsing /proc/meminfo?

i can regular page size using

#include <unistd.h> long sz = sysconf(_sc_pagesize); 

is there sysconf argument provide hugepagesize?

i don't think linux exposes programmatic api getting value form userspace. agree comments here... /proc/meminfo solid alternative.

you can @ kernel code in $kernel/fs/proc/meminfo.c see how it's derived:

> meminfo_proc_show()   > hugetlb_report_meminfo()     > 1ul << (huge_page_order(h) + page_shift - 10) // actual value  

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -