From cba63823f808a747ad762d3a8d5a4d8ef6890e54 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 27 Apr 2001 18:50:59 +0000 Subject: [PATCH] * thread.cc (thread_init_wrapper): Use _REENT_INIT to initialize the reent structure of newlib. * sigproc.h (sig_send): Add exception parameter to sig_send. * sigproc.cc (sig_send): Ditto. Use it when setting frame info. * exceptions.cc (handle_exceptions): Use exception flag when calling sig_send. --- winsup/cygwin/ChangeLog | 12 ++++++++++++ winsup/cygwin/exceptions.cc | 2 +- winsup/cygwin/sigproc.cc | 4 ++-- winsup/cygwin/sigproc.h | 3 ++- winsup/cygwin/thread.cc | 8 +------- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 243d81909..81ae2a862 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2001-04-27 Kazuhiro Fujieda + + * thread.cc (thread_init_wrapper): Use _REENT_INIT to initialize the + reent structure of newlib. + +Fri Apr 27 14:02:24 2001 Christopher Faylor + + * sigproc.h (sig_send): Add exception parameter to sig_send. + * sigproc.cc (sig_send): Ditto. Use it when setting frame info. + * exceptions.cc (handle_exceptions): Use exception flag when calling + sig_send. + 2001-04-27 Egor Duda * tty.cc (tty::make_pipes): Set to_slave pipe mode to nonblocking. diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 03e00ea4a..8cd60a8d5 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -532,7 +532,7 @@ handle_exceptions (EXCEPTION_RECORD *e, void *, CONTEXT *in, void *) signal_exit (0x80 | sig); // Flag signal + core dump } - sig_send (NULL, sig, (DWORD) ebp); // Signal myself + sig_send (NULL, sig, (DWORD) ebp, 1); // Signal myself return 0; } #endif /* __i386__ */ diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index b1140aaab..c7b0a491f 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -631,7 +631,7 @@ sigproc_terminate (void) * completed before returning. */ int __stdcall -sig_send (_pinfo *p, int sig, DWORD ebp) +sig_send (_pinfo *p, int sig, DWORD ebp, bool exception) { int rc = 1; DWORD tid = GetCurrentThreadId (); @@ -680,7 +680,7 @@ sig_send (_pinfo *p, int sig, DWORD ebp) { thiscatch = sigcatch_main; thiscomplete = sigcomplete_main; - thisframe.set (mainthread, ebp, 1); + thisframe.set (mainthread, ebp, exception); } } else if (!(thiscatch = getsem (p, "sigcatch", 0, 0))) diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index c239f5fe7..a346094ac 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -110,7 +110,8 @@ void __stdcall subproc_init (); void __stdcall sigproc_terminate (); BOOL __stdcall proc_exists (_pinfo *) __attribute__ ((regparm(1))); BOOL __stdcall pid_exists (pid_t) __attribute__ ((regparm(1))); -int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0)) __attribute__ ((regparm(3))); +int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0), + bool exception = 0) __attribute__ ((regparm(3))); void __stdcall signal_fixup_after_fork (); void __stdcall signal_fixup_after_exec (bool); diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 861dac3e7..deedcae42 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -737,7 +737,7 @@ thread_init_wrapper (void *_arg) pthread *thread = (pthread *) _arg; struct __reent_t local_reent; struct _winsup_t local_winsup; - struct _reent local_clib; + struct _reent local_clib = _REENT_INIT(local_clib); struct sigaction _sigs[NSIG]; sigset_t _sig_mask; /* one set for everything to ignore. */ @@ -748,14 +748,8 @@ thread_init_wrapper (void *_arg) thread->sigmask = &_sig_mask; thread->sigtodo = _sigtodo; - memset (&local_clib, 0, sizeof (struct _reent)); memset (&local_winsup, 0, sizeof (struct _winsup_t)); - local_clib._errno = 0; - local_clib._stdin = &local_clib.__sf[0]; - local_clib._stdout = &local_clib.__sf[1]; - local_clib._stderr = &local_clib.__sf[2]; - local_reent._clib = &local_clib; local_reent._winsup = &local_winsup;