harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dtan...@apache.org
Subject svn commit: r355121 - /incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/os_functions.c
Date Thu, 08 Dec 2005 15:17:14 GMT
Author: dtanzer
Date: Thu Dec  8 07:17:05 2005
New Revision: 355121

URL: http://svn.apache.org/viewcvs?rev=355121&view=rev
Log:
I added an entry for OS-X. I simply copied the function from FreeBSD. Also
I'm not sure if the define I'm checking is the right one (__APPLE__).


Modified:
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/os_functions.c

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/os_functions.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/os_functions.c?rev=355121&r1=355120&r2=355121&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/os_functions.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/os_functions.c Thu
Dec  8 07:17:05 2005
@@ -15,7 +15,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *
- * $Id: os_functions.c,v 1.1.1.1 2004/02/20 05:15:42 archiecobbs Exp $
+ * $Id$
  */
 
 #include "libjc.h"
@@ -38,6 +38,29 @@
  ************************************************************************/
 
 #if defined(__FreeBSD__)
+
+#include <sys/sysctl.h>
+
+int
+_jc_num_cpus(_jc_env *env)
+{
+	static const char *const node = "hw.ncpu";
+	_jc_jvm *const vm = env->vm;
+	int num;
+
+        if (sysctlbyname(node, NULL, 0, &num, sizeof(num)) == -1) {
+		_jc_eprintf(vm, "sysctl(%s): %s", node, strerror(errno));
+		return 1;
+	}
+	return num;
+}
+
+/************************************************************************
+ *				OS X					*
+ ************************************************************************/
+
+/** @todo is this really the right way to detect OS X? */
+#elif defined(__APPLE__)
 
 #include <sys/sysctl.h>
 



Mime
View raw message