diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/ChangeLog | 5 | ||||
-rw-r--r-- | support/signal.c | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index 0b87065493d..aaff237409c 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,8 @@ +2009-01-08 Rodrigo Kumpera <rkumpera@novell.com> + + * signal.c: Don't allow registration of a realtime signal to happen + if it was already registered outside of Mono.Posix. + 2008-12-19 Jonathan Pryor <jpryor@novell.com> * signal.c: Improve error checking within Mono_Posix_FromRealTimeSignum. diff --git a/support/signal.c b/support/signal.c index 28498285457..c6df230b1b7 100644 --- a/support/signal.c +++ b/support/signal.c @@ -29,6 +29,8 @@ G_BEGIN_DECLS typedef void (*mph_sighandler_t)(int); typedef struct Mono_Unix_UnixSignal_SignalInfo signal_info; +static int count_handlers (int signum); + void* Mono_Posix_Stdlib_SIG_DFL (void) { @@ -157,6 +159,19 @@ Mono_Unix_UnixSignal_install (int sig) return NULL; } +#if defined (SIGRTMIN) && defined (SIGRTMAX) + /*The runtime uses some rt signals for itself so it's important to not override them.*/ + if (sig >= SIGRTMIN && sig <= SIGRTMAX && count_handlers (sig) == 0) { + struct sigaction sinfo; + sigaction (sig, NULL, &sinfo); + if (sinfo.sa_handler != SIG_DFL || (void*)sinfo.sa_sigaction != (void*)SIG_DFL) { + pthread_mutex_unlock (&signals_mutex); + errno = EADDRINUSE; + return NULL; + } + } +#endif /*defined (SIGRTMIN) && defined (SIGRTMAX)*/ + for (i = 0; i < NUM_SIGNALS; ++i) { if (h == NULL && signals [i].signum == 0) { h = &signals [i]; |