Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Dec 2025 02:48:22 +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: ec8d0b5f5dfb - stable/15 - linux: Implement F_DUPFD_QUERY fcntl with kcmp(2) KCMP_FILE
Message-ID:  <6944bcf6.376fe.582c4f5f@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=ec8d0b5f5dfb2711c2403b11d93ef26a81e764d2

commit ec8d0b5f5dfb2711c2403b11d93ef26a81e764d2
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2025-12-08 22:30:31 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-12-19 02:47:50 +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
    (cherry picked from commit fe21dbf70aa8c6dfd2010f30dd2d09f7b743e77d)
---
 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)


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6944bcf6.376fe.582c4f5f>