klp_get_prev_state(9)
π 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_statefrom the already installed livepatches π NULLwhen 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms