[dovecot-cvs] dovecot/src/lib ioloop-kqueue.c, 1.4.2.7, 1.4.2.8 ioloop-notify-kqueue.c, 1.3.2.3, 1.3.2.4

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


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

Modified Files:
      Tag: branch_1_0
	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.4.2.7
retrieving revision 1.4.2.8
diff -u -d -r1.4.2.7 -r1.4.2.8
--- ioloop-kqueue.c	17 Aug 2006 18:52:57 -0000	1.4.2.7
+++ ioloop-kqueue.c	3 Nov 2006 14:19:30 -0000	1.4.2.8
@@ -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;
 
@@ -60,12 +70,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);
 	}
@@ -84,12 +94,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);
 	}
@@ -124,7 +134,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.3.2.3
retrieving revision 1.3.2.4
diff -u -d -r1.3.2.3 -r1.3.2.4
--- ioloop-notify-kqueue.c	26 Aug 2006 13:55:01 -0000	1.3.2.3
+++ ioloop-notify-kqueue.c	3 Nov 2006 14:19:30 -0000	1.3.2.4
@@ -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