Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/linux32/common Add the timerfd syscalls to COMPAT...



details:   https://anonhg.NetBSD.org/src/rev/652f35d80c81
branches:  trunk
changeset: 986328:652f35d80c81
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 19 23:51:36 2021 +0000

description:
Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.

diffstat:

 sys/compat/linux/arch/alpha/syscalls.master   |   12 +-
 sys/compat/linux/arch/amd64/syscalls.master   |   12 +-
 sys/compat/linux/arch/arm/syscalls.master     |   12 +-
 sys/compat/linux/arch/i386/syscalls.master    |   12 +-
 sys/compat/linux/arch/m68k/syscalls.master    |   12 +-
 sys/compat/linux/arch/mips/syscalls.master    |   12 +-
 sys/compat/linux/arch/powerpc/syscalls.master |   12 +-
 sys/compat/linux/common/linux_ioctl.c         |   55 ++++----
 sys/compat/linux/common/linux_ioctl.h         |    4 +-
 sys/compat/linux/common/linux_sched.h         |    4 +-
 sys/compat/linux/common/linux_time.c          |  153 +++++++++++++++++++++++++-
 sys/compat/linux32/arch/amd64/syscalls.master |   12 +-
 sys/compat/linux32/common/linux32_ioctl.c     |   32 ++++-
 sys/compat/linux32/common/linux32_time.c      |   71 +++++++++++-
 14 files changed, 348 insertions(+), 67 deletions(-)

diffs (truncated from 702 to 300 lines):

diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/arch/alpha/syscalls.master
--- a/sys/compat/linux/arch/alpha/syscalls.master       Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/arch/alpha/syscalls.master       Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.98 2021/09/19 23:01:49 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.99 2021/09/19 23:51:36 thorpej Exp $
 ;
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -770,9 +770,13 @@
                            unsigned int flags, struct timespec *timeout); }
 480    STD             { int|linux_sys||fallocate(int fd, int mode, \
                            off_t offset, off_t len); }
-481    UNIMPL          timerfd_create
-482    UNIMPL          timerfd_settime
-483    UNIMPL          timerfd_gettime
+481    STD             { int|linux_sys||timerfd_create(clockid_t clock_id, \
+                           int flags); }
+482    STD             { int|linux_sys||timerfd_settime(int fd, int flags, \
+                           const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+483    STD             { int|linux_sys||timerfd_gettime(int fd, \
+                           struct linux_itimerspec *tim); }
 484    UNIMPL          signalfd4
 485    UNIMPL          eventfd2
 486    UNIMPL          epoll_create1
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/arch/amd64/syscalls.master
--- a/sys/compat/linux/arch/amd64/syscalls.master       Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/arch/amd64/syscalls.master       Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.63 2021/09/19 23:01:49 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.64 2021/09/19 23:51:36 thorpej Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -519,12 +519,16 @@
                            struct linux_timespec *times, int flag); }
 281    UNIMPL          epoll_pwait
 282    UNIMPL          signalfd
-283    UNIMPL          timerfd_create
+283    STD             { int|linux_sys||timerfd_create(clockid_t clock_id, \
+                           int flags); }
 284    UNIMPL          eventfd
 285    STD             { int|linux_sys||fallocate(int fd, int mode, \
                            off_t offset, off_t len); }
