diff options
author | Christopher Faylor <me@cgf.cx> | 2002-08-18 05:49:26 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-08-18 05:49:26 +0000 |
commit | 8dca9e230217cc6f4ded94e5fa0ab3f63df941b9 (patch) | |
tree | 7eae73aeb5feb07bfb241edbd41134270d9867a5 /winsup/cygwin/perthread.h | |
parent | d17ba05c1c9dbb15b846682fd98e65b80260623d (diff) | |
download | cygnal-8dca9e230217cc6f4ded94e5fa0ab3f63df941b9.tar.gz cygnal-8dca9e230217cc6f4ded94e5fa0ab3f63df941b9.tar.bz2 cygnal-8dca9e230217cc6f4ded94e5fa0ab3f63df941b9.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/perthread.h')
-rw-r--r-- | winsup/cygwin/perthread.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/winsup/cygwin/perthread.h b/winsup/cygwin/perthread.h index 48ad97621..f8682ae55 100644 --- a/winsup/cygwin/perthread.h +++ b/winsup/cygwin/perthread.h @@ -48,14 +48,30 @@ public: }; #if defined (NEED_VFORK) -struct vfork_save +class vfork_save { - int pid; jmp_buf j; + int exitval; + public: + int pid; DWORD frame[100]; char **vfork_ebp; char **vfork_esp; + int ctty; + pid_t sid; + pid_t pgid; int is_active () { return pid < 0; } + void restore_pid (int val) + { + pid = val; + longjmp (j, 1); + } + void restore_exit (int val) + { + exitval = val; + longjmp (j, 1); + } + friend int vfork (); }; class per_thread_vfork : public per_thread |