DOSHUTDOWNHOOKS(9)
π DOSHUTDOWNHOOKS(9) π
okay so bestie, welcome to the Kernel Developer's Manual β yes, the kernel one, we're going deep today. this page is about doshutdownhooks, the little function that runs all your shutdown hooks. it's a whole vibe, but it's also, like, deprecated, so listen up π«Ά
β¨ NAME β¨
doshutdownhooks β run all shutdown hooks. that's it, that's the whole job. iconic honestly π
πΈ SYNOPSIS πΈ
void
doshutdownhooks(void);
no args, no drama. she takes void and she takes names. periodt.
π¦ DESCRIPTION π¦
okay so first things first, and i need you to hear me on this one: the doshutdownhooks routine is deprecated. like, not "old but cute" deprecated β actually deprecated. use pmf_system_shutdown(9) instead. that's the move, bestie, that's the main character now π
the doshutdownhooks() function invokes all the shutdown hooks that were established using the shutdownhook_establish(9) function. all of them. every single one. no cap.
and here's the fun part: shutdown hooks are called in reverse order β i.e., the shutdown hook established last will be called first. it's giving stack energy, it's giving LIFO, it's giving "last one in, first one out" π β¨
this function is called from cpu_reboot() with interrupts turned off π¨. and when does it get called, exactly? okay so picture this β it's called immediately before the system is halted or rebooted, and the sequence is very specific:
- after file systems have been unmounted
- after the clock has been updated
- after a system dump has been done (if necessary)
so yeah, she shows up at the very end of the party, after all the cleanup, right before the lights go out. π
ngl bestie, "interrupts turned off" is not a drill β this is the last-call zone, things are serious here π
π SEE ALSO π
and that's the whole page, bestie!! π this one came from Debian, dated February 11, 2010, and it was published in the DOSHUTDOWNHOOKS(9) section of the Kernel Developer's Manual β so go forth, use pmf_system_shutdown(9) instead, and slay π¦βπ
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 1994 Christopher G. Demetriou
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms