Index: kern/uipc_syscalls.c
===================================================================
RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.16
diff -u -u -r1.16 uipc_syscalls.c
--- kern/uipc_syscalls.c	29 Sep 2003 05:34:08 -0000	1.16
+++ kern/uipc_syscalls.c	30 Sep 2003 04:41:45 -0000
@@ -542,7 +542,11 @@
 		return (error);
 	auio.uio_iov = mp->msg_iov;
 	auio.uio_iovcnt = mp->msg_iovlen;
-	auio.uio_segflg = UIO_USERSPACE;
+	if (mp->msg_flags & MSG_KERN_IOV) {
+		auio.uio_segflg = UIO_SYSSPACE;
+	} else {
+		auio.uio_segflg = UIO_USERSPACE;
+	}
 	auio.uio_rw = UIO_WRITE;
 	auio.uio_td = td;
 	auio.uio_offset = 0;			/* XXX */
@@ -728,7 +732,11 @@
 		return (error);
 	auio.uio_iov = mp->msg_iov;
 	auio.uio_iovcnt = mp->msg_iovlen;
-	auio.uio_segflg = UIO_USERSPACE;
+	if (mp->msg_flags & MSG_KERN_IOV) {
+		auio.uio_segflg = UIO_SYSSPACE;
+	} else {
+		auio.uio_segflg = UIO_USERSPACE;
+	}
 	auio.uio_rw = UIO_READ;
 	auio.uio_td = td;
 	auio.uio_offset = 0;			/* XXX */
Index: sys/socket.h
===================================================================
RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/sys/socket.h,v
retrieving revision 1.5
diff -u -u -r1.5 socket.h
--- sys/socket.h	19 Sep 2003 08:02:27 -0000	1.5
+++ sys/socket.h	30 Sep 2003 04:16:51 -0000
@@ -327,7 +327,9 @@
 #define	MSG_WAITALL	0x40		/* wait for full request or error */
 #define	MSG_DONTWAIT	0x80		/* this message should be nonblocking */
 #define	MSG_EOF		0x100		/* data completes connection */
-#define MSG_COMPAT      0x8000		/* used in sendit() */
+#ifdef _KERNEL
+#define MSG_KERN_IOV    0x8000		/* use in kernel space iov's */
+#endif /* _KERNEL */
 
 /*
  * Header for ancillary data objects in msg_control buffer.
Index: emulation/43bsd/43bsd_socket.c
===================================================================
RCS file: /nfs/daver/cvs-repos/cvs-dragonflybsd/src/sys/emulation/43bsd/43bsd_socket.c,v
retrieving revision 1.2
diff -u -u -r1.2 43bsd_socket.c
--- emulation/43bsd/43bsd_socket.c	19 Sep 2003 08:02:27 -0000	1.2
+++ emulation/43bsd/43bsd_socket.c	30 Sep 2003 04:44:38 -0000
@@ -188,7 +188,7 @@
 	msg.msg_iov = &aiov;
 	msg.msg_iovlen = 1;
 	msg.msg_control = NULL;
-	msg.msg_flags = 0;
+	msg.msg_flags = uap->flags;
 	aiov.iov_base = uap->buf;
 	aiov.iov_len = uap->len;
 
@@ -273,6 +273,9 @@
 	if (error)
 		goto cleanup;
 	msg.msg_iov = iov;
+
+	/* Don't forget the flags. */
+	msg.msg_flags = uap->flags;
 
 	error = kern_sendmsg(uap->s, &msg, &uap->sysmsg_result);
 

