- /* Re-raise the signal with the default handling so that the program
- * termination status reflects that we were killed by this signal */
- signal(sig_nr, SIG_DFL);
- raise(sig_nr);
+ fatal_signal_init();
+
+ sig_nr = stored_sig_nr;
+ if (sig_nr != SIG_ATOMIC_MAX) {
+ char namebuf[SIGNAL_NAME_BUFSIZE];
+
+ ovs_mutex_lock(&mutex);
+
+#ifndef _WIN32
+ VLOG_WARN("terminating with signal %d (%s)",
+ (int)sig_nr, signal_name(sig_nr, namebuf, sizeof namebuf));
+#else
+ VLOG_WARN("terminating with signal %d", (int)sig_nr);
+#endif
+ call_hooks(sig_nr);
+
+ /* Re-raise the signal with the default handling so that the program
+ * termination status reflects that we were killed by this signal */
+ signal(sig_nr, SIG_DFL);
+ raise(sig_nr);
+
+ ovs_mutex_unlock(&mutex);
+ OVS_NOT_REACHED();
+ }
+}
+
+void
+fatal_signal_wait(void)
+{
+ fatal_signal_init();
+ poll_fd_wait_event(signal_fds[0], wevent, POLLIN);
+}
+
+void
+fatal_ignore_sigpipe(void)
+{
+#ifndef _WIN32
+ signal(SIGPIPE, SIG_IGN);
+#endif