+ msg.msg_iov = aiov;
+ if (msg.msg_accrights)
+ if (useracc((caddr_t)msg.msg_accrights,
+ (unsigned)msg.msg_accrightslen, B_WRITE) == 0) {
+ u.u_error = EFAULT;
+ return;
+ }
+ recvit(uap->s, &msg, uap->flags,
+ (caddr_t)&uap->msg->msg_namelen,
+ (caddr_t)&uap->msg->msg_accrightslen);
+}
+
+recvit(s, mp, flags, namelenp, rightslenp)
+ int s;
+ register struct msghdr *mp;
+ int flags;
+ caddr_t namelenp, rightslenp;
+{
+ register struct file *fp;
+ struct uio auio;
+ register struct iovec *iov;
+ register int i;
+ struct mbuf *from, *rights;
+ int len;
+
+ fp = getsock(s);
+ if (fp == 0)
+ return;
+ auio.uio_iov = mp->msg_iov;
+ auio.uio_iovcnt = mp->msg_iovlen;
+ auio.uio_segflg = UIO_USERSPACE;
+ auio.uio_offset = 0; /* XXX */
+ auio.uio_resid = 0;
+ iov = mp->msg_iov;
+ for (i = 0; i < mp->msg_iovlen; i++, iov++) {
+ if (iov->iov_len < 0) {
+ u.u_error = EINVAL;
+ return;
+ }
+ if (iov->iov_len == 0)
+ continue;
+ if (useracc(iov->iov_base, (u_int)iov->iov_len, B_WRITE) == 0) {
+ u.u_error = EFAULT;
+ return;
+ }
+ auio.uio_resid += iov->iov_len;