-
Notifications
You must be signed in to change notification settings - Fork 2
/
getloadavg.rs
23 lines (21 loc) · 948 Bytes
/
getloadavg.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use jni::JNIEnv;
use jni::objects::JClass;
use jni::sys::jint;
use libc::getloadavg;
#[no_mangle]
pub extern "system" fn Java_com_komanov_nativeaccess_JniHelper_getloadavg(_env: JNIEnv,
_class: JClass,
input: *mut f64,
num: jint)
-> jint {
unsafe {
return getloadavg(input, num);
}
}
#[no_mangle]
pub extern "system" fn Java_com_komanov_nativeaccess_JniHelper_foo(_env: JNIEnv,
_class: JClass,
num: jint)
-> jint {
return num;
}