From d57a4725b1dde16e292ed7a9898752b4e2277766 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 15 Aug 2012 16:35:00 +0000 Subject: [PATCH] * exceptions.cc (sigdelayed): Move declaration to sigproc.h. * sigproc.h (sigdelayed): Make symbol globally available. * gendef (sigdelayed): Specifically zero incyg and stacklock. * signal.cc (sigwaitinfo): Lock _my_tls and try harder to clean up signal information. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/exceptions.cc | 2 -- winsup/cygwin/gendef | 5 +++-- winsup/cygwin/signal.cc | 6 +++++- winsup/cygwin/sigproc.h | 2 ++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ddf98d256..d93d2ee5a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2012-08-15 Christopher Faylor + + * exceptions.cc (sigdelayed): Move declaration to sigproc.h. + * sigproc.h (sigdelayed): Make symbol globally available. + * gendef (sigdelayed): Specifically zero incyg and stacklock. + * signal.cc (sigwaitinfo): Lock _my_tls and try harder to clean up + signal information. + 2012-08-15 Christopher Faylor * pinfo.cc (_pinfo::exists): Don't consider an execed process to exist. diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 649574fc2..8df69f29d 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -37,8 +37,6 @@ details. */ char debugger_command[2 * NT_MAX_PATH + 20]; -extern "C" void sigdelayed (); - static BOOL WINAPI ctrl_c_handler (DWORD); /* This is set to indicate that we have already exited. */ diff --git a/winsup/cygwin/gendef b/winsup/cygwin/gendef index 5cc06f76c..ddffe5800 100755 --- a/winsup/cygwin/gendef +++ b/winsup/cygwin/gendef @@ -196,8 +196,9 @@ _sigdelayed: xorl %ebp,%ebp xchgl %ebp,-4(%eax) # get return address from signal stack xchgl %ebp,28(%esp) # store real return address -leave: decl $tls::incyg(%ebx) - decl $tls::stacklock(%ebx) # unlock +leave: xorl %eax,%eax + movl %eax,$tls::incyg(%ebx) + movl %eax,$tls::stacklock(%ebx) # unlock popl %eax popl %ebx diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index f3a3a3a07..b83358812 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -590,10 +590,14 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info) } else { + _my_tls.lock (); if (info) *info = _my_tls.infodata; res = _my_tls.infodata.si_signo; - InterlockedExchange ((LONG *) &_my_tls.sig, (LONG) 0); + _my_tls.sig = 0; + if (_my_tls.retaddr () == (__stack_t) sigdelayed) + _my_tls.pop (); + _my_tls.unlock (); } break; default: diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index 06ebd68d8..6e6f3f46f 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -86,6 +86,8 @@ void __stdcall sigalloc (); int kill_pgrp (pid_t, siginfo_t&); int killsys (pid_t, int); +extern "C" void sigdelayed (); + extern char myself_nowait_dummy[]; extern struct sigaction *global_sigs;