rem: int error = 0, i, len = 0;
add: int error = 0, len = 0; uint32 i;
context: int socket_recv(struct socket *so, struct msghdr *mp, caddr_t namelenp, int *retsize){	struct uio auio;	struct iovec *iov;	struct mbuf *control = NULL;	struct mbuf *from = NULL;	int error = 0, i, len = 0;	auio.uio_iov = mp->msg_iov;	auio.uio_iovcnt = mp->msg_iovlen;	auio.uio_segflg = UIO_USERSPACE;	auio.uio_rw = UIO_READ;	auio.uio_offset = 0;	auio.uio_resid = 0;	iov = mp->msg_iov;	for (i=0; i < mp->msg_iovlen; i++, iov++) {		if (iov->iov_len < 0)			return EINVAL;		if ((auio.uio_resid += iov->iov_len) < 0)			return EINVAL;	}	len = auio.uio_resid;	if ((error = soreceive(so, &from, &auio,				NULL, mp->msg_control ? &control : NULL, 				&mp->msg_flags)) != 0) {		if (auio.uio_resid != len && (error == EINTR || error == EWOULDBLOCK))			error = 0;	}	if (error)		goto out;	*retsize = len - auio.uio_resid;	if (mp->msg_name) {		len = mp->msg_namelen;				if (len <= 0 || !from) {			len = 0;		} else {			if (len > from->m_len)				len = from->m_len;			memcpy((caddr_t)mp->msg_name, mtod(from, caddr_t), len);		}		mp->msg_namelen = len;		if (namelenp)			memcpy(namelenp, (caddr_t)&len, sizeof(int));	}	/* XXX - add control handling */out:	if (from)		m_freem(from);	if (control)		m_freem(control);	return error;}