diff options
author | Julian Elischer <julian@FreeBSD.org> | 1996-08-19 20:07:07 +0000 |
---|---|---|
committer | Julian Elischer <julian@FreeBSD.org> | 1996-08-19 20:07:07 +0000 |
commit | 269fb9d7645f6bc26ac179bdd183f778cfc99371 (patch) | |
tree | d4294827ff886d20438cfade654560e1d181c7e2 /sys/kern | |
parent | e151ec23152e3653ab68ad93684c17f65177ea19 (diff) | |
download | src-269fb9d7645f6bc26ac179bdd183f778cfc99371.tar.gz src-269fb9d7645f6bc26ac179bdd183f778cfc99371.zip |
Collect all the functioons concerned with rebooting into one place
also add the at_shutdown callout list, and change the one user of
the present (broken) method (the vn driver) to use the new scheme.
Notes
Notes:
svn path=/head/; revision=17677
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_shutdown.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_xxx.c | 56 | ||||
-rw-r--r-- | sys/kern/subr_prf.c | 57 |
3 files changed, 4 insertions, 112 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 1c217becaecc..1ded33f77cb3 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: subr_prf.c,v 1.37 1996/05/09 18:58:06 gpalmer Exp $ + * $Id: kern_shutdown.c,v 1.1 1996/08/19 02:19:21 julian Exp $ */ #include "opt_ddb.h" @@ -276,6 +276,7 @@ boot(howto) die: printf("Rebooting...\n"); DELAY(1000000); /* wait 1 sec for printf's to complete and be read */ + /* cpu_boot(howto); */ /* doesn't do anything at the moment */ cpu_reset(); for(;;) ; /* NOTREACHED */ diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 173b33d82f05..cb08c420b31c 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93 - * $Id: kern_xxx.c,v 1.21 1995/12/02 18:58:50 bde Exp $ + * $Id: kern_xxx.c,v 1.22 1995/12/06 23:37:12 bde Exp $ */ #include <sys/param.h> @@ -39,49 +39,9 @@ #include <sys/sysproto.h> #include <sys/kernel.h> #include <sys/proc.h> -#include <sys/reboot.h> #include <sys/sysctl.h> #include <sys/utsname.h> -#include <sys/signalvar.h> -/* This implements a "TEXT_SET" for cleanup functions */ -static void dummy_cleanup __P((void)); -static void -dummy_cleanup() {} -TEXT_SET(cleanup_set, dummy_cleanup); - -typedef void (*cleanup_func_t)(void); -extern const struct linker_set cleanup_set; -static const cleanup_func_t *cleanups = - (const cleanup_func_t *)&cleanup_set.ls_items[0]; - -#ifndef _SYS_SYSPROTO_H_ -struct reboot_args { - int opt; -}; -#endif -/* ARGSUSED */ -int -reboot(p, uap, retval) - struct proc *p; - struct reboot_args *uap; - int *retval; -{ - int error; - - if ((error = suser(p->p_ucred, &p->p_acflag))) - return (error); - - if (!uap->opt & RB_NOSYNC) { - printf("\ncleaning up... "); - while(*cleanups) { - (**cleanups++)(); - } - } - - boot(uap->opt); - return (0); -} #if defined(COMPAT_43) || defined(COMPAT_SUNOS) @@ -180,20 +140,6 @@ oquota(p, uap, retval) } #endif /* COMPAT_43 */ -void -shutdown_nice(void) -{ - /* Send a signal to init(8) and have it shutdown the world */ - if (initproc != NULL) { - psignal(initproc, SIGINT); - } else { - /* No init(8) running, so simply reboot */ - boot(RB_NOSYNC); - } - return; -} - - #ifndef _SYS_SYSPROTO_H_ struct uname_args { struct utsname *name; diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index b91c84e82333..bd6ff5862620 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -36,23 +36,19 @@ * SUCH DAMAGE. * * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 - * $Id: subr_prf.c,v 1.36 1996/05/08 04:28:51 gpalmer Exp $ + * $Id: subr_prf.c,v 1.37 1996/05/09 18:58:06 gpalmer Exp $ */ #include "opt_ddb.h" #include <sys/param.h> #include <sys/systm.h> -#include <sys/reboot.h> #include <sys/msgbuf.h> #include <sys/proc.h> -#include <sys/vnode.h> #include <sys/tty.h> #include <sys/tprintf.h> #include <sys/syslog.h> #include <sys/malloc.h> -#include <sys/kernel.h> -#include <sys/sysctl.h> #include <machine/cons.h> /* @@ -61,17 +57,6 @@ */ #include <machine/stdarg.h> -#if defined(DDB) -#ifdef DDB_UNATTENDED - static int debugger_on_panic = 0; -#else - static int debugger_on_panic = 1; -#endif - -SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW, - &debugger_on_panic, 0, ""); -#endif - #define TOCONS 0x01 #define TOTTY 0x02 #define TOLOG 0x04 @@ -79,7 +64,6 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW, struct tty *constty; /* pointer to console "window" tty */ static void (*v_putc)(int) = cnputc; /* routine to putc on virtual console */ - static void logpri __P((int level)); static void msglogchar(int c, void *dummyarg); struct putchar_arg {int flags; struct tty *tty; }; @@ -89,45 +73,6 @@ static char *ksprintn __P((u_long num, int base, int *len)); static int consintr = 1; /* Ok to handle console interrupts? */ /* - * Variable panicstr contains argument to first call to panic; used as flag - * to indicate that the kernel has already called panic. - */ -const char *panicstr; - -/* - * Panic is called on unresolvable fatal errors. It prints "panic: mesg", - * and then reboots. If we are called twice, then we avoid trying to sync - * the disks as this often leads to recursive panics. - */ -#ifdef __GNUC__ -__dead /* panic() does not return */ -#endif -void -panic(const char *fmt, ...) -{ - int bootopt; - va_list ap; - - bootopt = RB_AUTOBOOT | RB_DUMP; - if (panicstr) - bootopt |= RB_NOSYNC; - else - panicstr = fmt; - - printf("panic: "); - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - printf("\n"); - -#if defined(DDB) - if (debugger_on_panic) - Debugger ("panic"); -#endif - boot(bootopt); -} - -/* * Warn that a system table is full. */ void |