[PATCH v2 2/2] selftests/liveupdate: Add helpers to preserve/retrieve FDs

Pasha Tatashin pasha.tatashin at soleen.com
Thu Jun 11 20:09:32 PDT 2026


On Wed, 10 Jun 2026 16:09:08 -0700, Vipin Sharma <vipinsh at google.com> wrote:
> diff --git a/tools/testing/selftests/liveupdate/lib/liveupdate.c b/tools/testing/selftests/liveupdate/lib/liveupdate.c
> index 897c200f3845..961a732b541d 100644
> --- a/tools/testing/selftests/liveupdate/lib/liveupdate.c
> +++ b/tools/testing/selftests/liveupdate/lib/liveupdate.c
> @@ -78,9 +78,35 @@ int luo_retrieve_session(int luo_fd, const char *name)
>  	return arg.fd;
>  }
>  
> +int luo_session_preserve_fd(int session_fd, int fd, __u64 token)
> +{
> +	struct liveupdate_session_preserve_fd arg = {
> +		.size = sizeof(arg),
> +		.fd = fd,
> +		.token = token,
> +	};
> +
> +	if (ioctl(session_fd, LIVEUPDATE_SESSION_PRESERVE_FD, &arg) < 0)
> +		return -errno;

We do not return positive values on success either, so !ioctl() would 
be a tighter check, but < 0 is also acceptable.

Reviewed-by: Pasha Tatashin <pasha.tatashin at soleen.com>

-- 
Pasha Tatashin <pasha.tatashin at soleen.com>



More information about the kexec mailing list