Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Dec 2025 02:48:21 +0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        Ricardo Branco <rbranco@suse.de>
Subject:   git: 97b7a753ecb5 - stable/15 - linux: Add support for kcmp(2) system call
Message-ID:  <6944bcf5.3675e.602ac442@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by emaste:

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

commit 97b7a753ecb5c85bad237c02ca390d7d7d5a0fde
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2025-12-08 21:27:07 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-12-19 02:47:50 +0000

    linux: Add support for kcmp(2) system call
    
    Signed-off-by: Ricardo Branco <rbranco@suse.de>
    PR:             281690
    Reviewed by:    kib
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1920
    
    (cherry picked from commit dbac191956f9b51069617b09fd0a24ca0e7bfc12)
---
 sys/compat/linux/linux_dummy.c |  2 --
 sys/compat/linux/linux_misc.c  | 27 +++++++++++++++++++++++++++
 sys/compat/linux/linux_misc.h  | 11 +++++++++++
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c
index 19cd55849f65..46f98f4da1eb 100644
--- a/sys/compat/linux/linux_dummy.c
+++ b/sys/compat/linux/linux_dummy.c
@@ -96,8 +96,6 @@ DUMMY(setns);
 /* Linux 3.2: */
 DUMMY(process_vm_readv);
 DUMMY(process_vm_writev);
-/* Linux 3.5: */
-DUMMY(kcmp);
 /* Linux 3.8: */
 DUMMY(finit_module);
 DUMMY(sched_setattr);
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 0925ffb64480..69fb9935a9ae 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -54,6 +54,7 @@
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
 #include <sys/time.h>
+#include <sys/unistd.h>
 #include <sys/vmmeter.h>
 #include <sys/vnode.h>
 
@@ -3067,4 +3068,30 @@ linux_mq_getsetattr(struct thread *td, struct linux_mq_getsetattr_args *args)
 	return (error);
 }
 
+int
+linux_kcmp(struct thread *td, struct linux_kcmp_args *args)
+{
+	int type;
+
+	switch (args->type) {
+	case LINUX_KCMP_FILE:
+		type = KCMP_FILE;
+		break;
+	case LINUX_KCMP_FILES:
+		type = KCMP_FILES;
+		break;
+	case LINUX_KCMP_SIGHAND:
+		type = KCMP_SIGHAND;
+		break;
+	case LINUX_KCMP_VM:
+		type = KCMP_VM;
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	return (kern_kcmp(td, args->pid1, args->pid2, type, args->idx1,
+	    args->idx));
+}
+
 MODULE_DEPEND(linux, mqueuefs, 1, 1, 1);
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
index 2d2b12ef0127..63ed914afc63 100644
--- a/sys/compat/linux/linux_misc.h
+++ b/sys/compat/linux/linux_misc.h
@@ -216,4 +216,15 @@ struct syscall_info {
 #define	LINUX_IOPRIO_WHO_PGRP		2
 #define	LINUX_IOPRIO_WHO_USER		3
 
+/* Linux kcmp types from <linux/kcmp.h>	*/
+#define	LINUX_KCMP_FILE			0
+#define	LINUX_KCMP_VM			1
+#define	LINUX_KCMP_FILES		2
+#define	LINUX_KCMP_FS			3
+#define	LINUX_KCMP_SIGHAND		4
+#define	LINUX_KCMP_IO			5
+#define	LINUX_KCMP_SYSVSEM		6
+#define	LINUX_KCMP_EPOLL_TFD		7
+#define	LINUX_KCMP_TYPES		8
+
 #endif	/* _LINUX_MISC_H_ */


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6944bcf5.3675e.602ac442>