summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>1996-06-11 03:25:10 +0000
committertholo <tholo@openbsd.org>1996-06-11 03:25:10 +0000
commitff823cfe83f973d63eb8d7dbaaf4f9ab4bcd9c51 (patch)
tree8c478d0fec27d92f73dea603cd4766f901444e19 /sys/kern/init_main.c
parentUse beep() with ncurses (diff)
downloadwireguard-openbsd-ff823cfe83f973d63eb8d7dbaaf4f9ab4bcd9c51.tar.xz
wireguard-openbsd-ff823cfe83f973d63eb8d7dbaaf4f9ab4bcd9c51.zip
Kernel-implementation of update(8) my me
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index eb953d519b3..8cca8948dca 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.10 1996/06/10 07:25:54 deraadt Exp $ */
+/* $OpenBSD: init_main.c,v 1.11 1996/06/11 03:25:12 tholo Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -113,6 +113,7 @@ struct timeval runtime;
static void start_init __P((struct proc *));
static void start_pagedaemon __P((struct proc *));
+static void start_update __P((struct proc *));
/* XXX return int so gcc -Werror won't complain */
int main __P((void *));
@@ -372,6 +373,20 @@ main(framep)
cpu_set_kpc(pfind(2), start_pagedaemon);
#endif
+ /* Create process 3 (the update daemon). */
+ if (sys_fork(p, NULL, rval))
+ panic("fork update");
+#ifdef cpu_set_init_frame /* XXX should go away */
+ if (rval[1]) {
+ /*
+ * Now in process 3.
+ */
+ start_update(curproc);
+ }
+#else
+ cpu_set_kpc(pfind(3), start_update);
+#endif
+
/* The scheduler is an infinite loop. */
scheduler();
/* NOTREACHED */
@@ -518,3 +533,18 @@ start_pagedaemon(p)
vm_pageout();
/* NOTREACHED */
}
+
+static void
+start_update(p)
+ struct proc *p;
+{
+
+ /*
+ * Now in process 3.
+ */
+ pageproc = p;
+ p->p_flag |= P_INMEM | P_SYSTEM; /* XXX */
+ bcopy("update", curproc->p_comm, sizeof ("update"));
+ vn_update();
+ /* NOTREACHED */
+}