Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148630925
D12588.id33698.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
859 B
Referenced Files
None
Subscribers
None
D12588.id33698.diff
View Options
Index: head/sys/compat/linuxkpi/common/include/linux/random.h
===================================================================
--- head/sys/compat/linuxkpi/common/include/linux/random.h
+++ head/sys/compat/linuxkpi/common/include/linux/random.h
@@ -28,7 +28,8 @@
*
* $FreeBSD$
*/
-#ifndef _LINUX_RANDOM_H_
+
+#ifndef _LINUX_RANDOM_H_
#define _LINUX_RANDOM_H_
#include <sys/random.h>
@@ -37,8 +38,27 @@
static inline void
get_random_bytes(void *buf, int nbytes)
{
+
if (read_random(buf, nbytes) == 0)
arc4rand(buf, nbytes, 0);
}
-#endif /* _LINUX_RANDOM_H_ */
+static inline u_int
+get_random_int(void)
+{
+ u_int val;
+
+ get_random_bytes(&val, sizeof(val));
+ return (val);
+}
+
+static inline u_long
+get_random_long(void)
+{
+ u_long val;
+
+ get_random_bytes(&val, sizeof(val));
+ return (val);
+}
+
+#endif /* _LINUX_RANDOM_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 20, 6:18 AM (3 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30003781
Default Alt Text
D12588.id33698.diff (859 B)
Attached To
Mode
D12588: Add get_random_{int,long} to the LinuxKPI
Attached
Detach File
Event Timeline
Log In to Comment