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
This commit is contained in:
Ricardo Branco
2025-12-08 23:30:31 +01:00
committed by Ed Maste
parent dbac191956
commit fe21dbf70a
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -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);
+1
View File
@@ -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)