Source-Changes-HG archive

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

[src-draft/trunk]: src/sys WIP: regen



details:   https://anonhg.NetBSD.org/src-all/rev/0af31d85ef0e
branches:  trunk
changeset: 936859:0af31d85ef0e
user:      Taylor R Campbell <riastradh%NetBSD.org@localhost>
date:      Sat May 09 06:14:32 2020 +0000

description:
WIP: regen

diffstat:

 sys/kern/init_sysent.c                    |  10 ++++---
 sys/kern/syscalls.c                       |   8 +++---
 sys/kern/syscalls_autoload.c              |   4 +-
 sys/kern/systrace_args.c                  |  32 ++++++++++++++++++++++++-
 sys/rump/include/rump/rump_syscalls.h     |   7 ++++-
 sys/rump/librump/rumpkern/rump_syscalls.c |  40 +++++++++++++++++++++++++++---
 sys/rump/rump.sysmap                      |   1 +
 sys/sys/syscall.h                         |   5 +++-
 sys/sys/syscallargs.h                     |  11 +++++++-
 9 files changed, 99 insertions(+), 19 deletions(-)

diffs (truncated from 303 to 300 lines):

diff -r 012e3ce3d42f -r 0af31d85ef0e sys/kern/init_sysent.c
--- a/sys/kern/init_sysent.c    Fri May 08 07:32:41 2020 +0000
+++ b/sys/kern/init_sysent.c    Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysent.c,v 1.331 2020/04/26 19:16:36 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call switch table.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.331 2020/04/26 19:16:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD$");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -529,8 +529,10 @@
                .sy_call = (sy_call_t *)sys_dup2
        },              /* 90 = dup2 */
        {
-               .sy_call = sys_nosys,
-       },              /* 91 = filler */
+               ns(struct sys_getrandom_args),
+               .sy_flags = SYCALL_ARG_PTR,
+               .sy_call = (sy_call_t *)sys_getrandom
+       },              /* 91 = getrandom */
        {
                ns(struct sys_fcntl_args),
                .sy_flags = SYCALL_ARG_PTR,
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/kern/syscalls.c
--- a/sys/kern/syscalls.c       Fri May 08 07:32:41 2020 +0000
+++ b/sys/kern/syscalls.c       Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscalls.c,v 1.319 2020/04/26 19:16:36 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call names.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.319 2020/04/26 19:16:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD$");
 
 #if defined(_KERNEL_OPT)
 #ifdef _KERNEL_OPT
@@ -120,7 +120,7 @@
        /*  88 */       "compat_43_osethostname",
        /*  89 */       "compat_43_ogetdtablesize",
        /*  90 */       "dup2",
-       /*  91 */       "#91 (unimplemented getdopt)",
+       /*  91 */       "getrandom",
        /*  92 */       "fcntl",
        /*  93 */       "compat_50_select",
        /*  94 */       "#94 (unimplemented setdopt)",
@@ -657,7 +657,7 @@
        /*  88 */       NULL, /* compat_43_osethostname */
        /*  89 */       NULL, /* compat_43_ogetdtablesize */
        /*  90 */       NULL, /* dup2 */
-       /*  91 */       NULL, /* unimplemented getdopt */
+       /*  91 */       NULL, /* getrandom */
        /*  92 */       NULL, /* fcntl */
        /*  93 */       NULL, /* compat_50_select */
        /*  94 */       NULL, /* unimplemented setdopt */
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/kern/syscalls_autoload.c
--- a/sys/kern/syscalls_autoload.c      Fri May 08 07:32:41 2020 +0000
+++ b/sys/kern/syscalls_autoload.c      Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscalls_autoload.c,v 1.36 2020/04/26 19:16:36 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call autoload table.
@@ -8,7 +8,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.36 2020/04/26 19:16:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD$");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/kern/systrace_args.c
--- a/sys/kern/systrace_args.c  Fri May 08 07:32:41 2020 +0000
+++ b/sys/kern/systrace_args.c  Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: systrace_args.c,v 1.38 2020/04/26 19:16:36 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call argument to DTrace register array converstion.
@@ -663,6 +663,15 @@
                *n_args = 2;
                break;
        }
