Browse code

- netbsd fixes (e.g.: netbsd + kqueue crashes if compiled with -malign-double)

Andrei Pelinescu-Onciul authored on 05/07/2005 21:19:32
Showing 2 changed files
... ...
@@ -1047,10 +1047,11 @@ ifeq ($(OS), netbsd)
1047 1047
 		found_lock_method=yes
1048 1048
 	endif
1049 1049
 	# check for ver >= 2.0.0
1050
-$(warning OSREL_N=$(OSREL_N) , OSREL=$(OSREL) )
1051 1050
 	ifeq ($(shell [ $(OSREL_N) -ge 2000000 ] && echo has_kqueue), has_kqueue)
1052 1051
 		ifeq ($(NO_KQUEUE),)
1053 1052
 			DEFS+=-DHAVE_KQUEUE
1053
+			# netbsd + kqueue and -malign-double don't work
1054
+			CFLAGS:=$(filter-out -malign-double, $(CFLAGS))
1054 1055
 		endif
1055 1056
 	endif
1056 1057
 	ifeq ($(NO_SELECT),)
... ...
@@ -744,6 +744,11 @@ inline static int io_wait_loop_kqueue(io_wait_h* h, int t, int repeat)
744 744
 again:
745 745
 		n=kevent(h->kq_fd, h->kq_changes, h->kq_nchanges,  h->kq_array,
746 746
 					h->fd_no, &tspec);
747
+#ifdef EXTRA_DEBUG
748
+		DBG("DBG: kevent(%d, %p, %d, %p, %d, ...)=%d\n",
749
+			 h->kq_fd, h->kq_changes, h->kq_nchanges,  h->kq_array, h->fd_no,
750
+			 n);
751
+#endif
747 752
 		if (n==-1){
748 753
 			if (errno==EINTR) goto again; /* signal, ignore it */
749 754
 			else{
... ...
@@ -754,15 +759,20 @@ again:
754 754
 		}
755 755
 		h->kq_nchanges=0; /* reset changes array */
756 756
 		for (r=0; r<n; r++){
757
+#ifdef EXTRA_DEBUG
758
+			DBG("DBG: kqueue: event %d/%d: fd=%d, udata=%lx, flags=0x%x\n",
759
+					r, n, h->kq_array[r].ident, (long)h->kq_array[r].udata,
760
+					h->kq_array[r].flags);
761
+#endif
757 762
 			if (h->kq_array[r].flags & EV_ERROR){
758 763
 				/* error in changes: we ignore it, it can be caused by
759 764
 				   trying to remove an already closed fd: race between
760 765
 				   adding smething to the changes array, close() and
761 766
 				   applying the changes */
762 767
 				LOG(L_INFO, "INFO: io_wait_loop_kqueue: kevent error on "
763
-							"fd %d: %s [%d]\n", h->kq_array[r].ident,
768
+							"fd %d: %s [%ld]\n", h->kq_array[r].ident,
764 769
 							strerror(h->kq_array[r].data),
765
-							h->kq_array[r].data);
770
+							(long)h->kq_array[r].data);
766 771
 			}else /* READ/EOF */
767 772
 				while((handle_io((struct fd_map*)h->kq_array[r].udata, -1)>0)
768 773
 						&& repeat);