I have C code that call a kernel module and I want to pass a struct to it. This seems doable ex - char device catch multiple (int) ioctl-arguments
However I am invoking the c code through java JNI. It was said C struct mapping is to Java object. so am passing an object to the C native function.
Here is my JNI c function
JNIEXPORT jint JNICALL Java_com_context_test_ModCallLib_reNice
(JNIEnv *env, jclass clazz, jobject obj){
// convert objcet to struct
// call module through IOCTL passing struct as the parameter
}
How should I get a struct from obj?
EDIT: here is the object that I am passing,
class Nice{
int[] pids;
int niceVal;
Nice(List<Integer> pID, int n){
pids = new int[pID.size()];
for (int i=0; i < pids.length; i++)
{
pids[i] = pID.get(i).intValue();
}
niceVal = n;
}
}
the struct I want to have is this,
struct mesg {
int pids[size_of_pids];
int niceVal;
};
How should I approach?