Module Name:    src
Committed By:   thorpej
Date:           Sun Jan  3 16:14:04 UTC 2021

Modified Files:
        src/sys/compat/linux32/common [thorpej-futex]: linux32_ioctl.c

Log Message:
Handle timerfd ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.8.1 src/sys/compat/linux32/common/linux32_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux32/common/linux32_ioctl.c
diff -u src/sys/compat/linux32/common/linux32_ioctl.c:1.14 src/sys/compat/linux32/common/linux32_ioctl.c:1.14.8.1
--- src/sys/compat/linux32/common/linux32_ioctl.c:1.14	Fri Aug 23 12:49:59 2019
+++ src/sys/compat/linux32/common/linux32_ioctl.c	Sun Jan  3 16:14:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_ioctl.c,v 1.14 2019/08/23 12:49:59 maxv Exp $ */
+/*	$NetBSD: linux32_ioctl.c,v 1.14.8.1 2021/01/03 16:14:04 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -32,13 +32,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_ioctl.c,v 1.14 2019/08/23 12:49:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_ioctl.c,v 1.14.8.1 2021/01/03 16:14:04 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/ucred.h>
 #include <sys/ioctl.h>
+#include <sys/file.h>
+#include <sys/filedesc.h> 
 
 #include <compat/netbsd32/netbsd32.h>
 #include <compat/netbsd32/netbsd32_syscallargs.h>
@@ -46,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux32_ioct
 #include <compat/linux/common/linux_types.h>
 #include <compat/linux/common/linux_signal.h>
 #include <compat/linux/common/linux_ipc.h>
+#include <compat/linux/common/linux_ioctl.h>
 #include <compat/linux/common/linux_sem.h>
 #include <compat/linux/linux_syscallargs.h>
 
@@ -80,8 +83,31 @@ linux32_sys_ioctl(struct lwp *l, const s
 
 	switch(group) {
 	case 'T':
-		error = linux32_ioctl_termios(l, uap, retval);
+	    {
+		/*
+		 * Termios, the MIDI sequencer, and timerfd use 'T' to
+		 * identify the ioctl, so we have to differentiate them
+		 * in another way.
+		 *
+		 * (XXX We don't bother with MIDI here.)
+		 */
+		struct file *fp;
+
+		if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
+			return EBADF;
+
+		if (fp->f_type == DTYPE_TIMERFD) {
+			struct linux_sys_ioctl_args ua;
+			SCARG(&ua, fd) = SCARG(uap, fd);
+			SCARG(&ua, com) = SCARG(uap, com);
+			SCARG(&ua, data) = SCARG_P32(uap, data);
+			error = linux_ioctl_timerfd(l, &ua, retval);
+		} else {
+			error = linux32_ioctl_termios(l, uap, retval);
+		}
+		fd_putfile(SCARG(uap, fd));
 		break;
+	    }
 	case 'M':
 	case 'Q':
 	case 'P':

Reply via email to