get_phys_pages(3) Library Functions Manual get_phys_pages(3) get_phys_pages, get_avphys_pages - , C (libc, -lc) #include long get_phys_pages(void); long get_avphys_pages(void); get_phys_pages() , . get_avphys_pages() . On success, these functions return a nonnegative value as given in DESCRIPTION. On failure, they return -1 and set errno to indicate the error. ENOSYS (, - , /proc). GNU. Before glibc 2.23, these functions obtained the required information by scanning the MemTotal and MemFree fields of /proc/meminfo. Since glibc 2.23, these functions obtain the required information by calling sysinfo(2). sysconf(3) , . total_pages = sysconf(_SC_PHYS_PAGES); /* */ avl_pages = sysconf(_SC_AVPHYS_PAGES); /* */ get_phys_pages() get_avphys_pages(). #include #include #include int main(void) { printf("This system has %ld pages of physical memory and " "%ld pages of physical memory available.\n", get_phys_pages(), get_avphys_pages()); exit(EXIT_SUCCESS); } sysconf(3) () Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 15 2024 . get_phys_pages(3)