diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index c25b8e1df17a..e9039d5bf8d7 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fork.c,v 1.34 1998/01/04 03:52:02 thorpej Exp $ */ +/* $NetBSD: kern_fork.c,v 1.35 1998/01/05 05:16:28 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -69,7 +69,7 @@ sys_fork(p, v, retval) register_t *retval; { - return (fork1(p, 0, retval)); + return (fork1(p, 0, retval, NULL)); } /* @@ -84,7 +84,7 @@ sys_vfork(p, v, retval) register_t *retval; { - return (fork1(p, FORK_PPWAIT, retval)); + return (fork1(p, FORK_PPWAIT, retval, NULL)); } /* @@ -99,14 +99,15 @@ sys___vfork14(p, v, retval) register_t *retval; { - return (fork1(p, FORK_PPWAIT|FORK_SHAREVM, retval)); + return (fork1(p, FORK_PPWAIT|FORK_SHAREVM, retval, NULL)); } int -fork1(p1, flags, retval) +fork1(p1, flags, retval, rnewprocp) register struct proc *p1; int flags; register_t *retval; + struct proc **rnewprocp; { register struct proc *p2; register uid_t uid; @@ -295,6 +296,12 @@ again: if (flags & FORK_SHAREVM) cnt.v_forks_sharevm++; + /* + * Pass a pointer to the new process to the caller. + */ + if (rnewprocp != NULL) + *rnewprocp = p2; + /* * Preserve synchronization semantics of vfork. If waiting for * child to exec or exit, set P_PPWAIT on child, and sleep on our diff --git a/sys/sys/proc.h b/sys/sys/proc.h index e4e663775a20..599e27bb6921 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.54 1998/01/04 03:53:04 thorpej Exp $ */ +/* $NetBSD: proc.h,v 1.55 1998/01/05 05:16:26 thorpej Exp $ */ /*- * Copyright (c) 1986, 1989, 1991, 1993 @@ -319,7 +319,7 @@ int tsleep __P((void *chan, int pri, const char *wmesg, int timo)); void unsleep __P((struct proc *)); void wakeup __P((void *chan)); void exit1 __P((struct proc *, int)); -int fork1 __P((struct proc *, int, register_t *)); +int fork1 __P((struct proc *, int, register_t *, struct proc **)); void kmeminit __P((void)); void rqinit __P((void)); int groupmember __P((gid_t, struct ucred *));