diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 1353dbf66573..c34e8752cba0 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 - * $Id: kern_shutdown.c,v 1.16 1997/06/15 02:03:03 wollman Exp $ + * $Id: kern_shutdown.c,v 1.17 1997/06/22 16:04:16 peter Exp $ */ #include "opt_ddb.h" @@ -90,6 +90,15 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW, #endif +/* + * If there is a hardware watchdog, point this at the function needed to + * hold it off. + * It's needed when the kernel needs to do some lengthy operations. + * e.g. in wd.c when dumping core.. It's most annoying to have + * your precious core-dump only half written because the wdog kicked in. + */ +watchdog_tickle_fn wdog_tickler = NULL; + /* * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. @@ -190,12 +199,19 @@ boot(howto) } } #endif + /* + * Do any callouts that should be done BEFORE syncing the filesystems. + */ ep = shutdown_list1; while (ep) { shutdown_list1 = ep->next; (*ep->function)(howto, ep->arg); ep = ep->next; } + + /* + * Now sync filesystems + */ if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { register struct buf *bp; int iter, nbusy; @@ -243,6 +259,11 @@ boot(howto) } DELAY(100000); /* wait for console output to finish */ } + + /* + * Ok, now do things that assume all filesystem activity has + * been completed. + */ ep = shutdown_list2; while (ep) { shutdown_list2 = ep->next; diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 44dd7136f078..6ffabe2c5997 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)systm.h 8.7 (Berkeley) 3/29/95 - * $Id: systm.h,v 1.53 1997/07/21 16:43:48 bde Exp $ + * $Id: systm.h,v 1.54 1997/08/09 00:04:06 dyson Exp $ */ #ifndef _SYS_SYSTM_H_ @@ -223,6 +223,16 @@ typedef void (*exitlist_fn)(struct proc *procp); int at_exit(exitlist_fn function); int rm_at_exit(exitlist_fn function); +/* Not exactly a callout LIST, but a callout entry.. */ +/* Allow an external module to define a hardware watchdog tickler */ +/* Normally a process would do this, but there are times when the */ +/* kernel needs to be able to hold off the watchdog, when the process */ +/* is not active, e.g. when dumping core. Costs us a whole 4 bytes to */ +/* make this generic. the variable is in kern_shutdown.c */ +typedef void (*watchdog_tickle_fn)(void); +extern watchdog_tickle_fn wdog_tickler; + + /* * Common `proc' functions are declared here so that proc.h can be included * less often.