diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2018-05-24 20:35:47 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2018-05-24 20:35:47 +0300 |
commit | a9ea218e7e119d7d7d050156835d4e16f41d0a6c (patch) | |
tree | 19d4a0d8b06181bef8ad6bec87a6cb7fda2b26c4 /auto | |
parent | 3b7238996ad68f3c56a031e72e0b2f9aa0c8662c (diff) | |
download | unit-a9ea218e7e119d7d7d050156835d4e16f41d0a6c.tar.gz unit-a9ea218e7e119d7d7d050156835d4e16f41d0a6c.tar.bz2 |
Using getrandom() libc interface, SYS_getrandom fixes.
The interface is available since Glibc 2.25, and FreeBSD 12.0.
Diffstat (limited to 'auto')
-rw-r--r-- | auto/unix | 34 |
1 files changed, 30 insertions, 4 deletions
@@ -3,25 +3,51 @@ # Copyright (C) NGINX, Inc. -# Linux 3.17 getrandom(). +# getrandom(). nxt_feature="getrandom()" nxt_feature_name=NXT_HAVE_GETRANDOM -nxt_feature_run= +nxt_feature_run=yes nxt_feature_incs= nxt_feature_libs= -nxt_feature_test="#include <linux/random.h> +nxt_feature_test="#include <unistd.h> + #include <sys/random.h> int main() { char buf[4]; - (void) getrandom(buf, 4, 0); + if (getrandom(buf, 4, 0) < 0) { + return 1; + } return 0; }" . auto/feature +if [ $nxt_found = no ]; then + + # Linux 3.17 SYS_getrandom. + + nxt_feature="SYS_getrandom in Linux" + nxt_feature_name=NXT_HAVE_LINUX_SYS_GETRANDOM + nxt_feature_test="#include <unistd.h> + #include <sys/syscall.h> + #include <linux/random.h> + + int main() { + char buf[4]; + + if (syscall(SYS_getrandom, buf, 4, 0) < 0) { + return 1; + } + + return 0; + }" + . auto/feature +fi + + nxt_feature="ucontext" nxt_feature_name=NXT_HAVE_UCONTEXT nxt_feature_run= |