BOOT(9)

πŸ‘‘ BOOT(9) β€” Kernel Developer's Manual πŸ’…

okay bestie, welcome to boot(9) β€” the group chat where the kernel says its final goodbyes 🫢


✨ NAME ✨

boot β€” halt or reboot the system. like, the ultimate "ok im logging off" move 😭


🌸 SYNOPSIS 🌸

#include <sys/types.h>
#include <sys/systm.h>
#include <sys/reboot.h>

void
boot(int howto);

πŸ’– DESCRIPTION πŸ’–

so boot() is the function that handles the final system shutdown, and then either halts or reboots the whole system. periodt. the exact action it takes is decided by the flags you pass in howto β€” and also by whether or not the system has finished autoconfiguration. two variables, one vibe check 🌈

πŸ¦‹ if the system HAS finished autoconfiguration

then boot() does all of this, in order, no skipping:

  1. if this is the first invocation of boot() and the RB_NOSYNC flag is not set in howto, it syncs and unmounts the system disks by calling vfs_unmountall(9). like, tidying up before you leave the party, iconic behaviour πŸ’…
  2. disables interrupts. no more chaos, we're done here βœ‹
  3. if it's rebooting after a crash β€” that means RB_DUMP is set in howto, but RB_HALT is not β€” it saves a system crash dump. yes bestie we're preserving the evidence πŸ•΅οΈ
  4. runs any shutdown hooks that were previously registered. all the little scheduled goodbyes πŸŽ€
  5. prints a message telling everyone the system is about to be halted or rebooted. a lil announcement, very main character πŸ“£
  6. if RB_HALT is set in howto, it halts the system. otherwise, it reboots it. that's the whole plot twist πŸ”₯

🧚 if the system has NOT finished autoconfiguration

then boot() just runs any shutdown hooks previously registered, prints a message, and halts the system. no disk syncing, no dump, no reboot β€” we're going straight to bed 😴

fr fr, the autoconfiguration status completely changes what happens. don't sleep on that detail, iykyk.

🌟 SEE ALSO 🌟


and that's the whole page bestie, slay πŸ’œ this one's from Debian, dated February 14, 1997 β€” yes, Valentine's Day, because the kernel loves you enough to shut down gracefully πŸŽ€βœ¨ bye!!

πŸ“¦ where this page comes from