changeset 2571:cc2127b799c5 HEAD

Ignore SIGIO which gets sent if queue gets full. Also other small fixes/cleanups.
author Timo Sirainen <tss@iki.fi>
date Mon, 06 Sep 2004 01:06:26 +0300
parents 372d4b90c076
children 829e683fd894
files src/lib/ioloop-notify-dn.c
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop-notify-dn.c	Mon Sep 06 00:19:36 2004 +0300
+++ b/src/lib/ioloop-notify-dn.c	Mon Sep 06 01:06:26 2004 +0300
@@ -8,7 +8,7 @@
 #ifdef IOLOOP_NOTIFY_DNOTIFY
 
 #include "ioloop-internal.h"
-#include "write-full.h"
+#include "network.h"
 
 #include <signal.h>
 #include <unistd.h>
@@ -19,8 +19,13 @@
 static void sigrt_handler(int signo __attr_unused__, siginfo_t *si,
 			  void *data __attr_unused__)
 {
-	if (write_full(event_pipe[1], &si->si_fd, sizeof(int)) < 0)
-		i_fatal("write_full(event_pipe) failed: %m");
+	int ret;
+
+	ret = write(event_pipe[1], &si->si_fd, sizeof(int));
+	if (ret < 0 && errno != EINTR && errno != EAGAIN)
+		i_fatal("write(event_pipe) failed: %m");
+
+	i_assert(ret <= 0 || ret == sizeof(int));
 }
 
 static void event_callback(void *context)
@@ -56,6 +61,12 @@
 		return FALSE;
 	}
 
+	net_set_nonblock(event_pipe[0], TRUE);
+	net_set_nonblock(event_pipe[1], TRUE);
+
+	/* SIGIO is sent if queue gets full. we'll just ignore it. */
+        signal(SIGIO, SIG_IGN);
+
 	act.sa_sigaction = sigrt_handler;
 	sigemptyset(&act.sa_mask);
 	act.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;