diff options
author | jbeich <jbeich@FreeBSD.org> | 2017-09-11 19:51:50 +0800 |
---|---|---|
committer | jbeich <jbeich@FreeBSD.org> | 2017-09-11 19:51:50 +0800 |
commit | a55f9a989c4cd9d7a0518cd3636fd1a4c00ee2fe (patch) | |
tree | c610415b0eae6b57f6eedf197a54755c91f32b77 /games/openbor3482 | |
parent | 32ceb9a8db8ffca94bf5beace098b3c5ebd9f4f7 (diff) | |
download | freebsd-ports-gnome-a55f9a989c4cd9d7a0518cd3636fd1a4c00ee2fe.tar.gz freebsd-ports-gnome-a55f9a989c4cd9d7a0518cd3636fd1a4c00ee2fe.tar.zst freebsd-ports-gnome-a55f9a989c4cd9d7a0518cd3636fd1a4c00ee2fe.zip |
games/openbor: simplify initialization of sysctl values
Diffstat (limited to 'games/openbor3482')
-rw-r--r-- | games/openbor3482/files/patch-source_ramlib_ram.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/games/openbor3482/files/patch-source_ramlib_ram.c b/games/openbor3482/files/patch-source_ramlib_ram.c index ea89f1717897..c1609f723ea0 100644 --- a/games/openbor3482/files/patch-source_ramlib_ram.c +++ b/games/openbor3482/files/patch-source_ramlib_ram.c @@ -71,7 +71,7 @@ Implement Linux-like memory stats for BSDs ///////////////////////////////////////////////////////////////////////////// // Functions -@@ -101,6 +136,49 @@ u64 getFreeRam(int byte_size) +@@ -101,6 +136,48 @@ u64 getFreeRam(int byte_size) if(host_page_size(hostPort, &size) != KERN_SUCCESS) return 0; if(host_statistics(hostPort, HOST_VM_INFO, (host_info_t)&vms, &count) != KERN_SUCCESS) return 0; return (u64)(((vms.inactive_count+vms.free_count)*size)/byte_size); @@ -85,9 +85,8 @@ Implement Linux-like memory stats for BSDs + return (u64)((vms.v_free_count + vms.v_inactive_count + + vms.v_cache_count) * getpagesize()) / byte_size; +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -+ u_int v_free_count, v_inactive_count, v_cache_count; ++ u_int v_free_count = 0, v_inactive_count = 0, v_cache_count = 0; + size_t sz = sizeof(u_int); -+ v_free_count = v_inactive_count = v_cache_count = 0; + sysctlbyname("vm.stats.vm.v_free_count", + &v_free_count, &sz, NULL, 0); + sysctlbyname("vm.stats.vm.v_inactive_count", |