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
This commit is contained in:
Edward Tomasz Napierala 2020-10-27 12:49:40 +00:00
parent eb81dfb3af
commit 866b1f5147
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367079
7 changed files with 8 additions and 10 deletions

View File

@ -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;
}

View File

@ -678,7 +678,7 @@ linux32_set_syscall_retval(struct thread *td, int error)
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);
}
}

View File

@ -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);
}
}

View File

@ -196,6 +196,6 @@ int linux_to_bsd_bits_(int value, struct bsd_to_linux_bitmap *bitmap,
}
#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_ */

View File

@ -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,

View File

@ -1559,7 +1559,7 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
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:

View File

@ -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);
}
}