svn commit: r367079 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux

Edward Tomasz Napierala trasz at FreeBSD.org
Tue Oct 27 12:49:42 UTC 2020


Author: trasz
Date: Tue Oct 27 12:49:40 2020
New Revision: 367079
URL: https://svnweb.freebsd.org/changeset/base/367079

Log:
  Fix misnomer - linux_to_bsd_errno() does the exact opposite.
  
  Reported by:	arichardson
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D26965

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/arm64/linux/linux_sysvec.c
  head/sys/compat/linux/linux.h
  head/sys/compat/linux/linux_errno.c
  head/sys/compat/linux/linux_socket.c
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- head/sys/amd64/linux/linux_sysvec.c	Tue Oct 27 12:44:49 2020	(r367078)
+++ head/sys/amd64/linux/linux_sysvec.c	Tue Oct 27 12:49:40 2020	(r367079)
@@ -231,7 +231,7 @@ linux_set_syscall_retval(struct thread *td, int error)
 		break;
 
 	default:
-		frame->tf_rax = linux_to_bsd_errno(error);
+		frame->tf_rax = bsd_to_linux_errno(error);
 		frame->tf_r10 = frame->tf_rcx;
 		break;
 	}

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- head/sys/amd64/linux32/linux32_sysvec.c	Tue Oct 27 12:44:49 2020	(r367078)
+++ head/sys/amd64/linux32/linux32_sysvec.c	Tue Oct 27 12:49:40 2020	(r367079)
@@ -678,7 +678,7 @@ linux32_set_syscall_retval(struct thread *td, int erro
 
 	if (__predict_false(error != 0)) {
 		if (error != ERESTART && error != EJUSTRETURN)
-			frame->tf_rax = linux_to_bsd_errno(error);
+			frame->tf_rax = bsd_to_linux_errno(error);
 	}
 }
 

Modified: head/sys/arm64/linux/linux_sysvec.c
==============================================================================
--- head/sys/arm64/linux/linux_sysvec.c	Tue Oct 27 12:44:49 2020	(r367078)
+++ head/sys/arm64/linux/linux_sysvec.c	Tue Oct 27 12:49:40 2020	(r367079)
@@ -142,10 +142,8 @@ linux_set_syscall_retval(struct thread *td, int error)
 	cpu_set_syscall_retval(td, error);
 
 	if (__predict_false(error != 0)) {
-		if (error != ERESTART && error != EJUSTRETURN) {
-			td->td_frame->tf_x[0] =
-				linux_to_bsd_errno(error);
-		}
+		if (error != ERESTART && error != EJUSTRETURN)
+			td->td_frame->tf_x[0] = bsd_to_linux_errno(error);
 	}
 }
 

Modified: head/sys/compat/linux/linux.h
==============================================================================
--- head/sys/compat/linux/linux.h	Tue Oct 27 12:44:49 2020	(r367078)
+++ head/sys/compat/linux/linux.h	Tue Oct 27 12:49:40 2020	(r367079)
@@ -196,6 +196,6 @@ int linux_to_bsd_bits_(int value, struct bsd_to_linux_
 	}
 #define	BITMAP_1t1_LINUX(_name)	BITMAP_EASY_LINUX(_name, LINUX_##_name)
 
-int linux_to_bsd_errno(int error);
+int bsd_to_linux_errno(int error);
 
 #endif /* _LINUX_MI_H_ */

Modified: head/sys/compat/linux/linux_errno.c
==============================================================================
--- head/sys/compat/linux/linux_errno.c	Tue Oct 27 12:44:49 2020	(r367078)
+++ head/sys/compat/linux/linux_errno.c	Tue Oct 27 12:49:40 2020	(r367079)
@@ -11,7 +11,7 @@ __FBSDID("$FreeBSD$");
 #include <compat/linux/linux_errno.inc>
 
 int
-linux_to_bsd_errno(int error)
+bsd_to_linux_errno(int error)
 {
 
 	KASSERT(error >= 0 && error <= ELAST,

Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c	Tue Oct 27 12:44:49 2020	(r367078)
+++ head/sys/compat/linux/linux_socket.c	Tue Oct 27 12:49:40 2020	(r367079)
@@ -1559,7 +1559,7 @@ linux_getsockopt(struct thread *td, struct linux_getso
 			    name, &newval, UIO_SYSSPACE, &len);
 			if (error != 0)
 				return (error);
-			newval = -linux_to_bsd_errno(newval);
+			newval = -bsd_to_linux_errno(newval);
 			return (copyout(&newval, PTRIN(args->optval), len));
 			/* NOTREACHED */
 		default:

Modified: head/sys/i386/linux/linux_sysvec.c
==============================================================================
--- head/sys/i386/linux/linux_sysvec.c	Tue Oct 27 12:44:49 2020	(r367078)
+++ head/sys/i386/linux/linux_sysvec.c	Tue Oct 27 12:49:40 2020	(r367079)
@@ -800,7 +800,7 @@ linux_set_syscall_retval(struct thread *td, int error)
 
 	if (__predict_false(error != 0)) {
 		if (error != ERESTART && error != EJUSTRETURN)
-			frame->tf_eax = linux_to_bsd_errno(error);
+			frame->tf_eax = bsd_to_linux_errno(error);
 	}
 }
 


More information about the svn-src-head mailing list