[PATCH v2 21/25] Including <linux/memfd.h> iff it exists.

Alejandro Colomar alx.manpages at gmail.com
Mon Jun 20 07:11:04 UTC 2022


---
 auto/headers          | 13 +++++++++++++
 src/nxt_port_memory.c |  2 +-
 src/nxt_unit.c        |  2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/auto/headers b/auto/headers
index 9f528caa..a240b2d5 100644
--- a/auto/headers
+++ b/auto/headers
@@ -3,6 +3,19 @@
 # System headers.
 
 
+nxt_feature="<linux/memfd.h>"
+nxt_feature_name=NXT_HAVE_LINUX_MEMFD_H
+nxt_feature_run=no
+nxt_feature_incs=
+nxt_feature_libs=
+nxt_feature_test="#include <linux/memfd.h>
+
+                  int main(void) {
+                      return 0;
+                  }"
+. auto/feature
+
+
 nxt_feature="<linux/openat2.h>"
 nxt_feature_name=NXT_HAVE_LINUX_OPENAT2_H
 nxt_feature_run=no
diff --git a/src/nxt_port_memory.c b/src/nxt_port_memory.c
index 84f5ebc2..1f5a2432 100644
--- a/src/nxt_port_memory.c
+++ b/src/nxt_port_memory.c
@@ -9,7 +9,7 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#if (NXT_HAVE_MEMFD_CREATE)
+#if (NXT_HAVE_LINUX_MEMFD_H)
 #include <linux/memfd.h>
 #endif
 
diff --git a/src/nxt_unit.c b/src/nxt_unit.c
index f183ac6e..71964b33 100644
--- a/src/nxt_unit.c
+++ b/src/nxt_unit.c
@@ -16,7 +16,7 @@
 
 #include "nxt_websocket.h"
 
-#if (NXT_HAVE_MEMFD_CREATE)
+#if (NXT_HAVE_LINUX_MEMFD_H)
 #include <linux/memfd.h>
 #endif
 
-- 
2.36.1



More information about the unit mailing list