From: Nicholas Nethercote Date: Wed, 18 May 2005 19:47:46 +0000 (+0000) Subject: Make VG_(sanitize_client_sigmask)() local to m_syscalls. X-Git-Tag: svn/VALGRIND_3_0_0~549 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=47039b20b98d4e6992dcae3aca8164d155ba4c70;p=thirdparty%2Fvalgrind.git Make VG_(sanitize_client_sigmask)() local to m_syscalls. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3769 --- diff --git a/coregrind/core.h b/coregrind/core.h index b37ecf53a1..d5093430ee 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -408,9 +408,6 @@ extern Bool VG_(client_signal_OK)(Int sigNo); before using that signal to kill the process. */ extern void VG_(set_default_handler)(Int sig); -/* Adjust a client's signal mask to match our internal requirements */ -extern void VG_(sanitize_client_sigmask)(ThreadId tid, vki_sigset_t *mask); - /* Wait until a thread-related predicate is true */ extern void VG_(wait_for_threadstate)(Bool (*pred)(void *), void *arg); diff --git a/coregrind/m_syscalls/syscalls.c b/coregrind/m_syscalls/syscalls.c index 06bf378eda..5e1695dc6d 100644 --- a/coregrind/m_syscalls/syscalls.c +++ b/coregrind/m_syscalls/syscalls.c @@ -6043,6 +6043,25 @@ void VG_(post_syscall) (ThreadId tid) } } +/* Add and remove signals from mask so that we end up telling the + kernel the state we actually want rather than what the client + wants. */ +static void sanitize_client_sigmask(ThreadId tid, vki_sigset_t *mask) +{ + VG_(sigdelset)(mask, VKI_SIGKILL); + VG_(sigdelset)(mask, VKI_SIGSTOP); + + VG_(sigdelset)(mask, VKI_SIGVGKILL); /* never block */ + + /* SIGVGCHLD is used by threads to indicate their state changes to + the master thread. Mostly it doesn't care, so it leaves the + signal ignored and unblocked. Everyone else should have it + blocked, so there's at most 1 thread with it unblocked. */ + if (tid == VG_(master_tid)) + VG_(sigdelset)(mask, VKI_SIGVGCHLD); + else + VG_(sigaddset)(mask, VKI_SIGVGCHLD); +} void VG_(client_syscall) ( ThreadId tid ) { @@ -6142,7 +6161,7 @@ void VG_(client_syscall) ( ThreadId tid ) PRINT(" --> ...\n"); mask = tst->sig_mask; - VG_(sanitize_client_sigmask)(tid, &mask); + sanitize_client_sigmask(tid, &mask); VG_(set_sleeping)(tid, VgTs_WaitSys); VGA_(client_syscall)(syscallno, tst, &mask); diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c index 5e5f640895..02daeba992 100644 --- a/coregrind/vg_signals.c +++ b/coregrind/vg_signals.c @@ -636,26 +636,6 @@ void VG_(wait_for_threadstate)(Bool (*pred)(void *), void *arg) VG_(set_running)(VG_(master_tid)); } -/* Add and remove signals from mask so that we end up telling the - kernel the state we actually want rather than what the client - wants. */ -void VG_(sanitize_client_sigmask)(ThreadId tid, vki_sigset_t *mask) -{ - VG_(sigdelset)(mask, VKI_SIGKILL); - VG_(sigdelset)(mask, VKI_SIGSTOP); - - VG_(sigdelset)(mask, VKI_SIGVGKILL); /* never block */ - - /* SIGVGCHLD is used by threads to indicate their state changes to - the master thread. Mostly it doesn't care, so it leaves the - signal ignored and unblocked. Everyone else should have it - blocked, so there's at most 1 thread with it unblocked. */ - if (tid == VG_(master_tid)) - VG_(sigdelset)(mask, VKI_SIGVGCHLD); - else - VG_(sigaddset)(mask, VKI_SIGVGCHLD); -} - /* This updates the thread's signal mask. There's no such thing as a process-wide signal mask.