[CRIU] [PATCH 1/2] memfd: Test for __NR_memfd_create during building

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 8 07:32:32 PST 2016


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile.config           |  3 +++
 scripts/feature-tests.mak | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/Makefile.config b/Makefile.config
index ce4b8d844982..26d581bfab43 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -41,6 +41,9 @@ endif
 ifeq ($(call try-cc,$(SETPROCTITLE_INIT_TEST),-lbsd),y)
 	$(Q) @echo '#define CONFIG_HAS_SETPROCTITLE_INIT' >> $@
 endif
+ifeq ($(call try-cc,$(MEMFD_TEST),),y)
+	$(Q) @echo '#define CONFIG_HAS_MEMFD' >> $@
+endif
 ifeq ($(piegen-y),y)
 	$(Q) @echo '#define CONFIG_PIEGEN' >> $@
 endif
diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak
index 519eb52694f9..9a491de45b66 100644
--- a/scripts/feature-tests.mak
+++ b/scripts/feature-tests.mak
@@ -92,3 +92,17 @@ int main(int argc, char *argv[], char *envp[])
 }
 
 endef
+
+define MEMFD_TEST
+
+#include <unistd.h>
+#include <sys/syscall.h>
+
+int main(void)
+{
+#ifdef __NR_memfd_create
+	return 0;
+#endif
+}
+
+endef
-- 
2.5.0



More information about the CRIU mailing list