STRUCT LIVEUPDATE_SESSION_PRESERVE_FD(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct live..._preserve_fd(9) ✨

hiii bestie πŸ’– welcome to the Kernel API Manual β€” today's main character is struct liveupdate_session_preserve_fd, aka the lil parameter bucket for ioctl(LIVEUPDATE_SESSION_PRESERVE_FD). no cap, this one is all about preserving a file descriptor. 🫢

🌸 NAME 🌸

struct liveupdate_session_preserve_fd β€” ioctl(LIVEUPDATE_SESSION_PRESERVE_FD)

πŸ¦‹ SYNOPSIS πŸ¦‹

struct liveupdate_session_preserve_fd {
    __u32 size;
    __s32 fd;
    __aligned_u64 token;
 };

πŸ’… Members πŸ’…

  • size β€” Input; it is literally sizeof(struct liveupdate_session_preserve_fd), bestie.
  • fd β€” Input; the user-space file descriptor to be preserved.
  • token β€” Input; an opaque, unique token for the preserved resource.

✨ Description ✨

okay so this struct holds parameters for preserving a file descriptor. very demure, very mindful. πŸ’…

You set the fd field to identify the file descriptor you want to preserve β€” think memfd, kvm, iommufd, VFIO, yep those cuties. Then the kernel validates whether this FD type and its dependencies are supported for preservation. πŸ•΅οΈβ€β™€οΈ

If validation passes, the kernel marks the FD internally and initiates the process of preparing its state for saving. The actual snapshotting of the state typically happens during the subsequent LIVEUPDATE_IOCTL_PREPARE execution phase β€” though some finalization might occur during freeze. 🧊

On successful validation and initiation, the kernel uses the token field with an opaque identifier representing the resource being preserved. This token confirms the FD is targeted for preservation and is required for the subsequent LIVEUPDATE_SESSION_RETRIEVE_FD call after the live update. slay. πŸ”₯

πŸ’– Return πŸ’–

0 on success (validation passed, preservation initiated), negative error code on failure (e.g., unsupported FD type, dependency issue, validation failed).

🌈 SEE ALSO 🌈

  • Kernel file ./include/uapi/linux/liveupdate.h
  • General ioctl format(9)
  • struct liveupdate_ioctl_create_session(9)
  • struct liveupdate_ioctl_retrieve_session(9)
  • struct liveupdate_session_retrieve_fd(9)
  • struct liveupdate_session_finish(9)
  • struct liveupdate_session_get_name(9)

mwah πŸ’‹ β€” this fab page comes from ./include/uapi/linux, dated October 2026, and it is the Kernel API Manual entry for struct live..._preserve_fd(9). bye bestie! πŸŽ€

πŸ“¦ where this page comes from