changeset 5416:90096fbd80b9

. On other than MacOS X, the sysctl used by *BSD is HW_PHYSMEM, take that into account. . Add notes about supporting more features here on *BSD other than MacOS X.
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 18 Aug 2012 19:12:39 -0700
parents f4bd6c58b56d
children 9d0b9ae6e639
files src/solaris/native/com/sun/management/UnixOperatingSystem_md.c
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	Sat Aug 18 19:11:31 2012 -0700
+++ b/src/solaris/native/com/sun/management/UnixOperatingSystem_md.c	Sat Aug 18 19:12:39 2012 -0700
@@ -168,6 +168,9 @@
     /*
      * XXXBSD: there's no way available to get swap info in
      *         FreeBSD.  Usage of libkvm is not an option here
+     *
+     * XXX: Investigate how swapinfo(8) does this.
+     *      Total swap is in vm.swap_total
      */
     // throw_internal_error(env, "Unimplemented in FreeBSD");
     return (0);
@@ -242,6 +245,8 @@
 #else /* _ALLBSD_SOURCE */
     /*
      * XXXBSD: there's no way available to do it in FreeBSD, AFAIK.
+     *
+     * XXX: Determine how linprocfs gets this.
      */
     // throw_internal_error(env, "Unimplemented in FreeBSD");
     return (64 * MB);
@@ -323,6 +328,8 @@
 #elif defined(_ALLBSD_SOURCE)
     /*
      * XXXBSD: there's no way available to do it in FreeBSD, AFAIK.
+     *
+     * XXX: Investigate how top(8) gets this on FreeBSD.
      */
     // throw_internal_error(env, "Unimplemented in FreeBSD");
     return (128 * MB);
@@ -342,7 +349,11 @@
     size_t rlen;
 
     mib[0] = CTL_HW;
+#ifdef __APPLE__
     mib[1] = HW_MEMSIZE;
+#else
+    mib[1] = HW_PHYSMEM;
+#endif
     rlen = sizeof(result);
     if (sysctl(mib, 2, &result, &rlen, NULL, 0) != 0) {
         throw_internal_error(env, "sysctl failed");
@@ -408,6 +419,8 @@
 #elif defined(_ALLBSD_SOURCE)
     /*
      * XXXBSD: there's no way available to do it in FreeBSD, AFAIK.
+     *
+     * XXX: Investigate getting this on FreeBSD.  Look at lsof.
      */
     // throw_internal_error(env, "Unimplemented in FreeBSD");
     return (100);