Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Misbehaviour of UNIX system calls when called with JNI

Status
Not open for further replies.

DGRFL

Programmer
Dec 28, 2000
36
BE
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top