[CRIU] [PATCH 1/4] syscall: add memfd_create() (v2)

Cyrill Gorcunov gorcunov at gmail.com
Tue Oct 14 01:54:22 PDT 2014


On Tue, Oct 14, 2014 at 12:42:42PM +0400, Andrey Vagin wrote:
> v2: Follow the kerndat style that "features" are described
> just by global boolean variables.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
...
> +bool memfd_is_supported;
> +static bool kerndat_has_memfd_create(void)
> +{
> +	int ret;
> +
> +	ret = sys_memfd_create("", 0);
> +
> +	if (ret == -ENOSYS)
> +		memfd_is_supported = false;
> +	else if (ret < 0) {
> +		pr_err("Unexpected error %d from memfd_create(NULL, 0)\n", ret);
> +		return -1;
> +	}
> +	close(ret);

	close(-ENOSYS) ?

> +	memfd_is_supported = true;
> +	return 0;
> +}


More information about the CRIU mailing list