+       /* sys_getrandom */
+       case 91: {
+               const struct sys_getrandom_args *p = params;
+               uarg[0] = (intptr_t) SCARG(p, buf); /* void * */
+               uarg[1] = SCARG(p, buflen); /* size_t */
+               uarg[2] = SCARG(p, flags); /* unsigned int */
+               *n_args = 3;
+               break;
+       }
        /* sys_fcntl */
        case 92: {
                const struct sys_fcntl_args *p = params;
@@ -4755,6 +4764,22 @@
                        break;
                };
                break;
+       /* sys_getrandom */
+       case 91:
+               switch(ndx) {
+               case 0:
+                       p = "void *";
+                       break;
+               case 1:
+                       p = "size_t";
+                       break;
+               case 2:
+                       p = "unsigned int";
+                       break;
+               default:
+                       break;
+               };
+               break;
        /* sys_fcntl */
        case 92:
                switch(ndx) {
@@ -10452,6 +10477,11 @@
                if (ndx == 0 || ndx == 1)
                        p = "int";
                break;
+       /* sys_getrandom */
+       case 91:
+               if (ndx == 0 || ndx == 1)
+                       p = "ssize_t";
+               break;
        /* sys_fcntl */
        case 92:
                if (ndx == 0 || ndx == 1)
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/rump/include/rump/rump_syscalls.h
--- a/sys/rump/include/rump/rump_syscalls.h     Fri May 08 07:32:41 2020 +0000
+++ b/sys/rump/include/rump/rump_syscalls.h     Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.h,v 1.118 2020/04/26 19:16:36 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call protos in rump namespace.
@@ -208,6 +208,10 @@
 #define RUMP_SYS_RENAME_LCHMOD rump___sysimpl_lchmod
 #endif
 
+#ifndef RUMP_SYS_RENAME_GETRANDOM
+#define RUMP_SYS_RENAME_GETRANDOM rump___sysimpl_getrandom
+#endif
+
 #ifndef RUMP_SYS_RENAME___QUOTACTL
 #define RUMP_SYS_RENAME___QUOTACTL rump___sysimpl___quotactl
 #endif
@@ -900,6 +904,7 @@
 int rump_sys_getpgrp(void) __RENAME(RUMP_SYS_RENAME_GETPGRP);
 int rump_sys_setpgid(pid_t, pid_t) __RENAME(RUMP_SYS_RENAME_SETPGID);
 int rump_sys_dup2(int, int) __RENAME(RUMP_SYS_RENAME_DUP2);
+ssize_t rump_sys_getrandom(void *, size_t, unsigned int) __RENAME(RUMP_SYS_RENAME_GETRANDOM);
 int rump_sys_fcntl(int, int, ...) __RENAME(RUMP_SYS_RENAME_FCNTL);
 int rump_sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *) __RENAME(RUMP_SYS_RENAME_SELECT);
 int rump_sys_fsync(int) __RENAME(RUMP_SYS_RENAME_FSYNC);
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/rump/librump/rumpkern/rump_syscalls.c
--- a/sys/rump/librump/rumpkern/rump_syscalls.c Fri May 08 07:32:41 2020 +0000
+++ b/sys/rump/librump/rumpkern/rump_syscalls.c Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.c,v 1.149 2020/04/26 19:16:36 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call vector and marshalling for rump.
@@ -15,7 +15,7 @@
 
 #ifdef __NetBSD__
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.149 2020/04/26 19:16:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD$");
 
 #include <sys/fstypes.h>
 #include <sys/proc.h>
@@ -1275,6 +1275,36 @@
 __strong_alias(_sys_dup2,rump___sysimpl_dup2);
 #endif /* RUMP_KERNEL_IS_LIBC */
 
