blob: 79fb3c0513d13530ff3afe604d697aa9ea523aca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
--- a/include/random/sys/random.h (index)
+++ b/include/random/sys/random.h (working tree)
@@ -4,9 +4,9 @@
extern "C" {
#endif
-#define __NEED_size_t
-#define __NEED_ssize_t
-#include <bits/alltypes.h>
+#include <sys/types.h>
+
+#if !defined(SYS_getrandom)
+#if defined(__x86_64__)
+ #define SYS_getrandom 318
+#elif defined(__i386__)
+ #define SYS_getrandom 355
+#elif defined(__aarch64__)
+ #define SYS_getrandom 278
+#elif defined(__arm__)
+ #define SYS_getrandom 384
+#elif defined(__powerpc__)
+ #define SYS_getrandom 359
+#else
+#error Unsupported platform
+#endif
+#endif
#define GRND_NONBLOCK 0x0001
#define GRND_RANDOM 0x0002
--- a/getrandom.c (index)
+++ b/getrandom.c (working tree)
@@ -3,5 +3,5 @@
ssize_t getrandom(void *buf, size_t buflen, unsigned flags)
{
- return syscall_cp(SYS_getrandom, buf, buflen, flags);
+ return syscall(SYS_getrandom, buf, buflen, flags);
}
|