Hello,
I am trying to monitor child processes by means of the waitpid() system call (on Sun Solaris).
JNIEXPORT jint JNICALL
Java_blablabla_NativeInterface_waitForDyingProcess
( JNIEnv *pJNIEnv,
jobject jobjectCaller
)
{
pid_t pid = waitpid (0, 0, WNOHANG);
if (pid < 0)
{
printf("waitpid failed with errno %d\n", errno);
return 0;
}
if (pid > 0 )
printf("stopped %d\n", pid);
return (jint)pid;
}
A native test program (in C) calling this method works fine.
However when I call these methods through JNI, I always get a errno==ENOENT(2) which is an undocumented return code for waitpid().
Also other system calls (like getlogin()) return a ENOENT, when used through JNI.
My guess would be some linker option...
Can somebody help me ?
Thanks
Luc
I am trying to monitor child processes by means of the waitpid() system call (on Sun Solaris).
JNIEXPORT jint JNICALL
Java_blablabla_NativeInterface_waitForDyingProcess
( JNIEnv *pJNIEnv,
jobject jobjectCaller
)
{
pid_t pid = waitpid (0, 0, WNOHANG);
if (pid < 0)
{
printf("waitpid failed with errno %d\n", errno);
return 0;
}
if (pid > 0 )
printf("stopped %d\n", pid);
return (jint)pid;
}
A native test program (in C) calling this method works fine.
However when I call these methods through JNI, I always get a errno==ENOENT(2) which is an undocumented return code for waitpid().
Also other system calls (like getlogin()) return a ENOENT, when used through JNI.
My guess would be some linker option...
Can somebody help me ?
Thanks
Luc