[dovecot-cvs] dovecot/src/lib ioloop-notify-dn.c,1.2,1.3

cras at dovecot.org cras at dovecot.org
Mon Sep 6 01:06:29 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv12947

Modified Files:
	ioloop-notify-dn.c 
Log Message:
Ignore SIGIO which gets sent if queue gets full. Also other small
fixes/cleanups.



Index: ioloop-notify-dn.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ioloop-notify-dn.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ioloop-notify-dn.c	5 Sep 2004 20:29:04 -0000	1.2
+++ ioloop-notify-dn.c	5 Sep 2004 22:06:26 -0000	1.3
@@ -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;



More information about the dovecot-cvs mailing list