+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.
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)
{
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];