diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1994-12-04 19:58:43 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1994-12-04 19:58:43 +0000 |
commit | 54213fd84a0867499ba662476e02bfbefd2b5088 (patch) | |
tree | 2824e76d3bb7b34a2e1254a68a82eb3a7f950f9d /sys/kern/kern_xxx.c | |
parent | c0fc0670433e06d63aa20e67571f34a7c979cb64 (diff) | |
download | src-54213fd84a0867499ba662476e02bfbefd2b5088.tar.gz src-54213fd84a0867499ba662476e02bfbefd2b5088.zip |
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.
Notes
Notes:
svn path=/head/; revision=4959
Diffstat (limited to 'sys/kern/kern_xxx.c')
-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 337ff4f73648..6ac6596bf96d 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); } |