add RPC.strerror

This commit is contained in:
Doug MacEachern committed 2006-02-27 01:47:41 +00:00
1 parent f0cdd946c5
commit 9f1fa65239
4 files changed
+26 -1

No files matched your search

+10
View File
@@ -439,6 +439,16 @@ JNIEXPORT jint SIGAR_JNI(RPC_ping)
#endif
}
JNIEXPORT jstring SIGAR_JNI(RPC_strerror)
(JNIEnv *env, jclass cls_obj, jint err)
{
#ifdef WIN32
return NULL;
#else
return JENV->NewStringUTF(env, sigar_rpc_strerror(err));
#endif
}
JNIEXPORT jobjectArray SIGAR_JNI(Sigar_getCpuInfoList)
(JNIEnv *env, jobject sigar_obj)
{
@@ -16,6 +16,8 @@ public class RPC {
long program,
long version);
public static native String strerror(int status);
public static int ping(String hostname,
int protocol,
String program,
@@ -66,4 +68,10 @@ public class RPC {
return num.longValue();
}
public static void main(String[] args) throws Exception {
Sigar.load();
int retval = RPC.ping(args[0], args[1]);
System.out.println("(" + retval + ") " + RPC.strerror(retval));
}
}