change sigar pointer field from int to long.
on tru64 size(void*) == 8 which does not fit into sizeof(int) == 4
This commit is contained in:
parent
ac0db4ceb6
commit
5f3deb8927
|
@ -130,8 +130,8 @@ static jni_sigar_t *sigar_get_pointer(JNIEnv *env, jobject obj) {
|
||||||
|
|
||||||
cls = JENV->GetObjectClass(env, obj);
|
cls = JENV->GetObjectClass(env, obj);
|
||||||
|
|
||||||
pointer_field = JENV->GetFieldID(env, cls, "sigarWrapper", "I");
|
pointer_field = JENV->GetFieldID(env, cls, "sigarWrapper", "J");
|
||||||
jsigar = (jni_sigar_t *) JENV->GetIntField(env, obj, pointer_field);
|
jsigar = (jni_sigar_t *) JENV->GetLongField(env, obj, pointer_field);
|
||||||
|
|
||||||
if (!jsigar) {
|
if (!jsigar) {
|
||||||
sigar_throw_exception(env, "sigar has been closed");
|
sigar_throw_exception(env, "sigar has been closed");
|
||||||
|
@ -149,15 +149,10 @@ static jni_sigar_t *sigar_get_pointer(JNIEnv *env, jobject obj) {
|
||||||
|
|
||||||
static void sigar_set_pointer(JNIEnv *env, jobject obj, const void *ptr) {
|
static void sigar_set_pointer(JNIEnv *env, jobject obj, const void *ptr) {
|
||||||
jfieldID pointer_field;
|
jfieldID pointer_field;
|
||||||
int pointer_int;
|
jclass cls = JENV->GetObjectClass(env, obj);
|
||||||
jclass cls;
|
|
||||||
|
|
||||||
cls = JENV->GetObjectClass(env, obj);
|
|
||||||
|
|
||||||
pointer_field = JENV->GetFieldID(env, cls, "sigarWrapper", "I");
|
pointer_field = JENV->GetFieldID(env, cls, "sigarWrapper", "J");
|
||||||
pointer_int = (int)ptr;
|
JENV->SetLongField(env, obj, pointer_field, (jlong)ptr);
|
||||||
|
|
||||||
JENV->SetIntField(env, obj, pointer_field, pointer_int);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring SIGAR_JNI(Sigar_formatSize)
|
JNIEXPORT jstring SIGAR_JNI(Sigar_formatSize)
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class Sigar implements SigarProxy {
|
||||||
private static SigarLoader loader = new SigarLoader(Sigar.class);
|
private static SigarLoader loader = new SigarLoader(Sigar.class);
|
||||||
private FileSystemMap mounts = null;
|
private FileSystemMap mounts = null;
|
||||||
|
|
||||||
int sigarWrapper = 0; //holds the sigar_t *
|
long sigarWrapper = 0; //holds the sigar_t *
|
||||||
|
|
||||||
// lastCpu is used to calculate the cpuPerc;
|
// lastCpu is used to calculate the cpuPerc;
|
||||||
private Cpu lastCpu;
|
private Cpu lastCpu;
|
||||||
|
|
Loading…
Reference in New Issue