git: ba40604902f1 - stable/13 - LinuxKPI: Use the proper API to determine the ABI of the running process.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 19:32:15 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=ba40604902f1e7489e90e08c06ed1c46ad7695c6

commit ba40604902f1e7489e90e08c06ed1c46ad7695c6
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2021-06-29 17:17:16 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:30:26 +0000

    LinuxKPI: Use the proper API to determine the ABI of the running process.
    
    Reviewed by:            markj, hselasky, kib
    Differential Revision:  https://reviews.freebsd.org/D30924
    MFC after:              2 weeks
    
    (cherry picked from commit 945accf502db0dd44522489857f461e29ef17d30)
---
 sys/compat/linuxkpi/common/src/linux_compat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index a574f8bad0f1..f3e018796249 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/rwlock.h>
 #include <sys/mman.h>
 #include <sys/stack.h>
+#include <sys/sysent.h>
 #include <sys/time.h>
 #include <sys/user.h>
 
@@ -1096,7 +1097,7 @@ linux_file_ioctl_sub(struct file *fp, struct linux_file *filp,
 		data = *(void **)data;
 	}
 #if defined(__amd64__)
-	if (td->td_proc->p_elf_machine == EM_386) {
+	if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
 		/* try the compat IOCTL handler first */
 		if (fop->compat_ioctl != NULL) {
 			error = -OPW(fp, td, fop->compat_ioctl(filp,