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 POSIX timer syscalls (time...



details:   https://anonhg.NetBSD.org/src/rev/0807aa75da3b
branches:  trunk
changeset: 986326:0807aa75da3b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 19 23:01:49 2021 +0000

description:
Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.

diffstat:

 sys/compat/linux/arch/alpha/syscalls.master   |   16 +-
 sys/compat/linux/arch/amd64/syscalls.master   |   16 +-
 sys/compat/linux/arch/arm/syscalls.master     |   16 +-
 sys/compat/linux/arch/i386/syscalls.master    |   16 +-
 sys/compat/linux/arch/m68k/syscalls.master    |   16 +-
 sys/compat/linux/arch/mips/syscalls.master    |   16 +-
 sys/compat/linux/arch/powerpc/syscalls.master |   16 +-
 sys/compat/linux/common/linux_sched.h         |   33 ++++-
 sys/compat/linux/common/linux_time.c          |  175 ++++++++++++++++++++++++-
 sys/compat/linux32/arch/amd64/syscalls.master |   16 +-
 sys/compat/linux32/common/linux32_sched.h     |   19 ++-
 sys/compat/linux32/common/linux32_time.c      |  122 +++++++++++++++++-
 12 files changed, 402 insertions(+), 75 deletions(-)

diffs (truncated from 740 to 300 lines):

diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/arch/alpha/syscalls.master
--- a/sys/compat/linux/arch/alpha/syscalls.master       Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/arch/alpha/syscalls.master       Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.97 2020/04/26 18:53:32 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.98 2021/09/19 23:01:49 thorpej Exp $
 ;
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -663,11 +663,15 @@
 412    UNIMPL          restart_syscall
 413    STD             { int|linux_sys||fadvise64(int fd, off_t offset, \
                            size_t len, int advice); }
-414    UNIMPL          timer_create
-415    UNIMPL          timer_settime
-416    UNIMPL          timer_gettime
-417    UNIMPL          timer_getoverrun
-418    UNIMPL          timer_delete
+414    STD             { int|linux_sys||timer_create(clockid_t clockid, \
+                           struct linux_sigevent *evp, timer_t *timerid); }
+415    STD             { int|linux_sys||timer_settime(timer_t timerid, \
+                           int flags, const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+416    STD             { int|linux_sys||timer_gettime(timer_t timerid, \
+                           struct linux_itimerspec *tim); }
+417    NOARGS          { int|sys||timer_getoverrun(timer_t timerid); }
+418    NOARGS          { int|sys||timer_delete(timer_t timerid); }
 419    STD             { int|linux_sys||clock_settime(clockid_t which, \
                            struct linux_timespec *tp); }
 420    STD             { int|linux_sys||clock_gettime(clockid_t which, \
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/arch/amd64/syscalls.master
--- a/sys/compat/linux/arch/amd64/syscalls.master       Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/arch/amd64/syscalls.master       Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.62 2020/04/26 18:53:32 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.63 2021/09/19 23:01:49 thorpej Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -423,11 +423,15 @@
 220    UNIMPL          semtimedop
 221    STD             { int|linux_sys||fadvise64(int fd, off_t offset, \
                            size_t len, int advice); }
-222    UNIMPL          timer_create
-223    UNIMPL          timer_settime
-224    UNIMPL          timer_gettime
-225    UNIMPL          timer_getoverrun
-226    UNIMPL          timer_delete
+222    STD             { int|linux_sys||timer_create(clockid_t clockid, \
+                           struct linux_sigevent *evp, timer_t *timerid); }
+223    STD             { int|linux_sys||timer_settime(timer_t timerid, \
+                           int flags, const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+224    STD             { int|linux_sys||timer_gettime(timer_t timerid, \
+                           struct linux_itimerspec *tim); }
+225    NOARGS          { int|sys||timer_getoverrun(timer_t timerid); }
+226    NOARGS          { int|sys||timer_delete(timer_t timerid); }
 227    STD             { int|linux_sys||clock_settime(clockid_t which, \
                            struct linux_timespec *tp); }
 228    STD             { int|linux_sys||clock_gettime(clockid_t which, \
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/arch/arm/syscalls.master
--- a/sys/compat/linux/arch/arm/syscalls.master Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/arch/arm/syscalls.master Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.69 2020/04/26 18:53:32 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.70 2021/09/19 23:01:49 thorpej Exp $
 
 ; Derived from sys/compat/linux/arch/*/syscalls.master
 ; and from Linux 2.4.12 arch/arm/kernel/calls.S
@@ -431,11 +431,15 @@
 254    UNIMPL          set_thread_area
 255    UNIMPL          get_thread_area
 256    STD             { int|linux_sys||set_tid_address(int *tid); }
-257    UNIMPL          timer_create
-258    UNIMPL          timer_settime
-259    UNIMPL          timer_gettime
-260    UNIMPL          timer_getoverrun
-261    UNIMPL          timer_delete
+257    STD             { int|linux_sys||timer_create(clockid_t clockid, \
+                           struct linux_sigevent *evp, timer_t *timerid); }
+258    STD             { int|linux_sys||timer_settime(timer_t timerid, \
+                           int flags, const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+259    STD             { int|linux_sys||timer_gettime(timer_t timerid, \
+                           struct linux_itimerspec *tim); }
+260    NOARGS          { int|sys||timer_getoverrun(timer_t timerid); }
+261    NOARGS          { int|sys||timer_delete(timer_t timerid); }
 262    STD             { int|linux_sys||clock_settime(clockid_t which, \
                            struct linux_timespec *tp); }
 263    STD             { int|linux_sys||clock_gettime(clockid_t which, \
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/arch/i386/syscalls.master
--- a/sys/compat/linux/arch/i386/syscalls.master        Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/arch/i386/syscalls.master        Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.124 2020/04/26 18:53:32 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.125 2021/09/19 23:01:50 thorpej Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -433,11 +433,15 @@
 256    UNIMPL          epoll_wait
 257    UNIMPL          remap_file_pages
 258    STD             { int|linux_sys||set_tid_address(int *tid); }
-259    UNIMPL          timer_create
-260    UNIMPL          timer_settime
-261    UNIMPL          timer_gettime
-262    UNIMPL          timer_getoverrun
-263    UNIMPL          timer_delete
+259    STD             { int|linux_sys||timer_create(clockid_t clockid, \
+                           struct linux_sigevent *evp, timer_t *timerid); }
+260    STD             { int|linux_sys||timer_settime(timer_t timerid, \
+                           int flags, const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+261    STD             { int|linux_sys||timer_gettime(timer_t timerid, \
+                           struct linux_itimerspec *tim); }
+262    NOARGS          { int|sys||timer_getoverrun(timer_t timerid); }
+263    NOARGS          { int|sys||timer_delete(timer_t timerid); }
 264    STD             { int|linux_sys||clock_settime(clockid_t which, \
                            struct linux_timespec *tp); }
 265    STD             { int|linux_sys||clock_gettime(clockid_t which, \
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/arch/m68k/syscalls.master
--- a/sys/compat/linux/arch/m68k/syscalls.master        Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/arch/m68k/syscalls.master        Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.95 2020/04/26 18:53:32 thorpej Exp $
+       $NetBSD: syscalls.master,v 1.96 2021/09/19 23:01:50 thorpej Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -443,11 +443,15 @@
 251    UNIMPL          epoll_wait
 252    UNIMPL          remap_file_pages
 253    STD             { int|linux_sys||set_tid_address(int *tid); }
-254    UNIMPL          timer_create
-255    UNIMPL          timer_settime
-256    UNIMPL          timer_gettime
-257    UNIMPL          timer_getoverrun
-258    UNIMPL          timer_ delete
+254    STD             { int|linux_sys||timer_create(clockid_t clockid, \
+                           struct linux_sigevent *evp, timer_t *timerid); }
+255    STD             { int|linux_sys||timer_settime(timer_t timerid, \
+                           int flags, const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+256    STD             { int|linux_sys||timer_gettime(timer_t timerid, \
+                           struct linux_itimerspec *tim); }
+257    NOARGS          { int|sys||timer_getoverrun(timer_t timerid); }
+258    NOARGS          { int|sys||timer_delete(timer_t timerid); }
 259    STD             { int|linux_sys||clock_settime(clockid_t which, \
                            struct linux_timespec *tp); }
 260    STD             { int|linux_sys||clock_gettime(clockid_t which, \
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/arch/mips/syscalls.master
--- a/sys/compat/linux/arch/mips/syscalls.master        Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/arch/mips/syscalls.master        Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.68 2020/04/26 18:53:32 thorpej Exp $  
+       $NetBSD: syscalls.master,v 1.69 2021/09/19 23:01:50 thorpej Exp $  
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -439,11 +439,15 @@
                            size_t sz, struct linux_statfs64 *sp); }
 256    STD             { int|linux_sys||fstatfs64(int fd, \
                            size_t sz, struct linux_statfs64 *sp); }
-257    UNIMPL          timer_create
-258    UNIMPL          timer_settime
-259    UNIMPL          timer_gettime
-260    UNIMPL          timer_getoverrun
-261    UNIMPL          timer_delete
+257    STD             { int|linux_sys||timer_create(clockid_t clockid, \
+                           struct linux_sigevent *evp, timer_t *timerid); }
+258    STD             { int|linux_sys||timer_settime(timer_t timerid, \
+                           int flags, const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+259    STD             { int|linux_sys||timer_gettime(timer_t timerid, \
+                           struct linux_itimerspec *tim); }
+260    NOARGS          { int|sys||timer_getoverrun(timer_t timerid); }
+261    NOARGS          { int|sys||timer_delete(timer_t timerid); }
 262    STD             { int|linux_sys||clock_settime(clockid_t which, \
                            struct linux_timespec *tp); }
 263    STD             { int|linux_sys||clock_gettime(clockid_t which, \
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/arch/powerpc/syscalls.master
--- a/sys/compat/linux/arch/powerpc/syscalls.master     Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/arch/powerpc/syscalls.master     Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.74 2020/04/26 18:53:32 thorpej Exp $  
+       $NetBSD: syscalls.master,v 1.75 2021/09/19 23:01:50 thorpej Exp $  
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -429,11 +429,15 @@
 237    UNIMPL          epoll_ctl
 238    UNIMPL          epoll_wait
 239    UNIMPL          remap_file_pages
-240    UNIMPL          timer_create
-241    UNIMPL          timer_settime
-242    UNIMPL          timer_gettime
-243    UNIMPL          timer_getoverrun
-244    UNIMPL          timer_delete
+240    STD             { int|linux_sys||timer_create(clockid_t clockid, \
+                           struct linux_sigevent *evp, timer_t *timerid); }
+241    STD             { int|linux_sys||timer_settime(timer_t timerid, \
+                           int flags, const struct linux_itimerspec *tim, \
+                           struct linux_itimerspec *otim); }
+242    STD             { int|linux_sys||timer_gettime(timer_t timerid, \
+                           struct linux_itimerspec *tim); }
+243    NOARGS          { int|sys||timer_getoverrun(timer_t timerid); }
+244    NOARGS          { int|sys||timer_delete(timer_t timerid); }
 245    STD             { int|linux_sys||clock_settime(clockid_t which, \
                            struct linux_timespec *tp); }
 246    STD             { int|linux_sys||clock_gettime(clockid_t which, \
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/common/linux_sched.h
--- a/sys/compat/linux/common/linux_sched.h     Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/common/linux_sched.h     Sun Sep 19 23:01:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_sched.h,v 1.8 2011/11/18 04:07:44 christos Exp $ */
+/*     $NetBSD: linux_sched.h,v 1.9 2021/09/19 23:01:50 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -74,15 +74,36 @@
        long            tv_nsec;        /* nanoseconds */
 };
 
+struct linux_itimerspec {
+       struct linux_timespec it_interval;
+       struct linux_timespec it_value;
+};
+
 #define LINUX_CLOCK_REALTIME           0
 #define LINUX_CLOCK_MONOTONIC          1
 #define LINUX_CLOCK_PROCESS_CPUTIME_ID 2
 #define LINUX_CLOCK_THREAD_CPUTIME_ID  3
-#define LINUX_CLOCK_REALTIME_HR                4
-#define LINUX_CLOCK_MONOTONIC_HR       5
+#define LINUX_CLOCK_MONOTONIC_RAW      4
+#define        LINUX_CLOCK_REALTIME_COARSE     5
+#define        LINUX_CLOCK_MONOTONIC_COARSE    6
+#define        LINUX_CLOCK_BOOTTIME            7
+#define        LINUX_CLOCK_BOOTTIME_ALARM      8
+#define        LINUX_CLOCK_REALTIME_ALARM      9
+
+#define LINUX_TIMER_ABSTIME            0x01
+
+int    linux_to_native_clockid(clockid_t *, clockid_t);
 
-int linux_to_native_clockid(clockid_t *, clockid_t);
-void native_to_linux_timespec(struct linux_timespec *, struct timespec *);
-void linux_to_native_timespec(struct timespec *, struct linux_timespec *);
+void   native_to_linux_timespec(struct linux_timespec *,
+           const struct timespec *);
+void   linux_to_native_timespec(struct timespec *,
+           const struct linux_timespec *);
+
+void   native_to_linux_itimerspec(struct linux_itimerspec *,
+           const struct itimerspec *);
+void   linux_to_native_itimerspec(struct itimerspec *,
+           const struct linux_itimerspec *);
+
+int    linux_to_native_timer_create_clockid(clockid_t *, clockid_t);
 
 #endif /* _LINUX_SCHED_H */
diff -r 0fab72613428 -r 0807aa75da3b sys/compat/linux/common/linux_time.c
--- a/sys/compat/linux/common/linux_time.c      Sun Sep 19 22:32:45 2021 +0000
+++ b/sys/compat/linux/common/linux_time.c      Sun Sep 19 23:01:49 2021 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: linux_time.c,v 1.40 2021/09/07 11:43:04 riastradh Exp $ */
+/*     $NetBSD: linux_time.c,v 1.41 2021/09/19 23:01:50 thorpej Exp $ */
 
 /*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Emmanuel Dreyfus.
+ * by Emmanuel Dreyfus, and by Jason R. Thorpe.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.40 2021/09/07 11:43:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.41 2021/09/19 23:01:50 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/ucred.h>
@@ -47,6 +47,7 @@
 
 #include <compat/linux/common/linux_types.h>
 #include <compat/linux/common/linux_signal.h>
+#include <compat/linux/common/linux_sigevent.h>
 #include <compat/linux/common/linux_machdep.h>
 #include <compat/linux/common/linux_sched.h>
 #include <compat/linux/common/linux_ipc.h>
@@ -56,6 +57,8 @@
 
 #include <compat/common/compat_util.h>
 



Home | Main Index | Thread Index | Old Index