summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_misc.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-29 22:25:33 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-29 22:25:33 +0000
commita773cead9f95e0f76bfa8c2228b6ab28a25e8fa1 (patch)
treeb2378020f5ca8c2713df691aa4d12e4fb5dc98fd /sys/compat/linux/linux_misc.c
parent302affcb04f3f591582be6eabbfc59b066598f79 (diff)
parent0f7800426154d56a08348750eae4c6d12d56ec11 (diff)
Notes
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r--sys/compat/linux/linux_misc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 9db1767e7c43..a815ccf3afa0 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -31,6 +31,9 @@
__FBSDID("$FreeBSD$");
#include "opt_compat.h"
+#if defined(KLD_MODULE)
+#include "opt_global.h"
+#endif
#include <sys/param.h>
#include <sys/blist.h>
@@ -2516,6 +2519,7 @@ linux_getrandom(struct thread *td, struct linux_getrandom_args *args)
{
struct uio uio;
struct iovec iov;
+ int error;
if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM))
return (EINVAL);
@@ -2532,7 +2536,10 @@ linux_getrandom(struct thread *td, struct linux_getrandom_args *args)
uio.uio_rw = UIO_READ;
uio.uio_td = td;
- return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK));
+ error = read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK);
+ if (error == 0)
+ td->td_retval[0] = args->count - uio.uio_resid;
+ return (error);
}
int