From 120ff80663185654fbfe0a71b2d968cd400c82d9 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 4 Dec 1994 19:58:43 +0000 Subject: Implemented a "TEXT_SET" called 'cleanup_set' which will be called before the reboot takes place (if not RB_NOSYNC that is). The vn driver needs this. Other places might benefit too. --- sys/kern/kern_xxx.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'sys/kern/kern_xxx.c') diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 337ff4f..6ac6596 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.7 1994/09/25 19:33:46 phk Exp $ + * $Id: kern_xxx.c,v 1.8 1994/10/02 17:35:21 phk Exp $ */ #include @@ -44,6 +44,17 @@ #include #include +/* This implements a "TEXT_SET" for cleanup functions */ + +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]; + struct reboot_args { int opt; }; @@ -58,6 +69,14 @@ reboot(p, uap, retval) 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); } -- cgit v1.1