klp_get_prev_state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… klp_get_prev_state β€” a.k.a. the "wait, what did the other patches already do?" function πŸ¦‹

okay so real talk, bestie, this is a Kernel API Manual page for klp_get_prev_state(9), from the ./kernel/livepatch corner of the kernel. it's short, it's sweet, and it's lowkey iconic. let's get into it πŸ’–


✨ NAME ✨

klp_get_prev_state β€” get information about system state modified by the already installed livepatches πŸ‘‘

like, the livepatches that are already living their best life in your kernel. those ones. not the new baby patch. the established ones. no cap.


🌸 SYNOPSIS 🌸

struct klp_state * klp_get_prev_state (unsigned long id );

that's the whole thing. one function, one argument, one pointer back. it's giving minimalism πŸŽ€


🫢 ARGUMENTS 🫢

  • id β€” the custom identifier of the modified system state. like, your little label for the thing you care about. it's custom, so it's yours, so own it πŸ’…

🌈 DESCRIPTION 🌈

okay so what does it actually do? it checks whether the already installed livepatches modify the given system state. vibe check on the existing patches, basically ✨

the thing you need to know is that the same system state can be modified by more non-cumulative livepatches. and when that happens, the expectation is that the latest livepatch has the most up-to-date information. so you're not getting the first one, you're not getting all of them β€” you're getting the freshest info available. main character energy πŸ‘‘

🚨 big important caveat, do not skip this one: the function can be called only during transition when a new livepatch is being enabled, or when such a transition is reverted. literally only then. so please don't just call it whenever, bestie 😭

and it's typically called only from pre/post (un)patch callbacks. that's its whole scene. iykyk πŸ¦‹


⭐ RETURN ⭐

  • a pointer to the latest struct klp_state from the already installed livepatches πŸŽ€
  • NULL when not found πŸ’€

that's it. that's the return. pointer or NULL. binary slay πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./kernel/livepatch/state.c β€” the source, go read it, it's right there πŸ“
  • klp_get_state(9) β€” its sibling, its bestie, its lore counterpart πŸ’œ

and that's the page!! this icon was brought to you by the Kernel API Manual, from the ./kernel/livepatch directory, dated October 2026 🌸🧚 stay patched, stay fresh, and remember: only during transition πŸ’–βœ¨

πŸ“¦ where this page comes from