You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pe...@apache.org on 2006/03/16 10:32:14 UTC
svn commit: r386297 - /tomcat/connectors/trunk/jni/native/os/unix/system.c
Author: pero
Date: Thu Mar 16 01:32:13 2006
New Revision: 386297
URL: http://svn.apache.org/viewcvs?rev=386297&view=rev
Log:
Get totalmem and freemen at darwin.
Modified:
tomcat/connectors/trunk/jni/native/os/unix/system.c
Modified: tomcat/connectors/trunk/jni/native/os/unix/system.c
URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/native/os/unix/system.c?rev=386297&r1=386296&r2=386297&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/os/unix/system.c (original)
+++ tomcat/connectors/trunk/jni/native/os/unix/system.c Thu Mar 16 01:32:13 2006
@@ -35,6 +35,14 @@
#include <sys/sysinfo.h>
#endif
+#if defined(DARWIN)
+#include <mach/mach_init.h>
+#include <mach/mach_host.h>
+#include <mach/host_info.h>
+#include <sys/sysctl.h>
+#include <sys/stat.h>
+#endif
+
#include <syslog.h>
#include <stdarg.h>
@@ -285,6 +293,24 @@
*
*/
}
+
+#elif defined(DARWIN)
+
+ uint64_t mem_total;
+ size_t len = sizeof(mem_total);
+
+ vm_statistics_data_t vm_info;
+ mach_msg_type_number_t info_count = HOST_VM_INFO_COUNT;
+
+ sysctlbyname("hw.memsize", &mem_total, &len, NULL, 0);
+ pvals[0] = (jlong)mem_total;
+
+ host_statistics(mach_host_self (), HOST_VM_INFO, (host_info_t)&vm_info, &info_count);
+ pvals[1] = (jlong)(((double)vm_info.free_count)*vm_page_size);
+ pvals[6] = (jlong)(100 - (pvals[1] * 100 / mem_total));
+ rv = APR_SUCCESS;
+
+/* DARWIN */
#else
rv = APR_ENOTIMPL;
#endif
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org