summaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-11-06 18:41:11 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-11-06 18:41:11 +0000
commit89ae7820c1a454d61cd281925d300bf324cfb4a3 (patch)
tree322119c116dc2ae1a396e832aac803b47d2df136 /sys/kern/kern_fork.c
parent1c0a1a534d87ced0c6089cb972b59491152bbdfa (diff)
Let fork1, uvm_fork, and cpu_fork take a function/argument pair as argument,
instead of doing fork1, cpu_set_kpc. This lets us retire cpu_set_kpc and avoid a multiprocessor race. This commit breaks vax because it doesn't look like any other arch, someone working on vax might want to look at this and try to adapt the code to be more like the rest of the world. Idea and uvm parts from NetBSD.
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 01393fee290..e3db4cdc4d5 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.45 2001/11/06 13:36:52 art Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.46 2001/11/06 18:41:10 art Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -79,7 +79,7 @@ sys_fork(p, v, retval)
void *v;
register_t *retval;
{
- return (fork1(p, SIGCHLD, FORK_FORK, NULL, 0, retval));
+ return (fork1(p, SIGCHLD, FORK_FORK, NULL, 0, NULL, NULL, retval));
}
/*ARGSUSED*/
@@ -89,7 +89,8 @@ sys_vfork(p, v, retval)
void *v;
register_t *retval;
{
- return (fork1(p, SIGCHLD, FORK_VFORK|FORK_PPWAIT, NULL, 0, retval));
+ return (fork1(p, SIGCHLD, FORK_VFORK|FORK_PPWAIT, NULL, 0, NULL,
+ NULL, retval));
}
int
@@ -130,16 +131,18 @@ sys_rfork(p, v, retval)
if (rforkflags & RFMEM)
flags |= FORK_VMNOSTACK;
- return (fork1(p, SIGCHLD, flags, NULL, 0, retval));
+ return (fork1(p, SIGCHLD, flags, NULL, 0, NULL, NULL, retval));
}
int
-fork1(p1, exitsig, flags, stack, stacksize, retval)
- register struct proc *p1;
+fork1(p1, exitsig, flags, stack, stacksize, func, arg, retval)
+ struct proc *p1;
int exitsig;
int flags;
void *stack;
size_t stacksize;
+ void (*func)(void *);
+ void *arg;
register_t *retval;
{
struct proc *p2;
@@ -360,7 +363,7 @@ again:
* different path later.
*/
uvm_fork(p1, p2, ((flags & FORK_SHAREVM) ? TRUE : FALSE), stack,
- stacksize);
+ stacksize, func ? func : child_return, arg ? arg : p2);
vm = p2->p_vmspace;