* fork.cc (fork): Lock the process before forking to prevent things like new
fds from being opened, etc. * sync.h (lock_process::dont_bother): New function.
This commit is contained in:
parent
d9ceecd2d2
commit
fbadc634cb
@ -1,3 +1,9 @@
|
|||||||
|
2006-07-14 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* fork.cc (fork): Lock the process before forking to prevent things
|
||||||
|
like new fds from being opened, etc.
|
||||||
|
* sync.h (lock_process::dont_bother): New function.
|
||||||
|
|
||||||
2006-07-14 Christopher Faylor <cgf@timesys.com>
|
2006-07-14 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* include/cygwin/types.h: Update copyright.
|
* include/cygwin/types.h: Update copyright.
|
||||||
|
@ -533,6 +533,7 @@ fork ()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock_process now;
|
||||||
if (sig_send (NULL, __SIGHOLD))
|
if (sig_send (NULL, __SIGHOLD))
|
||||||
{
|
{
|
||||||
if (exit_state)
|
if (exit_state)
|
||||||
@ -547,7 +548,10 @@ fork ()
|
|||||||
__asm__ volatile ("movl %%esp,%0": "=r" (esp));
|
__asm__ volatile ("movl %%esp,%0": "=r" (esp));
|
||||||
|
|
||||||
if (ischild)
|
if (ischild)
|
||||||
|
{
|
||||||
res = grouped.child (esp);
|
res = grouped.child (esp);
|
||||||
|
now.dont_bother ();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = grouped.parent (esp);
|
res = grouped.parent (esp);
|
||||||
|
@ -50,6 +50,7 @@ class lock_process
|
|||||||
static muto locker;
|
static muto locker;
|
||||||
public:
|
public:
|
||||||
static void init () {locker.init ("lock_process");}
|
static void init () {locker.init ("lock_process");}
|
||||||
|
void dont_bother () {skip_unlock = true;}
|
||||||
lock_process (bool exiting = false)
|
lock_process (bool exiting = false)
|
||||||
{
|
{
|
||||||
locker.acquire ();
|
locker.acquire ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user