aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2017-05-28 07:40:09 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2017-05-28 07:40:09 +0000
commit9ecc1abca3b2fe764d94963f1f8132e7568cf159 (patch)
tree2a461883c5ea3e62314fcf046b53a15a55821c6a /sys
parent1a8ea9fb854bdeac87800c7b9ba87fac5011d978 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linux/linux_misc.c9
-rw-r--r--sys/conf/config.mk2
-rw-r--r--sys/modules/linux/Makefile2
-rw-r--r--sys/modules/linux64/Makefile2
4 files changed, 12 insertions, 3 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
diff --git a/sys/conf/config.mk b/sys/conf/config.mk
index ef4b8820d947..63d7ac6ec87a 100644
--- a/sys/conf/config.mk
+++ b/sys/conf/config.mk
@@ -8,6 +8,8 @@
# the code here when they all produce identical results
# (or should)
.if !defined(KERNBUILDDIR)
+opt_global.h:
+ echo "#define DEV_RANDOM 1" >> ${.TARGET}
opt_bpf.h:
echo "#define DEV_BPF 1" > ${.TARGET}
.if ${MK_INET_SUPPORT} != "no"
diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile
index 89f3aeb80bf6..a8df54d18c49 100644
--- a/sys/modules/linux/Makefile
+++ b/sys/modules/linux/Makefile
@@ -15,7 +15,7 @@ SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c linux_event.c \
linux${SFX}_machdep.c linux_misc.c linux_signal.c \
linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \
linux${SFX}_sysvec.c linux_uid16.c linux_time.c \
- linux_timer.c linux_vdso.c \
+ linux_timer.c linux_vdso.c opt_global.h \
opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \
device_if.h bus_if.h assym.s \
linux${SFX}_support.s
diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile
index a33ae54f760d..fe723da01a77 100644
--- a/sys/modules/linux64/Makefile
+++ b/sys/modules/linux64/Makefile
@@ -10,7 +10,7 @@ SRCS= linux_fork.c linux_dummy.c linux_file.c linux_event.c \
linux_machdep.c linux_misc.c linux_ptrace.c linux_signal.c \
linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \
linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \
- opt_inet6.h opt_compat.h opt_posix.h opt_usb.h \
+ opt_inet6.h opt_compat.h opt_global.h opt_posix.h opt_usb.h \
vnode_if.h device_if.h bus_if.h assym.s \
linux_support.s
DPSRCS= linux_genassym.c