From: Nicholas Nethercote Date: Wed, 11 May 2005 18:48:33 +0000 (+0000) Subject: Move VG_(block_signals)() to vg_scheduler.c, the only file that uses X-Git-Tag: svn/VALGRIND_3_0_0~657 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a23c89fc25f7c3044bfe5435fa9a7fbdded15da;p=thirdparty%2Fvalgrind.git Move VG_(block_signals)() to vg_scheduler.c, the only file that uses it, and make it private. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3661 --- diff --git a/coregrind/core.h b/coregrind/core.h index 643bdc515c..5b6ad0d462 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -593,10 +593,6 @@ extern Bool VG_(my_fault); Exports of vg_signals.c ------------------------------------------------------------------ */ -/* Set the standard set of blocked signals, used wheneever we're not - running a client syscall. */ -extern void VG_(block_signals)(ThreadId tid); - /* Highest signal the kernel will let us use */ extern Int VG_(max_signal); diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index d0ee0d80d6..9f18381aa5 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -424,6 +424,32 @@ void VG_(resume_scheduler)(ThreadId tid) } } +/* Set the standard set of blocked signals, used wheneever we're not + running a client syscall. */ +static void block_signals(ThreadId tid) +{ + vki_sigset_t mask; + + VG_(sigfillset)(&mask); + + /* Don't block these because they're synchronous */ + VG_(sigdelset)(&mask, VKI_SIGSEGV); + VG_(sigdelset)(&mask, VKI_SIGBUS); + VG_(sigdelset)(&mask, VKI_SIGFPE); + VG_(sigdelset)(&mask, VKI_SIGILL); + VG_(sigdelset)(&mask, VKI_SIGTRAP); + + /* Can't block these anyway */ + VG_(sigdelset)(&mask, VKI_SIGSTOP); + VG_(sigdelset)(&mask, VKI_SIGKILL); + + /* Master doesn't block this */ + if (tid == VG_(master_tid)) + VG_(sigdelset)(&mask, VKI_SIGVGCHLD); + + VG_(sigprocmask)(VKI_SIG_SETMASK, &mask, NULL); +} + #define SCHEDSETJMP(tid, jumped, stmt) \ do { \ ThreadState * volatile _qq_tst = VG_(get_ThreadState)(tid); \ @@ -511,7 +537,7 @@ UInt run_thread_for_a_while ( ThreadId tid ) signal handler to longjmp. */ vg_assert(trc == 0); trc = VG_TRC_FAULT_SIGNAL; - VG_(block_signals)(tid); + block_signals(tid); } done_this_time = (Int)dispatch_ctr_SAVED - (Int)VG_(dispatch_ctr) - 0; @@ -684,7 +710,7 @@ static void handle_syscall(ThreadId tid) vg_assert(VG_(is_running_thread)(tid)); if (jumped) { - VG_(block_signals)(tid); + block_signals(tid); VG_(poll_signals)(tid); } } @@ -706,7 +732,7 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid ) VGP_PUSHCC(VgpSched); /* set the proper running signal mask */ - VG_(block_signals)(tid); + block_signals(tid); vg_assert(VG_(is_running_thread)(tid)); diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c index 79d2d97454..fdcb15d8e4 100644 --- a/coregrind/vg_signals.c +++ b/coregrind/vg_signals.c @@ -2050,32 +2050,6 @@ void VG_(poll_signals)(ThreadId tid) VG_(restore_all_host_signals)(&saved_mask); } -/* Set the standard set of blocked signals, used wheneever we're not - running a client syscall. */ -void VG_(block_signals)(ThreadId tid) -{ - vki_sigset_t mask; - - VG_(sigfillset)(&mask); - - /* Don't block these because they're synchronous */ - VG_(sigdelset)(&mask, VKI_SIGSEGV); - VG_(sigdelset)(&mask, VKI_SIGBUS); - VG_(sigdelset)(&mask, VKI_SIGFPE); - VG_(sigdelset)(&mask, VKI_SIGILL); - VG_(sigdelset)(&mask, VKI_SIGTRAP); - - /* Can't block these anyway */ - VG_(sigdelset)(&mask, VKI_SIGSTOP); - VG_(sigdelset)(&mask, VKI_SIGKILL); - - /* Master doesn't block this */ - if (tid == VG_(master_tid)) - VG_(sigdelset)(&mask, VKI_SIGVGCHLD); - - VG_(sigprocmask)(VKI_SIG_SETMASK, &mask, NULL); -} - /* At startup, copy the process' real signal state to the SCSS. Whilst doing this, block all real signals. Then calculate SKSS and set the kernel to that. Also initialise DCSS.