Use up 4 precious bytes to give the kernel a hook to

support hardware watchdogs. The actual functions would be supplied in an LKM
or a linked file, but they need to hang off something.
This commit is contained in:
Julian Elischer 1997-08-09 01:25:54 +00:00
parent 9b9d503b21
commit 5230cfd2f4
2 changed files with 33 additions and 2 deletions

View File

@ -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;

View File

@ -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.