Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej-futex]: src/sys/compat/linux32/common Handle timerfd ioctls.



details:   https://anonhg.NetBSD.org/src/rev/303fbd500947
branches:  thorpej-futex
changeset: 961140:303fbd500947
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Jan 03 16:14:04 2021 +0000

description:
Handle timerfd ioctls.

diffstat:

 sys/compat/linux32/common/linux32_ioctl.c |  32 ++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 3 deletions(-)

diffs (67 lines):

diff -r 358dae1929dc -r 303fbd500947 sys/compat/linux32/common/linux32_ioctl.c
--- a/sys/compat/linux32/common/linux32_ioctl.c Sun Jan 03 16:13:07 2021 +0000
+++ b/sys/compat/linux32/common/linux32_ioctl.c Sun Jan 03 16:14:04 2021 +0000
@@ -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 @@
 #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 @@
 
        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':



Home | Main Index | Thread Index | Old Index