svn commit: r449628 - in head/games: openbor/files openbor3482/files openbor3979/files openbor4432/files
Jan Beich
jbeich at FreeBSD.org
Mon Sep 11 11:51:52 UTC 2017
Author: jbeich
Date: Mon Sep 11 11:51:50 2017
New Revision: 449628
URL: https://svnweb.freebsd.org/changeset/ports/449628
Log:
games/openbor: simplify initialization of sysctl values
Modified:
head/games/openbor/files/patch-source_ramlib_ram.c (contents, props changed)
head/games/openbor3482/files/patch-source_ramlib_ram.c (contents, props changed)
head/games/openbor3979/files/patch-source_ramlib_ram.c (contents, props changed)
head/games/openbor4432/files/patch-source_ramlib_ram.c (contents, props changed)
Modified: head/games/openbor/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor/files/patch-source_ramlib_ram.c Mon Sep 11 11:39:09 2017 (r449627)
+++ head/games/openbor/files/patch-source_ramlib_ram.c Mon Sep 11 11:51:50 2017 (r449628)
@@ -48,7 +48,7 @@ Implement Linux-like memory stats for BSDs
#if (__GNUC__ > 3)
extern unsigned long _end;
extern unsigned long _start;
-@@ -93,6 +114,49 @@ u64 getFreeRam(int byte_size)
+@@ -93,6 +114,48 @@ u64 getFreeRam(int byte_size)
return 0;
}
return (u64)(((vms.inactive_count + vms.free_count) * size) / byte_size);
@@ -62,9 +62,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",
Modified: head/games/openbor3482/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor3482/files/patch-source_ramlib_ram.c Mon Sep 11 11:39:09 2017 (r449627)
+++ head/games/openbor3482/files/patch-source_ramlib_ram.c Mon Sep 11 11:51:50 2017 (r449628)
@@ -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",
Modified: head/games/openbor3979/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor3979/files/patch-source_ramlib_ram.c Mon Sep 11 11:39:09 2017 (r449627)
+++ head/games/openbor3979/files/patch-source_ramlib_ram.c Mon Sep 11 11:51:50 2017 (r449628)
@@ -71,7 +71,7 @@ Implement Linux-like memory stats for BSDs
/////////////////////////////////////////////////////////////////////////////
// Functions
-@@ -107,6 +142,49 @@ u64 getFreeRam(int byte_size)
+@@ -107,6 +142,48 @@ u64 getFreeRam(int byte_size)
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",
Modified: head/games/openbor4432/files/patch-source_ramlib_ram.c
==============================================================================
--- head/games/openbor4432/files/patch-source_ramlib_ram.c Mon Sep 11 11:39:09 2017 (r449627)
+++ head/games/openbor4432/files/patch-source_ramlib_ram.c Mon Sep 11 11:51:50 2017 (r449628)
@@ -48,7 +48,7 @@ Implement Linux-like memory stats for BSDs
#if (__GNUC__ > 3)
extern unsigned long _end;
extern unsigned long _start;
-@@ -93,6 +114,49 @@ u64 getFreeRam(int byte_size)
+@@ -93,6 +114,48 @@ u64 getFreeRam(int byte_size)
return 0;
}
return (u64)(((vms.inactive_count + vms.free_count) * size) / byte_size);
@@ -62,9 +62,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",
More information about the svn-ports-head
mailing list