diff options
author | 2014-01-20 03:23:42 +0000 | |
---|---|---|
committer | 2014-01-20 03:23:42 +0000 | |
commit | 4ab8ed70b64e5f2a198bef629e07dfca26a1d380 (patch) | |
tree | 09a03a95df4f2d066b46619e70007d8a69ab7cc5 | |
parent | document !received-on, ok dlg benno (diff) | |
download | wireguard-openbsd-4ab8ed70b64e5f2a198bef629e07dfca26a1d380.tar.xz wireguard-openbsd-4ab8ed70b64e5f2a198bef629e07dfca26a1d380.zip |
Move p_textvp from struct proc to struct process so that the exit code
can be further simplified.
ok kettenis@
-rw-r--r-- | sys/kern/kern_exec.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 18 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 12 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 6 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vnops.c | 6 | ||||
-rw-r--r-- | sys/sys/proc.h | 6 |
6 files changed, 27 insertions, 27 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 262352e6944..4c1bed189b2 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.135 2013/06/17 19:11:54 guenther Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.136 2014/01/20 03:23:42 guenther Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -478,9 +478,9 @@ sys_execve(struct proc *p, void *v, register_t *retval) pr->ps_acflag &= ~AFORK; /* record proc's vnode, for use by procfs and others */ - otvp = p->p_textvp; + otvp = pr->ps_textvp; vref(pack.ep_vp); - p->p_textvp = pack.ep_vp; + pr->ps_textvp = pack.ep_vp; if (otvp) vrele(otvp); diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index fda5e769877..40366f27390 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.129 2013/10/25 04:42:48 guenther Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.130 2014/01/20 03:23:42 guenther Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -616,15 +616,15 @@ proc_zap(struct proc *p) * Decrement the count of procs running with this uid. */ (void)chgproccnt(p->p_cred->p_ruid, -1); - } - /* - * Release reference to text vnode - */ - otvp = p->p_textvp; - p->p_textvp = NULL; - if (otvp) - vrele(otvp); + /* + * Release reference to text vnode + */ + otvp = pr->ps_textvp; + pr->ps_textvp = NULL; + if (otvp) + vrele(otvp); + } /* * Remove us from our process list, possibly killing the process diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 1255aae6d8f..5a426374126 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.154 2013/10/08 03:50:07 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.155 2014/01/20 03:23:42 guenther Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -182,6 +182,11 @@ process_new(struct proc *p, struct process *parent) crhold(parent->ps_cred->pc_ucred); pr->ps_limit->p_refcnt++; + /* bump references to the text vnode (for procfs) */ + pr->ps_textvp = parent->ps_textvp; + if (pr->ps_textvp) + vref(pr->ps_textvp); + timeout_set(&pr->ps_realit_to, realitexpire, pr); pr->ps_flags = parent->ps_flags & (PS_SUGID | PS_SUGIDEXEC); @@ -327,11 +332,6 @@ fork1(struct proc *curp, int exitsig, int flags, void *stack, pid_t *tidptr, atomic_setbits_int(&pr->ps_flags, PS_TRACED); } - /* bump references to the text vnode (for procfs) */ - p->p_textvp = curp->p_textvp; - if (p->p_textvp) - vref(p->p_textvp); - if (flags & FORK_SHAREFILES) p->p_fd = fdshare(curp); else diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index e21e17708e3..41ef093684b 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.241 2013/10/22 16:40:26 guenther Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.242 2014/01/20 03:23:42 guenther Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -1259,8 +1259,8 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep, continue; } fdp = pp->p_fd; - if (pp->p_textvp) - FILLIT(NULL, NULL, KERN_FILE_TEXT, pp->p_textvp, pp); + if (pp->p_p->ps_textvp) + FILLIT(NULL, NULL, KERN_FILE_TEXT, pp->p_p->ps_textvp, pp); if (fdp->fd_cdir) FILLIT(NULL, NULL, KERN_FILE_CDIR, fdp->fd_cdir, pp); if (fdp->fd_rdir) diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index eb20e525507..7b60dcbf196 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.56 2013/03/28 02:08:39 guenther Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.57 2014/01/20 03:23:42 guenther Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -730,7 +730,7 @@ procfs_lookup(void *v) found: if (pt->pt_pfstype == Pfile) { - fvp = p->p_textvp; + fvp = p->p_p->ps_textvp; /* We already checked that it exists. */ vref(fvp); vn_lock(fvp, LK_EXCLUSIVE | LK_RETRY, curp); @@ -761,7 +761,7 @@ int procfs_validfile(struct proc *p, struct mount *mp) { - return (p->p_textvp != NULLVP); + return (p->p_p->ps_textvp != NULLVP); } int diff --git a/sys/sys/proc.h b/sys/sys/proc.h index e8e7e7c198b..b1525f20cd9 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.172 2013/10/25 04:42:48 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.173 2014/01/20 03:23:42 guenther Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -163,6 +163,8 @@ struct process { LIST_ENTRY(process) ps_sibling; /* List of sibling processes. */ LIST_HEAD(, process) ps_children;/* Pointer to list of children. */ + struct vnode *ps_textvp; /* Vnode of executable. */ + /* The following fields are all zeroed upon creation in process_new. */ #define ps_startzero ps_klist struct klist ps_klist; /* knotes attached to this process */ @@ -298,8 +300,6 @@ struct proc { int p_siglist; /* Signals arrived but not delivered. */ - struct vnode *p_textvp; /* Vnode of executable. */ - void *p_emuldata; /* Per-process emulation data, or */ /* NULL. Malloc type M_EMULDATA */ |