#endif
};
+#ifdef WINDOWS
+GNUNET_SIGNAL_Handler w32_sigchld_handler = NULL;
+#endif
+
struct GNUNET_SIGNAL_Context *
-GNUNET_SIGNAL_handler_install (int signal, GNUNET_SIGNAL_Handler handler)
+GNUNET_SIGNAL_handler_install (int signum, GNUNET_SIGNAL_Handler handler)
{
struct GNUNET_SIGNAL_Context *ret;
#ifndef MINGW
#endif
ret = GNUNET_malloc (sizeof (struct GNUNET_SIGNAL_Context));
- ret->sig = signal;
+ ret->sig = signum;
ret->method = handler;
#ifndef MINGW
sig.sa_handler = (void *) handler;
#else
sig.sa_flags = SA_RESTART;
#endif
- sigaction (signal, &sig, &ret->oldsig);
+ sigaction (signum, &sig, &ret->oldsig);
+#else
+ if (signum == GNUNET_SIGCHLD)
+ w32_sigchld_handler = handler;
+ else
+ {
+ __p_sig_fn_t sigret = signal (signum, handler);
+ if (sigret == SIG_ERR)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _
+ ("signal (%d, %p) returned %d.\n"),
+ signum, handler, sigret);
+ }
+ }
#endif
return ret;
}