Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Teach about getrandom(2) to COMPAT_NETBS...



details:   https://anonhg.NetBSD.org/src/rev/cc65c4bb7fdd
branches:  trunk
changeset: 940546:cc65c4bb7fdd
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Oct 10 00:00:54 2020 +0000

description:
Teach about getrandom(2) to COMPAT_NETBSD32.

diffstat:

 sys/compat/netbsd32/netbsd32_netbsd.c |  20 ++++++++++++++++++--
 sys/compat/netbsd32/syscalls.master   |   6 ++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diffs (61 lines):

diff -r ef2c35f1cdcc -r cc65c4bb7fdd sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c     Fri Oct 09 23:58:50 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c     Sat Oct 10 00:00:54 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_netbsd.c,v 1.229 2020/05/16 18:31:48 christos Exp $   */
+/*     $NetBSD: netbsd32_netbsd.c,v 1.230 2020/10/10 00:00:54 rin Exp $        */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.229 2020/05/16 18:31:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.230 2020/10/10 00:00:54 rin Exp $");
 
 /*
  * below are all the standard NetBSD system calls, in the 32bit
@@ -2607,6 +2607,22 @@
        return sys__pset_bind(l, &ua, retval);
 }
 
+int
+netbsd32_getrandom(struct lwp *l, const struct netbsd32_getrandom_args *uap,
+    register_t *retval)
+{
+       /* {
+               syscallarg(netbsd32_voidp)      buf;
+               syscallarg(netbsd32_size_t)     buflen;
+               syscallarg(unsigned)            flags;
+       } */
+       struct sys_getrandom_args ua;
+
+       NETBSD32TOP_UAP(buf, void *);
+       NETBSD32TOX_UAP(buflen, size_t);
+       NETBSD32TO64_UAP(flags);
+       return sys_getrandom(l, &ua, retval);
+}
 
 /*
  * MI indirect system call support.
diff -r ef2c35f1cdcc -r cc65c4bb7fdd sys/compat/netbsd32/syscalls.master
--- a/sys/compat/netbsd32/syscalls.master       Fri Oct 09 23:58:50 2020 +0000
+++ b/sys/compat/netbsd32/syscalls.master       Sat Oct 10 00:00:54 2020 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.138 2020/05/16 18:31:48 christos Exp $
+       $NetBSD: syscalls.master,v 1.139 2020/10/10 00:00:54 rin Exp $
 
 ;      from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
@@ -235,7 +235,9 @@
 89     COMPAT_43 MODULAR compat_43     \
                        { int|sys||getdtablesize(void); } ogetdtablesize
 90     STD             { int|netbsd32||dup2(int from, int to); }
-91     UNIMPL          getdopt
+91     STD             { netbsd32_ssize_t|netbsd32||getrandom( \
+                           netbsd32_voidp buf, netbsd32_size_t buflen, \
+                           unsigned int flags); }
 92     STD             { int|netbsd32||fcntl(int fd, int cmd, \
                            ... netbsd32_voidp arg); }
 93     COMPAT_50 MODULAR compat_netbsd32_50    \



Home | Main Index | Thread Index | Old Index