svn commit: r362103 - head/sys/compat/linux

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Jun 12 14:31:20 UTC 2020


Author: trasz
Date: Fri Jun 12 14:31:19 2020
New Revision: 362103
URL: https://svnweb.freebsd.org/changeset/base/362103

Log:
  Fix naming clash.
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c	Fri Jun 12 14:25:32 2020	(r362102)
+++ head/sys/compat/linux/linux_socket.c	Fri Jun 12 14:31:19 2020	(r362103)
@@ -943,7 +943,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc
 	struct msghdr msg;
 	struct l_cmsghdr linux_cmsg;
 	struct l_cmsghdr *ptr_cmsg;
-	struct l_msghdr linux_msg;
+	struct l_msghdr linux_msghdr;
 	struct iovec *iov;
 	socklen_t datalen;
 	struct sockaddr *sa;
@@ -955,7 +955,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc
 	l_size_t clen;
 	int error, fflag;
 
-	error = copyin(msghdr, &linux_msg, sizeof(linux_msg));
+	error = copyin(msghdr, &linux_msghdr, sizeof(linux_msghdr));
 	if (error != 0)
 		return (error);
 
@@ -966,10 +966,11 @@ linux_sendmsg_common(struct thread *td, l_int s, struc
 	 * order to handle this case.  This should be checked, but allows the
 	 * Linux ping to work.
 	 */
-	if (PTRIN(linux_msg.msg_control) != NULL && linux_msg.msg_controllen == 0)
-		linux_msg.msg_control = PTROUT(NULL);
+	if (PTRIN(linux_msghdr.msg_control) != NULL &&
+	    linux_msghdr.msg_controllen == 0)
+		linux_msghdr.msg_control = PTROUT(NULL);
 
-	error = linux_to_bsd_msghdr(&msg, &linux_msg);
+	error = linux_to_bsd_msghdr(&msg, &linux_msghdr);
 	if (error != 0)
 		return (error);
 
@@ -1007,7 +1008,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc
 			goto bad;
 	}
 
-	if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) {
+	if (linux_msghdr.msg_controllen >= sizeof(struct l_cmsghdr)) {
 
 		error = ENOBUFS;
 		control = m_get(M_WAITOK, MT_CONTROL);
@@ -1015,8 +1016,8 @@ linux_sendmsg_common(struct thread *td, l_int s, struc
 		data = mtod(control, void *);
 		datalen = 0;
 
-		ptr_cmsg = PTRIN(linux_msg.msg_control);
-		clen = linux_msg.msg_controllen;
+		ptr_cmsg = PTRIN(linux_msghdr.msg_control);
+		clen = linux_msghdr.msg_controllen;
 		do {
 			error = copyin(ptr_cmsg, &linux_cmsg,
 			    sizeof(struct l_cmsghdr));
@@ -1151,7 +1152,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
 	struct l_cmsghdr *linux_cmsg = NULL;
 	struct l_ucred linux_ucred;
 	socklen_t datalen, maxlen, outlen;
-	struct l_msghdr linux_msg;
+	struct l_msghdr linux_msghdr;
 	struct iovec *iov, *uiov;
 	struct mbuf *control = NULL;
 	struct mbuf **controlp;
@@ -1163,11 +1164,11 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
 	void *data;
 	int error, i, fd, fds, *fdp;
 
-	error = copyin(msghdr, &linux_msg, sizeof(linux_msg));
+	error = copyin(msghdr, &linux_msghdr, sizeof(linux_msghdr));
 	if (error != 0)
 		return (error);
 
-	error = linux_to_bsd_msghdr(msg, &linux_msg);
+	error = linux_to_bsd_msghdr(msg, &linux_msghdr);
 	if (error != 0)
 		return (error);
 
@@ -1195,7 +1196,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
 		goto bad;
 
 	if (msg->msg_name) {
-		msg->msg_name = PTRIN(linux_msg.msg_name);
+		msg->msg_name = PTRIN(linux_msghdr.msg_name);
 		error = bsd_to_linux_sockaddr(sa, &lsa, msg->msg_namelen);
 		if (error == 0)
 			error = copyout(lsa, PTRIN(msg->msg_name),
@@ -1205,12 +1206,12 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
 			goto bad;
 	}
 
-	error = bsd_to_linux_msghdr(msg, &linux_msg);
+	error = bsd_to_linux_msghdr(msg, &linux_msghdr);
 	if (error != 0)
 		goto bad;
 
-	maxlen = linux_msg.msg_controllen;
-	linux_msg.msg_controllen = 0;
+	maxlen = linux_msghdr.msg_controllen;
+	linux_msghdr.msg_controllen = 0;
 	if (control) {
 		linux_cmsg = malloc(L_CMSG_HDRSZ, M_LINUX, M_WAITOK | M_ZERO);
 
@@ -1218,7 +1219,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
 		msg->msg_controllen = control->m_len;
 
 		cm = CMSG_FIRSTHDR(msg);
-		outbuf = PTRIN(linux_msg.msg_control);
+		outbuf = PTRIN(linux_msghdr.msg_control);
 		outlen = 0;
 		while (cm != NULL) {
 			linux_cmsg->cmsg_type =
@@ -1284,7 +1285,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
 					error = EMSGSIZE;
 					goto bad;
 				} else {
-					linux_msg.msg_flags |= LINUX_MSG_CTRUNC;
+					linux_msghdr.msg_flags |= LINUX_MSG_CTRUNC;
 					m_dispose_extcontrolm(control);
 					goto out;
 				}
@@ -1306,11 +1307,11 @@ linux_recvmsg_common(struct thread *td, l_int s, struc
 
 			cm = CMSG_NXTHDR(msg, cm);
 		}
-		linux_msg.msg_controllen = outlen;
+		linux_msghdr.msg_controllen = outlen;
 	}
 
 out:
-	error = copyout(&linux_msg, msghdr, sizeof(linux_msg));
+	error = copyout(&linux_msghdr, msghdr, sizeof(linux_msghdr));
 
 bad:
 	if (control != NULL) {
@@ -1807,7 +1808,7 @@ linux_socketcall(struct thread *td, struct linux_socke
 		return (linux_sendfile(td, arg));
 	}
 
-	uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
+	linux_msg(td, "socket type %d not implemented", args->what);
 	return (ENOSYS);
 }
 #endif /* __i386__ || __arm__ || (__amd64__ && COMPAT_LINUX32) */


More information about the svn-src-all mailing list