Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linprocfs/linprocfs.c
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | linprocfs_domeminfo(PFS_FILL_ARGS) | ||||
unsigned long long swapused; /* used swap space in bytes */ | unsigned long long swapused; /* used swap space in bytes */ | ||||
unsigned long long swapfree; /* free swap space in bytes */ | unsigned long long swapfree; /* free swap space in bytes */ | ||||
int i, j; | int i, j; | ||||
memtotal = physmem * PAGE_SIZE; | memtotal = physmem * PAGE_SIZE; | ||||
/* | /* | ||||
* The correct thing here would be: | * The correct thing here would be: | ||||
* | * | ||||
memfree = vm_cnt.v_free_count * PAGE_SIZE; | memfree = vm_free_count() * PAGE_SIZE; | ||||
memused = memtotal - memfree; | memused = memtotal - memfree; | ||||
* | * | ||||
* but it might mislead linux binaries into thinking there | * but it might mislead linux binaries into thinking there | ||||
* is very little memory left, so we cheat and tell them that | * is very little memory left, so we cheat and tell them that | ||||
* all memory that isn't wired down is free. | * all memory that isn't wired down is free. | ||||
*/ | */ | ||||
memused = vm_cnt.v_wire_count * PAGE_SIZE; | memused = vm_cnt.v_wire_count * PAGE_SIZE; | ||||
memfree = memtotal - memused; | memfree = memtotal - memused; | ||||
swap_pager_status(&i, &j); | swap_pager_status(&i, &j); | ||||
swaptotal = (unsigned long long)i * PAGE_SIZE; | swaptotal = (unsigned long long)i * PAGE_SIZE; | ||||
swapused = (unsigned long long)j * PAGE_SIZE; | swapused = (unsigned long long)j * PAGE_SIZE; | ||||
swapfree = swaptotal - swapused; | swapfree = swaptotal - swapused; | ||||
/* | /* | ||||
* We'd love to be able to write: | * We'd love to be able to write: | ||||
* | * | ||||
buffers = bufspace; | buffers = bufspace; | ||||
* | * | ||||
* but bufspace is internal to vfs_bio.c and we don't feel | * but bufspace is internal to vfs_bio.c and we don't feel | ||||
* like unstaticizing it just for linprocfs's sake. | * like unstaticizing it just for linprocfs's sake. | ||||
*/ | */ | ||||
buffers = 0; | buffers = 0; | ||||
cached = vm_cnt.v_inactive_count * PAGE_SIZE; | cached = vm_inactive_count() * PAGE_SIZE; | ||||
sbuf_printf(sb, | sbuf_printf(sb, | ||||
"MemTotal: %9lu kB\n" | "MemTotal: %9lu kB\n" | ||||
"MemFree: %9lu kB\n" | "MemFree: %9lu kB\n" | ||||
"Buffers: %9lu kB\n" | "Buffers: %9lu kB\n" | ||||
"Cached: %9lu kB\n" | "Cached: %9lu kB\n" | ||||
"SwapTotal:%9llu kB\n" | "SwapTotal:%9llu kB\n" | ||||
"SwapFree: %9llu kB\n", | "SwapFree: %9llu kB\n", | ||||
▲ Show 20 Lines • Show All 991 Lines • Show Last 20 Lines |