Rename members of 'struct plimit' so that the fields are 'pl_xxx' and

no longer have the same names as members of 'struct proc'.
This commit is contained in:
dsl 2007-09-21 19:19:20 +00:00
parent 0ca3d21b5b
commit 4bacff8183
7 changed files with 46 additions and 46 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: irix_prctl.c,v 1.37 2007/03/06 12:43:09 tsutsui Exp $ */
/* $NetBSD: irix_prctl.c,v 1.38 2007/09/21 19:19:21 dsl Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.37 2007/03/06 12:43:09 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.38 2007/09/21 19:19:21 dsl Exp $");
#include <sys/errno.h>
#include <sys/types.h>
@ -498,9 +498,9 @@ irix_sproc_child(isc)
*/
if (inh & IRIX_PR_SULIMIT) {
pl = p2->p_limit;
parent->p_limit->p_refcnt++;
parent->p_limit->pl_refcnt++;
p2->p_limit = parent->p_limit;
if(--pl->p_refcnt == 0)
if(--pl->pl_refcnt == 0)
limfree(pl);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_netbsd.c,v 1.126 2007/08/15 12:07:31 ad Exp $ */
/* $NetBSD: netbsd32_netbsd.c,v 1.127 2007/09/21 19:19:21 dsl Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.126 2007/08/15 12:07:31 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.127 2007/09/21 19:19:21 dsl Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ddb.h"
@ -2298,8 +2298,8 @@ netbsd32_adjust_limits(struct proc *p)
return;
}
if (p->p_limit->p_refcnt > 1 &&
(p->p_limit->p_lflags & PL_SHAREMOD) == 0) {
if (p->p_limit->pl_refcnt > 1 &&
(p->p_limit->pl_flags & PL_SHAREMOD) == 0) {
struct plimit *oldplim;
oldplim = p->p_limit;
p->p_limit = limcopy(p);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_acct.c,v 1.75 2007/07/09 21:10:51 ad Exp $ */
/* $NetBSD: kern_acct.c,v 1.76 2007/09/21 19:19:20 dsl Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_acct.c,v 1.75 2007/07/09 21:10:51 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_acct.c,v 1.76 2007/09/21 19:19:20 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -403,7 +403,7 @@ acct_process(struct lwp *l)
* XXX We should think about the CPU limit, too.
*/
mutex_enter(&p->p_mutex);
if (p->p_limit->p_refcnt > 1) {
if (p->p_limit->pl_refcnt > 1) {
oplim = p->p_limit;
p->p_limit = limcopy(p);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_fork.c,v 1.142 2007/08/15 12:07:33 ad Exp $ */
/* $NetBSD: kern_fork.c,v 1.143 2007/09/21 19:19:20 dsl Exp $ */
/*-
* Copyright (c) 1999, 2001, 2004 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.142 2007/08/15 12:07:33 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.143 2007/09/21 19:19:20 dsl Exp $");
#include "opt_ktrace.h"
#include "opt_systrace.h"
@ -357,14 +357,14 @@ fork1(struct lwp *l1, int flags, int exitsig, void *stack, size_t stacksize,
* (If PL_SHAREMOD is clear, the structure is shared
* copy-on-write.)
*/
if (p1->p_limit->p_lflags & PL_SHAREMOD) {
if (p1->p_limit->pl_flags & PL_SHAREMOD) {
mutex_enter(&p1->p_mutex);
p2->p_limit = limcopy(p1);
mutex_exit(&p1->p_mutex);
} else {
mutex_enter(&p1->p_limit->p_lock);
p1->p_limit->p_refcnt++;
mutex_exit(&p1->p_limit->p_lock);
mutex_enter(&p1->p_limit->pl_lock);
p1->p_limit->pl_refcnt++;
mutex_exit(&p1->p_limit->pl_lock);
p2->p_limit = p1->p_limit;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_proc.c,v 1.115 2007/09/06 23:58:57 ad Exp $ */
/* $NetBSD: kern_proc.c,v 1.116 2007/09/21 19:19:20 dsl Exp $ */
/*-
* Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.115 2007/09/06 23:58:57 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.116 2007/09/21 19:19:20 dsl Exp $");
#include "opt_kstack.h"
#include "opt_maxuprc.h"
@ -388,7 +388,7 @@ proc0_init(void)
/* Create the limits structures. */
p->p_limit = &limit0;
mutex_init(&limit0.p_lock, MUTEX_DEFAULT, IPL_NONE);
mutex_init(&limit0.pl_lock, MUTEX_DEFAULT, IPL_NONE);
for (i = 0; i < sizeof(p->p_rlimit)/sizeof(p->p_rlimit[0]); i++)
limit0.pl_rlimit[i].rlim_cur =
limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY;
@ -406,7 +406,7 @@ proc0_init(void)
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_max = lim;
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3;
limit0.pl_corename = defcorename;
limit0.p_refcnt = 1;
limit0.pl_refcnt = 1;
/* Configure virtual memory system, set vm rlimits. */
uvm_init_limits(p);
@ -1326,16 +1326,16 @@ proc_crmod_enter(void)
/* Reset what needs to be reset in plimit. */
lim = p->p_limit;
if (lim->pl_corename != defcorename) {
if (lim->p_refcnt > 1 &&
(lim->p_lflags & PL_SHAREMOD) == 0) {
if (lim->pl_refcnt > 1 &&
(lim->pl_flags & PL_SHAREMOD) == 0) {
p->p_limit = limcopy(p);
limfree(lim);
lim = p->p_limit;
}
mutex_enter(&lim->p_lock);
mutex_enter(&lim->pl_lock);
cn = lim->pl_corename;
lim->pl_corename = defcorename;
mutex_exit(&lim->p_lock);
mutex_exit(&lim->pl_lock);
if (cn != defcorename)
free(cn, M_TEMP);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_resource.c,v 1.120 2007/09/06 02:03:06 rmind Exp $ */
/* $NetBSD: kern_resource.c,v 1.121 2007/09/21 19:19:21 dsl Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.120 2007/09/06 02:03:06 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.121 2007/09/21 19:19:21 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -284,8 +284,8 @@ dosetrlimit(struct lwp *l, struct proc *p, int which, struct rlimit *limp)
return (error);
mutex_enter(&p->p_mutex);
if (p->p_limit->p_refcnt > 1 &&
(p->p_limit->p_lflags & PL_SHAREMOD) == 0) {
if (p->p_limit->pl_refcnt > 1 &&
(p->p_limit->pl_flags & PL_SHAREMOD) == 0) {
oldplim = p->p_limit;
p->p_limit = limcopy(p);
limfree(oldplim);
@ -544,25 +544,25 @@ limcopy(struct proc *p)
mutex_exit(&p->p_mutex);
newlim = pool_get(&plimit_pool, PR_WAITOK);
mutex_init(&newlim->p_lock, MUTEX_DEFAULT, IPL_NONE);
newlim->p_lflags = 0;
newlim->p_refcnt = 1;
mutex_init(&newlim->pl_lock, MUTEX_DEFAULT, IPL_NONE);
newlim->pl_flags = 0;
newlim->pl_refcnt = 1;
mutex_enter(&p->p_mutex);
for (;;) {
lim = p->p_limit;
mutex_enter(&lim->p_lock);
mutex_enter(&lim->pl_lock);
if (lim->pl_corename != defcorename) {
l = strlen(lim->pl_corename) + 1;
mutex_exit(&lim->p_lock);
mutex_exit(&lim->pl_lock);
mutex_exit(&p->p_mutex);
corename = malloc(l, M_TEMP, M_WAITOK);
mutex_enter(&p->p_mutex);
mutex_enter(&lim->p_lock);
mutex_enter(&lim->pl_lock);
if (l != strlen(lim->pl_corename) + 1) {
mutex_exit(&lim->p_lock);
mutex_exit(&lim->pl_lock);
mutex_exit(&p->p_mutex);
free(corename, M_TEMP);
mutex_enter(&p->p_mutex);
@ -577,7 +577,7 @@ limcopy(struct proc *p)
strlcpy(newlim->pl_corename, lim->pl_corename, l);
else
newlim->pl_corename = defcorename;
mutex_exit(&lim->p_lock);
mutex_exit(&lim->pl_lock);
break;
}
@ -589,9 +589,9 @@ limfree(struct plimit *lim)
{
int n;
mutex_enter(&lim->p_lock);
n = --lim->p_refcnt;
mutex_exit(&lim->p_lock);
mutex_enter(&lim->pl_lock);
n = --lim->pl_refcnt;
mutex_exit(&lim->pl_lock);
if (n > 0)
return;
#ifdef DIAGNOSTIC
@ -600,7 +600,7 @@ limfree(struct plimit *lim)
#endif
if (lim->pl_corename != defcorename)
free(lim->pl_corename, M_TEMP);
mutex_destroy(&lim->p_lock);
mutex_destroy(&lim->pl_lock);
pool_put(&plimit_pool, lim);
}
@ -741,7 +741,7 @@ sysctl_proc_corename(SYSCTLFN_ARGS)
mutex_enter(&ptmp->p_mutex);
lim = ptmp->p_limit;
if (lim->p_refcnt > 1 && (lim->p_lflags & PL_SHAREMOD) == 0) {
if (lim->pl_refcnt > 1 && (lim->pl_flags & PL_SHAREMOD) == 0) {
ptmp->p_limit = limcopy(ptmp);
limfree(lim);
lim = ptmp->p_limit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: resourcevar.h,v 1.38 2007/07/12 11:05:42 he Exp $ */
/* $NetBSD: resourcevar.h,v 1.39 2007/09/21 19:19:20 dsl Exp $ */
/*
* Copyright (c) 1991, 1993
@ -72,9 +72,9 @@ struct plimit {
struct rlimit pl_rlimit[RLIM_NLIMITS];
char *pl_corename;
#define PL_SHAREMOD 0x01 /* modifications are shared */
int p_lflags;
int p_refcnt; /* number of references */
kmutex_t p_lock; /* mutex for p_refcnt */
int pl_flags;
int pl_refcnt; /* number of references */
kmutex_t pl_lock; /* mutex for pl_refcnt */
};
/* add user profiling from AST XXXSMP */