summaryrefslogtreecommitdiffstats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2016-02-21 10:56:23 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:45:58 -0600
commit53e550186491d2296b3ea7309c3097c185bc2af9 (patch)
treee5228adc5013a4b2b07e687a0adb466cac57582e /linux-user/syscall.c
parent5e18856f33d9c6999658cadfbd9adeafda6c6996 (diff)
downloadhqemu-53e550186491d2296b3ea7309c3097c185bc2af9.zip
hqemu-53e550186491d2296b3ea7309c3097c185bc2af9.tar.gz
linux-user: add getrandom() syscall
getrandom() has been introduced in kernel 3.17 and is now used during the boot sequence of Debian unstable (stretch/sid). Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a9d3fe6..cb2ebca 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -250,6 +250,9 @@ _syscall2(int, ioprio_get, int, which, int, who)
#if defined(TARGET_NR_ioprio_set) && defined(__NR_ioprio_set)
_syscall3(int, ioprio_set, int, which, int, who, int, ioprio)
#endif
+#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom)
+_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)
+#endif
static bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@@ -7548,6 +7551,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = get_errno(shutdown(arg1, arg2));
break;
#endif
+#if defined(TARGET_NR_getrandom) && defined(__NR_getrandom)
+ case TARGET_NR_getrandom:
+ p = lock_user(VERIFY_WRITE, arg1, arg2, 0);
+ if (!p) {
+ goto efault;
+ }
+ ret = get_errno(getrandom(p, arg2, arg3));
+ unlock_user(p, arg1, ret);
+ break;
+#endif
#ifdef TARGET_NR_socket
case TARGET_NR_socket:
ret = do_socket(arg1, arg2, arg3);
OpenPOWER on IntegriCloud