* environ.cc: Eliminate oldstack CYGWIN option.

* exceptions.cc (sfta): Eliminate obsolete function.
(sgmb): Eliminate obsolete function.
(class stack_info): Remove MS method for walking the stack.
(stack_info::init): Just initialize required fields.
(stack_info::brute_force): Rename to stack_info::walk.
(handle_exceptions): Pass derived frame pointer to sig_send.
(interrupt_setup): Clear saved frame pointer here.
(interrupt_on_return): thestack is no longer a pointer.
(call_handler): Accept a flag to indicate when a signal was sent from other
than the main thread.  Use saved frame pointer for determining where to place
signal handler call.
(sig_handle): Accept "nonmain" argument.  Pass it to call_handler.
* fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Change
debugging output slightly.
* (fhandler_tty_common::__release_output_mutex): Ditto.
(fhandler_tty_slave::read): Fix a comment, remove a goto.
* sigproc.cc (sig_send): Accept an optional frame pointer argument for use when
suspending the main process.  sigcomplete_main is an autoreset event now.  Save
frame pointer for non-main operation.
(wait_sig): Make sigcomplete_main an autoreset event.  Eliminate NOSIGQUEUE.
Pass rc to sig_handle to signify if this was a nonmain process.
* sigproc.h: Reflect change to sig_send argument.
* syscalls.cc (swab): Eliminate swab function since it is now available in
newlib.
* winsup.h (signal_dispatch): Change CONTEXT cx to DWORD ebp.
This commit is contained in:
Christopher Faylor
2000-03-09 21:04:05 +00:00
parent 3072163c0f
commit af1dc7ccea
8 changed files with 132 additions and 181 deletions

View File

@ -708,7 +708,7 @@ sigproc_terminate (void)
* completed before returning.
*/
int __stdcall
sig_send (pinfo *p, int sig)
sig_send (pinfo *p, int sig, DWORD ebp)
{
int rc = 1;
DWORD tid = GetCurrentThreadId ();
@ -716,6 +716,7 @@ sig_send (pinfo *p, int sig)
HANDLE thiscatch = NULL;
HANDLE thiscomplete = NULL;
BOOL wait_for_completion;
extern signal_dispatch sigsave;
if (p == myself_nowait_nonmain)
p = (tid == maintid) ? myself : myself_nowait;
@ -756,7 +757,7 @@ sig_send (pinfo *p, int sig)
{
thiscatch = sigcatch_main;
thiscomplete = sigcomplete_main;
ResetEvent (thiscomplete);
sigsave.ebp = ebp ?: (DWORD) __builtin_frame_address (1);
}
}
else if (!(thiscatch = getsem (p, "sigcatch", 0, 0)))
@ -1158,7 +1159,7 @@ wait_sig (VOID *)
sigcatch_nonmain = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL);
sigcatch_main = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL);
sigcomplete_nonmain = CreateSemaphore (&sec_none_nih, 0, MAXLONG, NULL);
sigcomplete_main = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL);
sigcomplete_main = CreateEvent (&sec_none_nih, FALSE, FALSE, NULL);
sigproc_printf ("sigcatch_nonmain %p", sigcatch_nonmain);
/* Setting dwProcessId flags that this process is now capable of receiving
@ -1231,11 +1232,7 @@ wait_sig (VOID *)
int dispatched_sigchld = 0;
for (int sig = -__SIGOFFSET; sig < NSIG; sig++)
{
#ifdef NOSIGQUEUE
if (InterlockedExchange (myself->getsigtodo(sig), 0L) > 0)
#else
while (InterlockedDecrement (myself->getsigtodo(sig)) >= 0)
#endif
{
if (sig == SIGCHLD)
saw_sigchld = 1;
@ -1263,7 +1260,7 @@ wait_sig (VOID *)
/* Signalled from a child process that it has stopped */
case __SIGCHILDSTOPPED:
sip_printf ("Received child stopped notification");
dispatched |= sig_handle (SIGCHLD);
dispatched |= sig_handle (SIGCHLD, rc);
if (proc_subproc (PROC_CHILDSTOPPED, 0))
dispatched |= 1;
break;
@ -1271,18 +1268,16 @@ wait_sig (VOID *)
/* A normal UNIX signal */
default:
sip_printf ("Got signal %d", sig);
int wasdispatched = sig_handle (sig);
int wasdispatched = sig_handle (sig, rc);
dispatched |= wasdispatched;
if (sig == SIGCHLD && wasdispatched)
dispatched_sigchld = 1;
goto nextsig;
}
}
#ifndef NOSIGQUEUE
/* Decremented too far. */
if (InterlockedIncrement (myself->getsigtodo(sig)) > 0)
pending_signals = 1;
#endif
nextsig:
continue;
}