Using getrandom() libc interface, SYS_getrandom fixes.

The interface is available since Glibc 2.25, and FreeBSD 12.0.
This commit is contained in:
Sergey Kandaurov
2018-05-24 20:35:47 +03:00
parent 3b7238996a
commit a9ea218e7e
3 changed files with 42 additions and 10 deletions

View File

@@ -62,9 +62,13 @@ nxt_random_stir(nxt_random_t *r)
#if (NXT_HAVE_GETRANDOM)
/* Linux 3.17 getrandom(). */
n = getrandom(&key, NXT_RANDOM_KEY_SIZE, 0);
n = getrandom(key, NXT_RANDOM_KEY_SIZE, 0);
#elif (NXT_HAVE_LINUX_SYS_GETRANDOM)
/* Linux 3.17 SYS_getrandom. */
n = syscall(SYS_getrandom, &key, NXT_RANDOM_KEY_SIZE, 0);
#endif