[dovecot-cvs] dovecot/src/lib ioloop-kqueue.c, 1.13, 1.14 ioloop-notify-kqueue.c, 1.6, 1.7

tss at dovecot.org tss at dovecot.org
Fri Nov 3 14:19:35 UTC 2006


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

Modified Files:
	ioloop-kqueue.c ioloop-notify-kqueue.c 
Log Message:
Removed compiler warnings with NetBSD.



Index: ioloop-kqueue.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ioloop-kqueue.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ioloop-kqueue.c	10 Sep 2006 12:48:14 -0000	1.13
+++ ioloop-kqueue.c	3 Nov 2006 14:19:32 -0000	1.14
@@ -23,6 +23,16 @@
 #include <sys/event.h>
 #include <sys/time.h>
 
+/* kevent.udata's type just has to be different in NetBSD than in
+   FreeBSD and OpenBSD.. */
+#ifdef __NetBSD__
+#  define MY_EV_SET(a, b, c, d, e, f, g) \
+	EV_SET(a, b, c, d, e, f, (intptr_t)g)
+#else
+#  define MY_EV_SET(a, b, c, d, e, f, g) \
+	EV_SET(a, b, c, d, e, f, g)
+#endif
+
 struct ioloop_handler_context {
 	int kq;
 
@@ -59,12 +69,12 @@
 	struct kevent ev;
 
 	if ((io->condition & (IO_READ | IO_ERROR)) != 0) {
-		EV_SET(&ev, io->fd, EVFILT_READ, EV_ADD, 0, 0, io);
+		MY_EV_SET(&ev, io->fd, EVFILT_READ, EV_ADD, 0, 0, io);
 		if (kevent(ctx->kq, &ev, 1, NULL, 0, NULL) < 0)
 			i_fatal("kevent(EV_ADD, %d) failed: %m", io->fd);
 	}
 	if ((io->condition & IO_WRITE) != 0) {
-		EV_SET(&ev, io->fd, EVFILT_WRITE, EV_ADD, 0, 0, io);
+		MY_EV_SET(&ev, io->fd, EVFILT_WRITE, EV_ADD, 0, 0, io);
 		if (kevent(ctx->kq, &ev, 1, NULL, 0, NULL) < 0)
 			i_fatal("kevent(EV_ADD, %d) failed: %m", io->fd);
 	}
@@ -83,12 +93,12 @@
 	struct kevent ev;
 
 	if ((io->condition & (IO_READ | IO_ERROR)) != 0) {
-		EV_SET(&ev, io->fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
+		MY_EV_SET(&ev, io->fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
 		if (kevent(ctx->kq, &ev, 1, NULL, 0, NULL) < 0)
 			i_error("kevent(EV_DELETE, %d) failed: %m", io->fd);
 	}
 	if ((io->condition & IO_WRITE) != 0) {
-		EV_SET(&ev, io->fd, EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
+		MY_EV_SET(&ev, io->fd, EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
 		if (kevent(ctx->kq, &ev, 1, NULL, 0, NULL) < 0)
 			i_error("kevent(EV_DELETE, %d) failed: %m", io->fd);
 	}
@@ -123,7 +133,7 @@
 
 	/* reference all IOs */
 	for (i = 0; i < ret; i++) {
-		io = events[i].udata;
+		io = (void *)events[i].udata;
 		io->refcount++;
 	}
 

Index: ioloop-notify-kqueue.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ioloop-notify-kqueue.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ioloop-notify-kqueue.c	26 Aug 2006 13:55:02 -0000	1.6
+++ ioloop-notify-kqueue.c	3 Nov 2006 14:19:33 -0000	1.7
@@ -23,6 +23,16 @@
 #include <sys/time.h>
 #include <sys/stat.h>
 
+/* kevent.udata's type just has to be different in NetBSD than in
+   FreeBSD and OpenBSD.. */
+#ifdef __NetBSD__
+#  define MY_EV_SET(a, b, c, d, e, f, g) \
+	EV_SET(a, b, c, d, e, f, (intptr_t)g)
+#else
+#  define MY_EV_SET(a, b, c, d, e, f, g) \
+	EV_SET(a, b, c, d, e, f, g)
+#endif
+
 struct ioloop_notify_handler_context {
 	int kq;
 	struct io *event_io;
@@ -50,7 +60,7 @@
 
 		i_fatal("kevent(notify) failed: %m");
 	}
-	io = ev.udata;
+	io = (void *)ev.udata;
 	io->callback(io->context);
 }
 
@@ -114,8 +124,8 @@
 	/* EV_CLEAR flag is needed because the EVFILT_VNODE filter reports
 	   event state transitions and not the current state.  With this flag,
 	   the same event is only returned once. */
-	EV_SET(&ev, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR,
-	       NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_REVOKE, 0, io);
+	MY_EV_SET(&ev, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR,
+		  NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_REVOKE, 0, io);
 	if (kevent(ctx->kq, &ev, 1, NULL, 0, NULL) < 0) {
 		i_error("kevent(%d, %s) for notify failed: %m", fd, path);
 		(void)close(fd);
@@ -139,7 +149,7 @@
 
 	i_assert((io->condition & IO_NOTIFY) != 0);
 
-	EV_SET(&ev, io->fd, EVFILT_VNODE, EV_DELETE, 0, 0, NULL);
+	MY_EV_SET(&ev, io->fd, EVFILT_VNODE, EV_DELETE, 0, 0, NULL);
 	if (kevent(ctx->kq, &ev, 1, NULL, 0, 0) < 0)
 		i_error("kevent(%d) for notify remove failed: %m", io->fd);
 	if (close(io->fd) < 0)



More information about the dovecot-cvs mailing list