commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1097552 - /commons/sandbox/runtime/trunk/src/main/native/os/bsdx/os.c
Date Thu, 28 Apr 2011 17:17:05 GMT
Author: mturk
Date: Thu Apr 28 17:17:04 2011
New Revision: 1097552

URL: http://svn.apache.org/viewvc?rev=1097552&view=rev
Log:
BSD Vm.self

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/bsdx/os.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/bsdx/os.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/bsdx/os.c?rev=1097552&r1=1097551&r2=1097552&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/bsdx/os.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/bsdx/os.c Thu Apr 28 17:17:04 2011
@@ -40,7 +40,7 @@ ACR_JNI_EXPORT(jint, Os, getNumCpu)(JNI_
 
         mib[0] = CTL_HW;
         mib[1] = HW_NCPU;
-        if (sysctl(mib, 2, &_sys_ncpu,  &len, 0, 0) < 0)
+        if (sysctl(mib, 2, &_sys_ncpu,  &len, 0, 0) != 0)
             _sys_ncpu = 1;
     }
     return _sys_ncpu;
@@ -89,3 +89,19 @@ ACR_JNI_EXPORT(jstring, Os, getVersion)(
     else
         return CSTR_TO_JSTRING(_unknown);
 }
+
+ACR_JNI_EXPORT(jstring, Vm, self)(JNI_STDARGS)
+{
+    char   buf[PATH_MAX];
+    int    mib[4];
+    size_t cb = PATH_MAX;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_PATHNAME;
+    mib[3] = -1;
+    if (sysctl(mib, 4, buf, &cb, 0, 0) == 0)
+        return CSTR_TO_JSTRING(buf);
+    else
+        return 0;
+}



Mime
View raw message