-286    UNIMPL          timerfd_settime
-287    UNIMPL          timerfd_gettime
+286    STD             { int|linux_sys||timerfd_settime(int fd, int flags, \
+                           const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+287    STD             { int|linux_sys||timerfd_gettime(int fd, \
+                           struct linux_itimerspec *tim); }
 288    STD             { int|linux_sys||accept4(int s, \
                            struct osockaddr *name, \
                            int *anamelen, int flags); }
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/arch/arm/syscalls.master
--- a/sys/compat/linux/arch/arm/syscalls.master Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/arch/arm/syscalls.master Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.70 2021/09/19 23:01:49 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.71 2021/09/19 23:51:36 thorpej Exp $
 
 ; Derived from sys/compat/linux/arch/*/syscalls.master
 ; and from Linux 2.4.12 arch/arm/kernel/calls.S
@@ -562,12 +562,16 @@
 348    STD             { int|linux_sys||utimensat(int fd, const char *path, \
                            struct linux_timespec *times, int flag); }
 349    UNIMPL          signalfd
-350    UNIMPL          timerfd_create
+350    STD             { int|linux_sys||timerfd_create(clockid_t clock_id, \
+                           int flags); }
 351    UNIMPL          eventfd
 352    STD             { int|linux_sys||fallocate(int fd, int mode, \
                            off_t offset, off_t len); }
-353    UNIMPL          timerfd_settime
-354    UNIMPL          timerfd_gettime
+353    STD             { int|linux_sys||timerfd_settime(int fd, int flags, \
+                           const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+354    STD             { int|linux_sys||timerfd_gettime(int fd, \
+                           struct linux_itimerspec *tim); }
 355    UNIMPL          signalfd4
 356    UNIMPL          eventfd2
 357    UNIMPL          epoll_create1
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/arch/i386/syscalls.master
--- a/sys/compat/linux/arch/i386/syscalls.master        Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/arch/i386/syscalls.master        Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.125 2021/09/19 23:01:50 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.126 2021/09/19 23:51:36 thorpej Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -529,12 +529,16 @@
 320    STD             { int|linux_sys||utimensat(int fd, const char *path, \
                            struct linux_timespec *times, int flag); }
 321    UNIMPL          signalfd
-322    UNIMPL          timerfd_create
+322    STD             { int|linux_sys||timerfd_create(clockid_t clock_id, \
+                           int flags); }
 323    UNIMPL          eventfd
 324    STD             { int|linux_sys||fallocate(int fd, int mode, \
                            off_t offset, off_t len); }
-325    UNIMPL          timerfd_settime
-326    UNIMPL          timerfd_gettime
+325    STD             { int|linux_sys||timerfd_settime(int fd, int flags, \
+                           const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+326    STD             { int|linux_sys||timerfd_gettime(int fd, \
+                           struct linux_itimerspec *tim); }
 327    UNIMPL          signalfd4
 328    UNIMPL          eventfd2
 329    UNIMPL          epoll_create1
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/arch/m68k/syscalls.master
--- a/sys/compat/linux/arch/m68k/syscalls.master        Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/arch/m68k/syscalls.master        Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.96 2021/09/19 23:01:50 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.97 2021/09/19 23:51:36 thorpej Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -547,12 +547,16 @@
 316    STD             { int|linux_sys||utimensat(int fd, const char *path, \
                            struct linux_timespec *times, int flag); }
 317    UNIMPL          signalfd
-318    UNIMPL          timerfd_create
+318    STD             { int|linux_sys||timerfd_create(clockid_t clock_id, \
+                           int flags); }
 319    UNIMPL          eventfd
 320    STD             { int|linux_sys||fallocate(int fd, int mode, \
                            off_t offset, off_t len); }
-321    UNIMPL          timerfd_settime
-322    UNIMPL          timerfd_gettime
+321    STD             { int|linux_sys||timerfd_settime(int fd, int flags, \
+                           const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+322    STD             { int|linux_sys||timerfd_gettime(int fd, \
+                           struct linux_itimerspec *tim); }
 323    UNIMPL          signalfd4
 324    UNIMPL          eventfd2
 325    UNIMPL          epoll_create1
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/arch/mips/syscalls.master
--- a/sys/compat/linux/arch/mips/syscalls.master        Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/arch/mips/syscalls.master        Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.69 2021/09/19 23:01:50 thorpej Exp $  
+       $NetBSD: syscalls.master,v 1.70 2021/09/19 23:51:37 thorpej Exp $  
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -539,9 +539,13 @@
 319    UNIMPL          eventfd
 320    STD             { int|linux_sys||fallocate(int fd, int mode, \
                            off_t offset, off_t len); }
-321    UNIMPL          timerfd_create
-322    UNIMPL          timerfd_gettime
-323    UNIMPL          timerfd_settime
+321    STD             { int|linux_sys||timerfd_create(clockid_t clock_id, \
+                           int flags); }
+322    STD             { int|linux_sys||timerfd_gettime(int fd, \
+                           struct linux_itimerspec *tim); }
+323    STD             { int|linux_sys||timerfd_settime(int fd, int flags, \
+                           const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
 324    UNIMPL          signalfd4
 325    UNIMPL          eventfd2
 326    UNIMPL          epoll_create1
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/arch/powerpc/syscalls.master
--- a/sys/compat/linux/arch/powerpc/syscalls.master     Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/arch/powerpc/syscalls.master     Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.75 2021/09/19 23:01:50 thorpej Exp $  
+       $NetBSD: syscalls.master,v 1.76 2021/09/19 23:51:37 thorpej Exp $  
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -533,14 +533,18 @@
 304    STD             { int|linux_sys||utimensat(int fd, const char *path, \
                            struct linux_timespec *times, int flag); }
 305    UNIMPL          signalfd
-306    UNIMPL          timerfd_create
+306    STD             { int|linux_sys||timerfd_create(clockid_t clock_id, \
+                           int flags); }
 307    UNIMPL          eventfd
 308    UNIMPL          sync_file_range2
 309    STD             { int|linux_sys||fallocate(int fd, int mode, \
                            off_t offset, off_t len); }
 310    UNIMPL          subpage_prot
-311    UNIMPL          timerfd_settime
-312    UNIMPL          timerfd_gettime
+311    STD             { int|linux_sys||timerfd_settime(int fd, int flags, \
+                           const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+312    STD             { int|linux_sys||timerfd_gettime(int fd, \
+                           struct linux_itimerspec *tim); }
 313    UNIMPL          signalfd4
 314    UNIMPL          eventfd2
 315    UNIMPL          epoll_create1
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/common/linux_ioctl.c
--- a/sys/compat/linux/common/linux_ioctl.c     Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/common/linux_ioctl.c     Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_ioctl.c,v 1.58 2014/03/23 06:03:38 dholland Exp $        */
+/*     $NetBSD: linux_ioctl.c,v 1.59 2021/09/19 23:51:37 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.58 2014/03/23 06:03:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.59 2021/09/19 23:51:37 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "sequencer.h"
@@ -144,46 +144,49 @@
                error = linux_ioctl_mtio(l, uap, retval);
                break;
        case 'T':
-       {
-#if NSEQUENCER > 0
-/* XXX XAX 2x check this. */
+           {
                /*
-                * Both termios and the MIDI sequencer use 'T' to identify
-                * the ioctl, so we have to differentiate them in another
-                * way.  We do it by indexing in the cdevsw with the major
-                * device number and check if that is the sequencer entry.
+                * Termios, the MIDI sequencer, and timerfd use 'T' to
+                * identify the ioctl, so we have to differentiate them
+                * in another way.
+                *
+                * XXX XAX 2x check this.
                 */
-               bool is_sequencer = false;
                struct file *fp;
-               struct vnode *vp;
-               struct vattr va;
-               extern const struct cdevsw sequencer_cdevsw;
 
                if ((fp = fd_getfile(SCARG(uap, fd))) == NULL)
                        return EBADF;
+
+               if (fp->f_type == DTYPE_TIMERFD) {
+                       error = linux_ioctl_timerfd(l, uap, retval);
+                       fd_putfile(SCARG(uap, fd));
+                       break;
+               }
+#if NSEQUENCER > 0
+               struct vnode *vp;
+
                if (fp->f_type == DTYPE_VNODE &&
                    (vp = (struct vnode *)fp->f_data) != NULL &&
                    vp->v_type == VCHR) {
+                       struct vattr va;
+                       extern const struct cdevsw sequencer_cdevsw;
+
                        vn_lock(vp, LK_SHARED | LK_RETRY);
                        error = VOP_GETATTR(vp, &va, l->l_cred);
                        VOP_UNLOCK(vp);
                        if (error == 0 &&
-                           cdevsw_lookup(va.va_rdev) == &sequencer_cdevsw)
-                               is_sequencer = true;
-               }
-               if (is_sequencer) {
-                       error = oss_ioctl_sequencer(l, (const void *)LINUX_TO_OSS(uap),
-                                                  retval);
+                           cdevsw_lookup(va.va_rdev) == &sequencer_cdevsw) {
+                               error = oss_ioctl_sequencer(l,
+                                   (const void *)LINUX_TO_OSS(uap), retval);
+                               fd_putfile(SCARG(uap, fd));
+                               break;
+                       }
                }
-               else {
-                       error = linux_ioctl_termios(l, uap, retval);
-               }
+#endif /* NSEQUENCER > 0 */
+               error = linux_ioctl_termios(l, uap, retval);
                fd_putfile(SCARG(uap, fd));
-#else
-               error = linux_ioctl_termios(l, uap, retval);
-#endif
-       }
                break;
+           }
        case '"':
                error = linux_ioctl_sg(l, uap, retval);
                break;
diff -r 3d95977d905c -r 652f35d80c81 sys/compat/linux/common/linux_ioctl.h
--- a/sys/compat/linux/common/linux_ioctl.h     Sun Sep 19 23:02:22 2021 +0000
+++ b/sys/compat/linux/common/linux_ioctl.h     Sun Sep 19 23:51:36 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_ioctl.h,v 1.27 2013/06/08 12:50:32 stacktic Exp $        */
+/*     $NetBSD: linux_ioctl.h,v 1.28 2021/09/19 23:51:37 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.



Home | Main Index | Thread Index | Old Index