unregister_restart_handler(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– unregister_restart_handler β€” bestie, it's giving "cleanup era" πŸ’–

okay so this is a page from the Kernel API Manual, and honestly? It's a short one, but it's important, so let's lock in πŸ”’βœ¨


🌸 NAME 🌸

unregister_restart_handler β€” literally just unregisters a restart handler that you (or someone) already registered. That's it. That's the whole vibe. Undo the thing you did 🫢


✨ SYNOPSIS ✨

int unregister_restart_handler (struct notifier_block *nb );

like… one argument. one int back. we love a low-effort king πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • nb β€” the hook you want to unregister. bestie this is the exact same hook you handed over when you registered it, so don't go making a new one and hoping it works, because it won't 😭

πŸ’… DESCRIPTION πŸ’…

So the whole point: you previously registered a restart handler function, and now you're done with it, so you're calling this to unregister it. Cleanup era. Closure. Moving on. 🌈

And the return value? Iconic and simple:

  • returns zero on success πŸŽ‰ (slay, it worked)
  • returns -ENOENT on failure πŸ’€ (translation: the thing you're trying to unregister wasn't found β€” no cap, it's just not there)

πŸ”₯ SEE ALSO πŸ”₯

okay this is the part where the manpage goes full main-character and lists everyone in the group chat, so here we go, no skips, fr fr:

Kernel file ./kernel/reboot.c β€” and then the whole squad:

emergency_restart(9), register_reboot_notifier(9), unregister_reboot_notifier(9), register_restart_handler(9), do_kernel_restart(9), kernel_restart(9), kernel_halt(9), register_sys_off_handler(9), unregister_sys_off_handler(9), devm_register_sys_off_handler(9), devm_register_power_off_handler(9), devm_register_restart_handler(9), register_platform_power_off(9), unregister_platform_power_off(9), do_kernel_power_off(9), kernel_can_power_off(9), kernel_power_off(9), orderly_poweroff(9), orderly_reboot(9), hw_failure_emergency_action_func(9), hw_failure_emergency_schedule(9), __hw_protection_trigger(9)

like… that's a lot of besties. read them all. iykyk πŸ¦‹

ngl the pairing you probably want is register_restart_handler(9) β€” because this page is literally the undo button for that one πŸ™ˆ

πŸ’– and that's the tea πŸ’–

this cutie lives in ./kernel, dated October 2026, and yes the header at the top of the original was unregister_restart_handler(9) in the Kernel API Manual β€” consider it mentioned, consider it iconic, consider it handled πŸ‘‘βœ¨πŸŽ€

πŸ“¦ where this page comes from