git: dbac191956f9 - main - linux: Add support for kcmp(2) system call
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Dec 2025 17:32:54 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=dbac191956f9b51069617b09fd0a24ca0e7bfc12
commit dbac191956f9b51069617b09fd0a24ca0e7bfc12
Author: Ricardo Branco <rbranco@suse.de>
AuthorDate: 2025-12-08 21:27:07 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-12-11 17:31:47 +0000
linux: Add support for kcmp(2) system call
Signed-off-by: Ricardo Branco <rbranco@suse.de>
Reviewed by: kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1920
---
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_ */