use vfork instead of fork on QNX

On QNX, fork cannot be used in multithreaded programs, but vfork can,
so that's what we'll use.

http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html
This commit is contained in:
Joel Dice 2012-07-17 19:26:37 -06:00
parent 4237a19b68
commit cace9d4531

View File

@ -402,7 +402,16 @@ Java_java_lang_Runtime_exec(JNIEnv* e, jclass,
return;
}
#ifdef __QNX__
// fork(2) doesn't work in multithreaded QNX programs. See
// http://www.qnx.com/developers/docs/6.4.1/neutrino/getting_started/s1_procs.html
pid_t pid = vfork();
#else
// We might be able to just use vfork on all UNIX-style systems, but
// the manual makes it sound dangerous due to the shared
// parent/child address space, so we use fork if we can.
pid_t pid = fork();
#endif
switch(pid){
case -1: // error
throwNewErrno(e, "java/io/IOException");