[PATCH v2 05/25] Including <sys/random.h> iff it exists.

Alejandro Colomar alx.manpages at gmail.com
Mon Jun 20 07:10:48 UTC 2022


---
 auto/headers   | 13 +++++++++++++
 src/nxt_unix.h | 10 +++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/auto/headers b/auto/headers
index 34f5bb01..578c0a27 100644
--- a/auto/headers
+++ b/auto/headers
@@ -40,3 +40,16 @@ nxt_feature_test="#include <sys/prctl.h>
                       return 0;
                   }"
 . auto/feature
+
+
+nxt_feature="<sys/random.h>"
+nxt_feature_name=NXT_HAVE_SYS_RANDOM_H
+nxt_feature_run=no
+nxt_feature_incs=
+nxt_feature_libs=
+nxt_feature_test="#include <sys/random.h>
+
+                  int main(void) {
+                      return 0;
+                  }"
+. auto/feature
diff --git a/src/nxt_unix.h b/src/nxt_unix.h
index ab9e2d17..d1de8660 100644
--- a/src/nxt_unix.h
+++ b/src/nxt_unix.h
@@ -230,12 +230,12 @@
 #include <sys/sendfile.h>
 #endif
 
-#if (NXT_HAVE_GETRANDOM)
-#include <sys/random.h>             /* getrandom(). */
-#elif (NXT_HAVE_LINUX_SYS_GETRANDOM)
+#if (NXT_HAVE_SYS_RANDOM_H)
+#include <sys/random.h>
+#endif
+
+#if (NXT_HAVE_LINUX_SYS_GETRANDOM)
 #include <linux/random.h>           /* SYS_getrandom. */
-#elif (NXT_HAVE_GETENTROPY_SYS_RANDOM)
-#include <sys/random.h>             /* getentropy(). */
 #endif
 
 #include <sys/mount.h>
-- 
2.36.1



More information about the unit mailing list