commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r762787 - /commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c
Date Tue, 07 Apr 2009 14:17:11 GMT
Author: mturk
Date: Tue Apr  7 14:17:10 2009
New Revision: 762787

URL: http://svn.apache.org/viewvc?rev=762787&view=rev
Log:
Initial Solaris os implementation

Added:
    commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c   (with props)

Added: commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c?rev=762787&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c Tue Apr  7 14:17:10 2009
@@ -0,0 +1,75 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "acr.h"
+#include "acr_private.h"
+
+#include <sys/systeminfo.h>
+
+#define MAXSIZESYSSTRING 80
+
+ACR_JNI_EXPORT_DECLARE(jboolean, OS, is)(ACR_JNISTDARGS, jint type)
+{
+    UNREFERENCED_STDARGS;
+    if ((type & ACR_OS_UNIX) == ACR_OS_UNIX)
+        return JNI_TRUE;
+    else if (type == ACR_OS_SOLARIS)
+        return JNI_TRUE;
+    else
+        return JNI_FALSE;
+}
+
+/* XXX: Why not SI_SYSNAME? */
+ACR_JNI_EXPORT_DECLARE(jstring, OS, getSysname)(ACR_JNISTDARGS)
+{
+    return CSTR_TO_JSTRING("Solaris");
+}
+
+ACR_JNI_EXPORT_DECLARE(jstring, OS, getVersion)(ACR_JNISTDARGS)
+{
+    char string[MAXSIZESYSSTRING];
+    if (sysinfo(SI_VERSION, string, sizeof(string)) < 0)
+        return NULL;
+     else
+        return CSTR_TO_JSTRING(string);
+}
+
+ACR_JNI_EXPORT_DECLARE(jstring, OS, getRelease)(ACR_JNISTDARGS)
+{
+    char string[MAXSIZESYSSTRING];
+    if (sysinfo(SI_RELEASE, string, sizeof(string)) < 0)
+        return NULL;
+     else
+        return CSTR_TO_JSTRING(string);
+}
+
+ACR_JNI_EXPORT_DECLARE(jstring, OS, getMachine)(ACR_JNISTDARGS)
+{
+    char string[MAXSIZESYSSTRING];
+    if (sysinfo(SI_MACHINE, string, sizeof(string)) < 0)
+        return NULL;
+     else
+        return CSTR_TO_JSTRING(string);
+}
+
+ACR_JNI_EXPORT_DECLARE(jstring, OS, getNodename)(ACR_JNISTDARGS)
+{
+    char string[MAXSIZESYSSTRING];
+    if (sysinfo(SI_HOSTNAME, string, sizeof(string)) < 0)
+        return NULL;
+     else
+        return CSTR_TO_JSTRING(string);
+}

Propchange: commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message