Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135922327
D3053.id6859.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D3053.id6859.diff
View Options
Index: sys/compat/cloudabi/cloudabi_random.c
===================================================================
--- sys/compat/cloudabi/cloudabi_random.c
+++ sys/compat/cloudabi/cloudabi_random.c
@@ -26,6 +26,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/types.h>
+#include <sys/random.h>
+#include <sys/uio.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
int
@@ -32,7 +36,18 @@
cloudabi_sys_random_get(struct thread *td,
struct cloudabi_sys_random_get_args *uap)
{
+ struct iovec iov = {
+ .iov_base = uap->buf,
+ .iov_len = uap->nbyte
+ };
+ struct uio uio = {
+ .uio_iov = &iov,
+ .uio_iovcnt = 1,
+ .uio_resid = iov.iov_len,
+ .uio_segflg = UIO_USERSPACE,
+ .uio_rw = UIO_READ,
+ .uio_td = td
+ };
- /* Not implemented. */
- return (ENOSYS);
+ return (read_random_uio(&uio, 0));
}
Index: sys/dev/random/randomdev.c
===================================================================
--- sys/dev/random/randomdev.c
+++ sys/dev/random/randomdev.c
@@ -134,6 +134,13 @@
static int
randomdev_read(struct cdev *dev __unused, struct uio *uio, int flags)
{
+
+ return (read_random_uio(uio, flags));
+}
+
+int
+read_random_uio(struct uio *uio, int flags)
+{
uint8_t *random_buf;
int c, error;
ssize_t nbytes;
Index: sys/sys/random.h
===================================================================
--- sys/sys/random.h
+++ sys/sys/random.h
@@ -31,7 +31,10 @@
#ifdef _KERNEL
+struct uio;
+
u_int read_random(void *, u_int);
+int read_random_uio(struct uio *, int);
/*
* Note: if you add or remove members of random_entropy_source, remember to also update the
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 15, 4:47 AM (6 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25316091
Default Alt Text
D3053.id6859.diff (1 KB)
Attached To
Mode
D3053: Implement the CloudABI random_get() system call.
Attached
Detach File
Event Timeline
Log In to Comment