Re: [PATCH v2 2/2] selftests/liveupdate: Add helpers to preserve/retrieve FDs
From: Pasha Tatashin
Date: Thu Jun 11 2026 - 23:09:55 EST
On Wed, 10 Jun 2026 16:09:08 -0700, Vipin Sharma <vipinsh@xxxxxxxxxx> 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@xxxxxxxxxx>
--
Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>