summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_xxx.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_xxx.c')
-rw-r--r--sys/kern/kern_xxx.c21
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);
}
OpenPOWER on IntegriCloud