Index: sys/kern/kern_shutdown.c =================================================================== --- sys/kern/kern_shutdown.c (revision 369637) +++ sys/kern/kern_shutdown.c (working copy) @@ -74,6 +74,7 @@ #include #include #include +#include #include #include @@ -107,6 +108,7 @@ &panic_reboot_wait_time, 0, "Seconds to wait before rebooting after a panic"); + /* * Note that stdarg.h and the ANSI style va_start macro is used for both * ANSI and traditional C compilers. @@ -169,6 +171,10 @@ SYSCTL_INT(_kern, OID_AUTO, suspend_blocked, CTLFLAG_RW, &suspend_blocked, 0, "Block suspend due to a pending shutdown"); +int verbose_shutdown = 1; +SYSCTL_INT(_kern_shutdown, OID_AUTO, verbose, CTLFLAG_RW, + &verbose_shutdown, 0, "Be more verbose at shutdown/reboot"); + #ifdef EKCD FEATURE(ekcd, "Encrypted kernel crash dumps support"); @@ -393,6 +399,9 @@ { static int once = 0; + if (verbose_shutdown) + printf("System is going down.\n"); + /* * Normal paths here don't hold Giant, but we can wind up here * unexpectedly with it held. Drop it now so we don't have to @@ -424,6 +433,8 @@ /* We are out of the debugger now. */ kdb_active = 0; + if (verbose_shutdown > 1) + printf("Before shutdown_pre_sync.\n"); /* * Do any callouts that should be done BEFORE syncing the filesystems. */ @@ -433,6 +444,8 @@ * Now sync filesystems */ if (!cold && (howto & RB_NOSYNC) == 0 && once == 0) { + if (verbose_shutdown > 1) + printf("Before bufshutdown.\n"); once = 1; bufshutdown(show_busybufs); } @@ -445,11 +458,25 @@ * Ok, now do things that assume all filesystem activity has * been completed. */ + if (verbose_shutdown > 1) + printf("Before shutdown_post_sync.\n"); + EVENTHANDLER_INVOKE(shutdown_post_sync, howto); if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping) doadump(TRUE); + if (verbose_shutdown > 1) { + printf("I've seen things you people wouldn't believe.\n"); + printf("Attack ships on fire off the shoulder of Orion.\n"); + printf("I watched C-beams glitter in the dark near the\n"); + printf("Tannhäuser Gate. All those moments will be lost in\n"); + printf("time, like tears in rain.\n"); + DELAY(100000); + printf("\nTime to die.\n"); + DELAY(100000); + } + /* Now that we're going to really halt the system... */ EVENTHANDLER_INVOKE(shutdown_final, howto); --- sys/sys/systm.h.orig 2021-04-20 16:30:43.091477000 +0200 +++ sys/sys/systm.h 2021-04-21 09:44:49.845732000 +0200 @@ -60,6 +60,7 @@ extern char compiler_version[]; /* compiler version */ extern char copyright[]; /* system copyright */ extern int kstack_pages; /* number of kernel stack pages */ +extern int verbose_shutdown; /* Be more verbose at shutdown */ extern u_long pagesizes[]; /* supported page sizes */ extern long physmem; /* physical memory */