* exceptions.cc (signal_exit): Move captive process termintation...
(_cygtls::interrupt_setup): ...into here. (sigpacket::process): Simplify setting of handler when have_execed. (_cygtls::interrupt_setup): Don't call proc_subproc when we've execed. * globals.cc (exit_states): Delete unneeded ES_EXEC_EXIT. * pinfo.cc (pinfo::exit): Change debugging output. Call proc_terminate rather than the now-obsolete sigproc_terminate. Don't set exit_state to ES_EXEC_EXIT. Set exit_state to ES_FINAL later. * sigproc.cc (sigproc_terminate): Delete function. (wait_sig): Don't call proc_subproc if have_execed. * sigproc.h (sigproc_terminate): Delete declaration. * sync.h (lock_process::lock_process): Don't set exit_state to ES_PROCESS_LOCKED. (lock_process::operator LONG): Define.
This commit is contained in:
parent
cdc1925e02
commit
b712b4408a
|
@ -1,3 +1,20 @@
|
|||
2013-01-14 Christopher Faylor <me.cygwin2013@cgf.cx>
|
||||
|
||||
* exceptions.cc (signal_exit): Move captive process termintation...
|
||||
(_cygtls::interrupt_setup): ...into here.
|
||||
(sigpacket::process): Simplify setting of handler when have_execed.
|
||||
(_cygtls::interrupt_setup): Don't call proc_subproc when we've execed.
|
||||
* globals.cc (exit_states): Delete unneeded ES_EXEC_EXIT.
|
||||
* pinfo.cc (pinfo::exit): Change debugging output. Call proc_terminate
|
||||
rather than the now-obsolete sigproc_terminate. Don't set exit_state
|
||||
to ES_EXEC_EXIT. Set exit_state to ES_FINAL later.
|
||||
* sigproc.cc (sigproc_terminate): Delete function.
|
||||
(wait_sig): Don't call proc_subproc if have_execed.
|
||||
* sigproc.h (sigproc_terminate): Delete declaration.
|
||||
* sync.h (lock_process::lock_process): Don't set exit_state to
|
||||
ES_PROCESS_LOCKED.
|
||||
(lock_process::operator LONG): Define.
|
||||
|
||||
2013-01-11 Christopher Faylor <me.cygwin2013@cgf.cx>
|
||||
|
||||
* DevNotes: Add entry cgf-000021.
|
||||
|
|
|
@ -764,7 +764,8 @@ _cygtls::interrupt_setup (siginfo_t& si, void *handler, struct sigaction& siga)
|
|||
if (incyg)
|
||||
SetEvent (get_signal_arrived (false));
|
||||
|
||||
proc_subproc (PROC_CLEARWAIT, 1);
|
||||
if (!have_execed)
|
||||
proc_subproc (PROC_CLEARWAIT, 1);
|
||||
sigproc_printf ("armed signal_arrived %p, signal %d", signal_arrived, si.si_signo);
|
||||
}
|
||||
|
||||
|
@ -1089,12 +1090,6 @@ signal_exit (int sig, siginfo_t *si)
|
|||
debug_printf ("exiting due to signal %d", sig);
|
||||
exit_state = ES_SIGNAL_EXIT;
|
||||
|
||||
if (have_execed)
|
||||
{
|
||||
sigproc_printf ("terminating captive process");
|
||||
TerminateProcess (ch_spawn, sigExeced = sig);
|
||||
}
|
||||
|
||||
if (cygheap->rlim_core > 0UL)
|
||||
switch (sig)
|
||||
{
|
||||
|
@ -1186,9 +1181,7 @@ sigpacket::process ()
|
|||
sigproc_printf ("using tls %p", tls);
|
||||
}
|
||||
|
||||
void *handler = (void *) thissig.sa_handler;
|
||||
if (have_execed)
|
||||
handler = NULL;
|
||||
void *handler = have_execed ? NULL : (void *) thissig.sa_handler;
|
||||
|
||||
if (handler == SIG_IGN)
|
||||
{
|
||||
|
@ -1271,6 +1264,11 @@ dispatch_sig:
|
|||
if we hit an exception. */
|
||||
_my_tls.signal_debugger (si.si_signo);
|
||||
}
|
||||
if (have_execed)
|
||||
{
|
||||
sigproc_printf ("terminating captive process");
|
||||
TerminateProcess (ch_spawn, sigExeced = si.si_signo);
|
||||
}
|
||||
/* Dispatch to the appropriate function. */
|
||||
sigproc_printf ("signal %d, signal handler %p", si.si_signo, handler);
|
||||
rc = setup_handler (handler, thissig, tls);
|
||||
|
|
|
@ -43,7 +43,6 @@ enum exit_states
|
|||
ES_THREADTERM,
|
||||
ES_HUP_PGRP,
|
||||
ES_HUP_SID,
|
||||
ES_EXEC_EXIT,
|
||||
ES_TTY_TERMINATE,
|
||||
ES_FINAL
|
||||
};
|
||||
|
|
|
@ -175,18 +175,16 @@ pinfo::maybe_set_exit_code_from_windows ()
|
|||
void
|
||||
pinfo::exit (DWORD n)
|
||||
{
|
||||
minimal_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
|
||||
sigproc_terminate (ES_FINAL);
|
||||
debug_only_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
|
||||
proc_terminate ();
|
||||
lock_process until_exit (true);
|
||||
cygthread::terminate ();
|
||||
|
||||
if (n != EXITCODE_NOSET)
|
||||
self->exitcode = EXITCODE_SET | n;/* We're really exiting. Record the UNIX exit code. */
|
||||
else
|
||||
{
|
||||
exit_state = ES_EXEC_EXIT;
|
||||
maybe_set_exit_code_from_windows ();
|
||||
}
|
||||
maybe_set_exit_code_from_windows (); /* may block */
|
||||
exit_state = ES_FINAL;
|
||||
|
||||
if (myself->ctty > 0 && !iscons_dev (myself->ctty))
|
||||
{
|
||||
|
|
|
@ -467,21 +467,6 @@ sigproc_init ()
|
|||
new cygthread (wait_sig, cygself, "sig");
|
||||
}
|
||||
|
||||
/* Called on process termination to terminate signal and process threads.
|
||||
*/
|
||||
void __stdcall
|
||||
sigproc_terminate (exit_states es)
|
||||
{
|
||||
exit_states prior_exit_state = exit_state;
|
||||
exit_state = es;
|
||||
if (!cygwin_finished_initializing)
|
||||
/* nothing to do */;
|
||||
else if (prior_exit_state >= ES_FINAL)
|
||||
sigproc_printf ("already performed");
|
||||
else
|
||||
proc_terminate (); // clean up process stuff
|
||||
}
|
||||
|
||||
/* Exit the current thread very carefully.
|
||||
See cgf-000017 in DevNotes for more details on why this is
|
||||
necessary. */
|
||||
|
@ -1427,7 +1412,7 @@ wait_sig (VOID *)
|
|||
}
|
||||
break;
|
||||
}
|
||||
if (clearwait)
|
||||
if (clearwait && !have_execed)
|
||||
proc_subproc (PROC_CLEARWAIT, 0);
|
||||
loop:
|
||||
if (pack.wakeup)
|
||||
|
|
|
@ -76,9 +76,6 @@ int __stdcall proc_subproc (DWORD, DWORD) __attribute__ ((regparm (2)));
|
|||
class _pinfo;
|
||||
void __stdcall proc_terminate ();
|
||||
void __stdcall sigproc_init ();
|
||||
#ifdef __INSIDE_CYGWIN__
|
||||
void __stdcall sigproc_terminate (enum exit_states);
|
||||
#endif
|
||||
bool __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));
|
||||
int __stdcall sig_send (_pinfo *, siginfo_t&, class _cygtls * = NULL) __attribute__ ((regparm (3)));
|
||||
int __stdcall sig_send (_pinfo *, int, class _cygtls * = NULL) __attribute__ ((regparm (3)));
|
||||
|
|
|
@ -52,8 +52,6 @@ public:
|
|||
{
|
||||
locker.acquire ();
|
||||
skip_unlock = exiting;
|
||||
if (exiting && exit_state < ES_PROCESS_LOCKED)
|
||||
exit_state = ES_PROCESS_LOCKED;
|
||||
}
|
||||
void release ()
|
||||
{
|
||||
|
@ -65,6 +63,7 @@ public:
|
|||
if (!skip_unlock)
|
||||
release ();
|
||||
}
|
||||
operator LONG () const {return locker.visits; }
|
||||
static void force_release (_cygtls *tid) {locker.release (tid);}
|
||||
friend class dtable;
|
||||
friend class fhandler_fifo;
|
||||
|
|
Loading…
Reference in New Issue