Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 2025 17:32:55 +0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Ricardo Branco <rbranco@suse.de>
Subject:   git: fe21dbf70aa8 - main - linux: Implement F_DUPFD_QUERY fcntl with kcmp(2) KCMP_FILE
Message-ID:  <693b0047.d90c.74555850@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help

The branch main has been updated by emaste:

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

commit fe21dbf70aa8c6dfd2010f30dd2d09f7b743e77d
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2025-12-08 22:30:31 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-12-11 17:32:10 +0000

    linux: Implement F_DUPFD_QUERY fcntl with kcmp(2) KCMP_FILE
    
    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_file.c | 8 ++++++++
 sys/compat/linux/linux_file.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index a4be5313aa96..daddafa325ad 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -1457,6 +1457,14 @@ fcntl_common(struct thread *td, struct linux_fcntl_args *args)
 		fdrop(fp, td);
 		return (0);
 
+	case LINUX_F_DUPFD_QUERY:
+		error = kern_kcmp(td, td->td_proc->p_pid, td->td_proc->p_pid,
+		    KCMP_FILE, args->fd, args->arg);
+		if (error != 0)
+			return (error);
+		td->td_retval[0] = (td->td_retval[0] == 0) ? 1 : 0;
+		return (0);
+
 	default:
 		linux_msg(td, "unsupported fcntl cmd %d", args->cmd);
 		return (EINVAL);
diff --git a/sys/compat/linux/linux_file.h b/sys/compat/linux/linux_file.h
index 7448dc597230..0b6ca536be7d 100644
--- a/sys/compat/linux/linux_file.h
+++ b/sys/compat/linux/linux_file.h
@@ -127,6 +127,7 @@
 
 #define	LINUX_F_SETLEASE	(LINUX_F_SPECIFIC_BASE + 0)
 #define	LINUX_F_GETLEASE	(LINUX_F_SPECIFIC_BASE + 1)
+#define	LINUX_F_DUPFD_QUERY	(LINUX_F_SPECIFIC_BASE + 3)
 #define	LINUX_F_CANCELLK	(LINUX_F_SPECIFIC_BASE + 5)
 #define	LINUX_F_DUPFD_CLOEXEC	(LINUX_F_SPECIFIC_BASE + 6)
 #define	LINUX_F_NOTIFY		(LINUX_F_SPECIFIC_BASE + 2)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?693b0047.d90c.74555850>