PERFORCE change 100220 for review

John Baldwin jhb at FreeBSD.org
Wed Jun 28 18:08:43 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100220

Change 100220 by jhb at jhb_mutex on 2006/06/28 18:07:51

	Make kern_recvit() accept a separate uio_seg to specify where
	msg_name points to so ABIs can make that a kmem pointer rather
	than userland.

Affected files ...

.. //depot/projects/smpng/sys/compat/freebsd32/freebsd32_misc.c#37 edit
.. //depot/projects/smpng/sys/kern/uipc_syscalls.c#79 edit
.. //depot/projects/smpng/sys/sys/syscallsubr.h#34 edit

Differences ...

==== //depot/projects/smpng/sys/compat/freebsd32/freebsd32_misc.c#37 (text+ko) ====

@@ -1009,7 +1009,8 @@
 	msg.msg_iov = iov;
 
 	controlp = (msg.msg_control != NULL) ?  &control : NULL;
-	error = kern_recvit(td, uap->s, &msg, NULL, UIO_USERSPACE, controlp);
+	error = kern_recvit(td, uap->s, &msg, NULL, UIO_USERSPACE,
+	    UIO_USERSPACE, controlp);
 	if (error == 0) {
 		msg.msg_iov = uiov;
 		
@@ -1150,7 +1151,8 @@
 	msg.msg_control = 0;
 	msg.msg_flags = uap->flags;
 	error = kern_recvit(td, uap->s, &msg,
-	    (void *)(uintptr_t)uap->fromlenaddr, UIO_USERSPACE, NULL);
+	    (void *)(uintptr_t)uap->fromlenaddr, UIO_USERSPACE, UIO_USERSPACE,
+	    NULL);
 	return (error);
 }
 

==== //depot/projects/smpng/sys/kern/uipc_syscalls.c#79 (text+ko) ====

@@ -926,12 +926,12 @@
 }
 
 int
-kern_recvit(td, s, mp, namelenp, segflg, controlp)
+kern_recvit(td, s, mp, namelenp, uioseg, fromseg, controlp)
 	struct thread *td;
 	int s;
 	struct msghdr *mp;
 	void *namelenp;
-	enum uio_seg segflg;
+	enum uio_seg uioseg, fromseg;
 	struct mbuf **controlp;
 {
 	struct uio auio;
@@ -972,7 +972,7 @@
 
 	auio.uio_iov = mp->msg_iov;
 	auio.uio_iovcnt = mp->msg_iovlen;
-	auio.uio_segflg = segflg;
+	auio.uio_segflg = uioseg;
 	auio.uio_rw = UIO_READ;
 	auio.uio_td = td;
 	auio.uio_offset = 0;			/* XXX */
@@ -1020,9 +1020,13 @@
 				((struct osockaddr *)fromsa)->sa_family =
 				    fromsa->sa_family;
 #endif
-			error = copyout(fromsa, mp->msg_name, (unsigned)len);
-			if (error)
-				goto out;
+			if (fromseg == UIO_USERSPACE) {
+				error = copyout(fromsa, mp->msg_name,
+				    (unsigned)len);
+				if (error)
+					goto out;
+			} else
+				bcopy(fromsa, mp->msg_name, len);
 		}
 		mp->msg_namelen = len;
 		if (namelenp &&
@@ -1103,7 +1107,8 @@
 	void *namelenp;
 {
 
-	return (kern_recvit(td, s, mp, namelenp, UIO_USERSPACE, NULL));
+	return (kern_recvit(td, s, mp, namelenp, UIO_USERSPACE, UIO_USERSPACE,
+	    NULL));
 }
 
 /*

==== //depot/projects/smpng/sys/sys/syscallsubr.h#34 (text+ko) ====

@@ -121,8 +121,9 @@
 int	kern_readlink(struct thread *td, char *path, enum uio_seg pathseg,
 	    char *buf, enum uio_seg bufseg, int count);
 int	kern_readv(struct thread *td, int fd, struct uio *auio);
-int	kern_recvit(struct thread *td, int s, struct msghdr *mp, void *namelenp,
-	    enum uio_seg segflg, struct mbuf **controlp);
+int	kern_recvit(struct thread *td, int s, struct msghdr *mp,
+    void *namelenp, enum uio_seg uioseg, enum uio_seg fromseg,
+    struct mbuf **controlp);
 int	kern_rename(struct thread *td, char *from, char *to,
 	    enum uio_seg pathseg);
 int	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);


More information about the p4-projects mailing list