#include main() { struct pst_static pst; long bytes, Mb; if (pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0) != -1) { bytes= pst.physical_memory*pst.page_size; Mb = bytes / 1024 / 1024; printf("phys_memory is %d bytes (%d MB)\n", bytes, Mb); } else{ perror("pstat_getstatic"); } }