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

Pavel Emelyanov xemul at virtuozzo.com
Mon Feb 8 09:23:27 PST 2016


On 02/08/2016 06:32 PM, Cyrill Gorcunov wrote:
> 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

Huh? Is it necessarily to redefine __NR_memfd_create with CONFIG_HAS_MEMFD in such
a tricky way?

> +	return 0;
> +#endif
> +}
> +
> +endef
> 



More information about the CRIU mailing list