|
From: <sv...@va...> - 2009-04-01 21:19:00
|
Author: sewardj
Date: 2009-04-01 22:18:14 +0100 (Wed, 01 Apr 2009)
New Revision: 9508
Log:
calculate_SKSS_from_SCSS: formatting-only change - remove large
numbers of trailing spaces from some lines.
VG_(kill_self): comment-only change re potential failure of
VG_(kill) on Darwin.
shutdown_actions_NORETURN: don't assert if, as a result of the
above, VG_(kill_self) returns on Darwin.
Modified:
branches/DARWIN/coregrind/m_main.c
branches/DARWIN/coregrind/m_signals.c
Modified: branches/DARWIN/coregrind/m_main.c
===================================================================
--- branches/DARWIN/coregrind/m_main.c 2009-04-01 19:48:42 UTC (rev 9507)
+++ branches/DARWIN/coregrind/m_main.c 2009-04-01 21:18:14 UTC (rev 9508)
@@ -2246,6 +2246,13 @@
/* We were killed by a fatal signal, so replicate the effect */
vg_assert(VG_(threads)[tid].os_state.fatalsig != 0);
VG_(kill_self)(VG_(threads)[tid].os_state.fatalsig);
+ /* we shouldn't be alive at this point. But VG_(kill_self)
+ sometimes fails with EPERM on Darwin, for unclear reasons. */
+# if defined(VGO_darwin)
+ VG_(debugLog)(0, "main", "VG_(kill_self) failed. Exiting normally.\n");
+ VG_(exit)(0); /* bogus, but we really need to exit now */
+ /* fall through .. */
+# endif
VG_(core_panic)("main(): signal was supposed to be fatal");
break;
Modified: branches/DARWIN/coregrind/m_signals.c
===================================================================
--- branches/DARWIN/coregrind/m_signals.c 2009-04-01 19:48:42 UTC (rev 9507)
+++ branches/DARWIN/coregrind/m_signals.c 2009-04-01 21:18:14 UTC (rev 9508)
@@ -555,13 +555,13 @@
case VKI_SIGCONT:
/* Let the kernel handle SIGCONT unless the client is actually
catching it. */
- case VKI_SIGCHLD:
- case VKI_SIGWINCH:
- case VKI_SIGURG:
- /* For signals which are have a default action of Ignore,
- only set a handler if the client has set a signal handler.
- Otherwise the kernel will interrupt a syscall which
- wouldn't have otherwise been interrupted. */
+ case VKI_SIGCHLD:
+ case VKI_SIGWINCH:
+ case VKI_SIGURG:
+ /* For signals which are have a default action of Ignore,
+ only set a handler if the client has set a signal handler.
+ Otherwise the kernel will interrupt a syscall which
+ wouldn't have otherwise been interrupted. */
if (scss.scss_per_sig[sig].scss_handler == VKI_SIG_DFL)
skss_handler = VKI_SIG_DFL;
else if (scss.scss_per_sig[sig].scss_handler == VKI_SIG_IGN)
@@ -1229,6 +1229,7 @@
/* Hit ourselves with a signal using the default handler */
void VG_(kill_self)(Int sigNo)
{
+ Int r;
vki_sigset_t mask, origmask;
vki_sigaction_toK_t sa, origsa2;
vki_sigaction_fromK_t origsa;
@@ -1247,7 +1248,9 @@
VG_(sigaddset)(&mask, sigNo);
VG_(sigprocmask)(VKI_SIG_UNBLOCK, &mask, &origmask);
- VG_(kill)(VG_(getpid)(), sigNo);
+ r = VG_(kill)(VG_(getpid)(), sigNo);
+ /* This sometimes fails with EPERM on Darwin. I don't know why. */
+ /* vg_assert(r == 0); */
VG_(convert_sigaction_fromK_to_toK)( &origsa, &origsa2 );
VG_(sigaction)(sigNo, &origsa2, NULL);
|