* perthread.h (vfork_save): Add ctty, sid, pgid, exitval fields.
(vfork_save::restore_pid): New method. (vfork_save::restore_exit): New method. * fork.cc (vfork): Save ctty, sid, pgid and restore them when returning to "parent". Use exitval field if exiting but never created a new process. * syscalls.cc (setsid): Detect when in "vfork" and force an actual fork so that pid will be allocated (UGLY!). (getsid): New function. * dcrt0.cc (do_exit): Use vfork_save::restore_exit method for returning from a vfork. * spawn.cc (spawnve): Use vfork_save::{restore_pid,restore_exit} methods for returning from vfork. * cygwin.din: Export getsid. * include/cygwin/version.h: Bump api minor number. * malloc.cc: #ifdef sYSTRIm for when MORECORE_CANNOT_TRIM is true.
This commit is contained in:
@ -907,11 +907,13 @@ spawnve (int mode, const char *path, const char *const *argv,
|
||||
case _P_DETACH:
|
||||
subproc_init ();
|
||||
ret = spawn_guts (path, argv, envp, mode);
|
||||
if (vf && ret > 0)
|
||||
if (vf)
|
||||
{
|
||||
debug_printf ("longjmping due to vfork");
|
||||
vf->pid = ret;
|
||||
longjmp (vf->j, 1);
|
||||
if (ret < 0)
|
||||
vf->restore_exit (ret);
|
||||
else
|
||||
vf->restore_pid (ret);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user