diff options
author | phk <phk@FreeBSD.org> | 1994-12-04 19:58:43 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1994-12-04 19:58:43 +0000 |
commit | 120ff80663185654fbfe0a71b2d968cd400c82d9 (patch) | |
tree | 2824e76d3bb7b34a2e1254a68a82eb3a7f950f9d /sys/kern | |
parent | aeaa7d7be3c7b60cdf2f6837e20c57a6f92ff651 (diff) | |
download | FreeBSD-src-120ff80663185654fbfe0a71b2d968cd400c82d9.zip FreeBSD-src-120ff80663185654fbfe0a71b2d968cd400c82d9.tar.gz |
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.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_xxx.c | 21 |
1 files changed, 20 insertions, 1 deletions
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 <sys/param.h> @@ -44,6 +44,17 @@ #include <sys/utsname.h> #include <sys/signalvar.h> +/* 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); } |