+ssize_t rump___sysimpl_getrandom(void *, size_t, unsigned int);
+ssize_t
+rump___sysimpl_getrandom(void * buf, size_t buflen, unsigned int flags)
+{
+       register_t retval[2];
+       int error = 0;
+       ssize_t rv = -1;
+       struct sys_getrandom_args callarg;
+
+       memset(&callarg, 0, sizeof(callarg));
+       SPARG(&callarg, buf) = buf;
+       SPARG(&callarg, buflen) = buflen;
+       SPARG(&callarg, flags) = flags;
+
+       error = rsys_syscall(SYS_getrandom, &callarg, sizeof(callarg), retval);
+       rsys_seterrno(error);
+       if (error == 0) {
+               if (sizeof(ssize_t) > sizeof(register_t))
+                       rv = *(ssize_t *)retval;
+               else
+                       rv = *retval;
+       }
+       return rv;
+}
+#ifdef RUMP_KERNEL_IS_LIBC
+__weak_alias(getrandom,rump___sysimpl_getrandom);
+__weak_alias(_getrandom,rump___sysimpl_getrandom);
+__strong_alias(_sys_getrandom,rump___sysimpl_getrandom);
+#endif /* RUMP_KERNEL_IS_LIBC */
+
 int rump___sysimpl_fcntl(int, int, void *);
 int
 rump___sysimpl_fcntl(int fd, int cmd, void * arg)
@@ -6894,9 +6924,9 @@
                .sy_call = (sy_call_t *)(void *)rumpns_enosys,
        },              /* 90 = dup2 */
        {
-               .sy_flags = SYCALL_NOSYS,
-               .sy_call = (sy_call_t *)(void *)rumpns_enosys,
-       },              /* 91 = filler */
+               ns(struct sys_getrandom_args),
+               .sy_call = (sy_call_t *)(void *)rumpns_enosys,
+       },              /* 91 = getrandom */
        {
                ns(struct sys_fcntl_args),
                .sy_call = (sy_call_t *)(void *)rumpns_enosys,
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/rump/rump.sysmap
--- a/sys/rump/rump.sysmap      Fri May 08 07:32:41 2020 +0000
+++ b/sys/rump/rump.sysmap      Sat May 09 06:14:32 2020 +0000
@@ -43,6 +43,7 @@
 81   sys_getpgrp            getpgrp            rump___sysimpl_getpgrp
 82   sys_setpgid            setpgid            rump___sysimpl_setpgid
 90   sys_dup2               dup2               rump___sysimpl_dup2
+91   sys_getrandom          getrandom          rump___sysimpl_getrandom
 92   sys_fcntl              fcntl              rump___sysimpl_fcntl
 93   sys_nomodule           select             rump___sysimpl_select
 95   sys_fsync              fsync              rump___sysimpl_fsync
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/sys/syscall.h
--- a/sys/sys/syscall.h Fri May 08 07:32:41 2020 +0000
+++ b/sys/sys/syscall.h Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.h,v 1.313 2020/04/26 19:16:35 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call numbers.
@@ -271,6 +271,9 @@
 /* syscall: "dup2" ret: "int" args: "int" "int" */
 #define        SYS_dup2        90
 
+/* syscall: "getrandom" ret: "ssize_t" args: "void *" "size_t" "unsigned int" */
+#define        SYS_getrandom   91
+
 /* syscall: "fcntl" ret: "int" args: "int" "int" "..." */
 #define        SYS_fcntl       92
 
diff -r 012e3ce3d42f -r 0af31d85ef0e sys/sys/syscallargs.h
--- a/sys/sys/syscallargs.h     Fri May 08 07:32:41 2020 +0000
+++ b/sys/sys/syscallargs.h     Sat May 09 06:14:32 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscallargs.h,v 1.297 2020/04/26 19:16:35 thorpej Exp $ */
+/* $NetBSD$ */
 
 /*
  * System call argument lists.
@@ -545,6 +545,13 @@
 };
 check_syscall_args(sys_dup2)
 
+struct sys_getrandom_args {
+       syscallarg(void *) buf;
+       syscallarg(size_t) buflen;
+       syscallarg(unsigned int) flags;
+};
+check_syscall_args(sys_getrandom)
+
 struct sys_fcntl_args {
        syscallarg(int) fd;
        syscallarg(int) cmd;
@@ -3378,6 +3385,8 @@
 
 int    sys_dup2(struct lwp *, const struct sys_dup2_args *, register_t *);
 
+int    sys_getrandom(struct lwp *, const struct sys_getrandom_args *, register_t *);
+



Home | Main Index | Thread Index | Old Index