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:
parent
0ca3d21b5b
commit
4bacff8183
@ -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.
|
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
|
||||||
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -498,9 +498,9 @@ irix_sproc_child(isc)
|
|||||||
*/
|
*/
|
||||||
if (inh & IRIX_PR_SULIMIT) {
|
if (inh & IRIX_PR_SULIMIT) {
|
||||||
pl = p2->p_limit;
|
pl = p2->p_limit;
|
||||||
parent->p_limit->p_refcnt++;
|
parent->p_limit->pl_refcnt++;
|
||||||
p2->p_limit = parent->p_limit;
|
p2->p_limit = parent->p_limit;
|
||||||
if(--pl->p_refcnt == 0)
|
if(--pl->pl_refcnt == 0)
|
||||||
limfree(pl);
|
limfree(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
* Copyright (c) 1998, 2001 Matthew R. Green
|
||||||
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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)
|
#if defined(_KERNEL_OPT)
|
||||||
#include "opt_ddb.h"
|
#include "opt_ddb.h"
|
||||||
@ -2298,8 +2298,8 @@ netbsd32_adjust_limits(struct proc *p)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->p_limit->p_refcnt > 1 &&
|
if (p->p_limit->pl_refcnt > 1 &&
|
||||||
(p->p_limit->p_lflags & PL_SHAREMOD) == 0) {
|
(p->p_limit->pl_flags & PL_SHAREMOD) == 0) {
|
||||||
struct plimit *oldplim;
|
struct plimit *oldplim;
|
||||||
oldplim = p->p_limit;
|
oldplim = p->p_limit;
|
||||||
p->p_limit = limcopy(p);
|
p->p_limit = limcopy(p);
|
||||||
|
@ -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
|
* Copyright (c) 1982, 1986, 1989, 1993
|
||||||
@ -71,7 +71,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -403,7 +403,7 @@ acct_process(struct lwp *l)
|
|||||||
* XXX We should think about the CPU limit, too.
|
* XXX We should think about the CPU limit, too.
|
||||||
*/
|
*/
|
||||||
mutex_enter(&p->p_mutex);
|
mutex_enter(&p->p_mutex);
|
||||||
if (p->p_limit->p_refcnt > 1) {
|
if (p->p_limit->pl_refcnt > 1) {
|
||||||
oplim = p->p_limit;
|
oplim = p->p_limit;
|
||||||
p->p_limit = limcopy(p);
|
p->p_limit = limcopy(p);
|
||||||
}
|
}
|
||||||
|
@ -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.
|
* Copyright (c) 1999, 2001, 2004 The NetBSD Foundation, Inc.
|
||||||
@ -76,7 +76,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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_ktrace.h"
|
||||||
#include "opt_systrace.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
|
* (If PL_SHAREMOD is clear, the structure is shared
|
||||||
* copy-on-write.)
|
* copy-on-write.)
|
||||||
*/
|
*/
|
||||||
if (p1->p_limit->p_lflags & PL_SHAREMOD) {
|
if (p1->p_limit->pl_flags & PL_SHAREMOD) {
|
||||||
mutex_enter(&p1->p_mutex);
|
mutex_enter(&p1->p_mutex);
|
||||||
p2->p_limit = limcopy(p1);
|
p2->p_limit = limcopy(p1);
|
||||||
mutex_exit(&p1->p_mutex);
|
mutex_exit(&p1->p_mutex);
|
||||||
} else {
|
} else {
|
||||||
mutex_enter(&p1->p_limit->p_lock);
|
mutex_enter(&p1->p_limit->pl_lock);
|
||||||
p1->p_limit->p_refcnt++;
|
p1->p_limit->pl_refcnt++;
|
||||||
mutex_exit(&p1->p_limit->p_lock);
|
mutex_exit(&p1->p_limit->pl_lock);
|
||||||
p2->p_limit = p1->p_limit;
|
p2->p_limit = p1->p_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.
|
* Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
|
||||||
@ -69,7 +69,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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_kstack.h"
|
||||||
#include "opt_maxuprc.h"
|
#include "opt_maxuprc.h"
|
||||||
@ -388,7 +388,7 @@ proc0_init(void)
|
|||||||
|
|
||||||
/* Create the limits structures. */
|
/* Create the limits structures. */
|
||||||
p->p_limit = &limit0;
|
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++)
|
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_cur =
|
||||||
limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY;
|
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_max = lim;
|
||||||
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3;
|
limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3;
|
||||||
limit0.pl_corename = defcorename;
|
limit0.pl_corename = defcorename;
|
||||||
limit0.p_refcnt = 1;
|
limit0.pl_refcnt = 1;
|
||||||
|
|
||||||
/* Configure virtual memory system, set vm rlimits. */
|
/* Configure virtual memory system, set vm rlimits. */
|
||||||
uvm_init_limits(p);
|
uvm_init_limits(p);
|
||||||
@ -1326,16 +1326,16 @@ proc_crmod_enter(void)
|
|||||||
/* Reset what needs to be reset in plimit. */
|
/* Reset what needs to be reset in plimit. */
|
||||||
lim = p->p_limit;
|
lim = p->p_limit;
|
||||||
if (lim->pl_corename != defcorename) {
|
if (lim->pl_corename != defcorename) {
|
||||||
if (lim->p_refcnt > 1 &&
|
if (lim->pl_refcnt > 1 &&
|
||||||
(lim->p_lflags & PL_SHAREMOD) == 0) {
|
(lim->pl_flags & PL_SHAREMOD) == 0) {
|
||||||
p->p_limit = limcopy(p);
|
p->p_limit = limcopy(p);
|
||||||
limfree(lim);
|
limfree(lim);
|
||||||
lim = p->p_limit;
|
lim = p->p_limit;
|
||||||
}
|
}
|
||||||
mutex_enter(&lim->p_lock);
|
mutex_enter(&lim->pl_lock);
|
||||||
cn = lim->pl_corename;
|
cn = lim->pl_corename;
|
||||||
lim->pl_corename = defcorename;
|
lim->pl_corename = defcorename;
|
||||||
mutex_exit(&lim->p_lock);
|
mutex_exit(&lim->pl_lock);
|
||||||
if (cn != defcorename)
|
if (cn != defcorename)
|
||||||
free(cn, M_TEMP);
|
free(cn, M_TEMP);
|
||||||
}
|
}
|
||||||
|
@ -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
|
* Copyright (c) 1982, 1986, 1991, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -284,8 +284,8 @@ dosetrlimit(struct lwp *l, struct proc *p, int which, struct rlimit *limp)
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
mutex_enter(&p->p_mutex);
|
mutex_enter(&p->p_mutex);
|
||||||
if (p->p_limit->p_refcnt > 1 &&
|
if (p->p_limit->pl_refcnt > 1 &&
|
||||||
(p->p_limit->p_lflags & PL_SHAREMOD) == 0) {
|
(p->p_limit->pl_flags & PL_SHAREMOD) == 0) {
|
||||||
oldplim = p->p_limit;
|
oldplim = p->p_limit;
|
||||||
p->p_limit = limcopy(p);
|
p->p_limit = limcopy(p);
|
||||||
limfree(oldplim);
|
limfree(oldplim);
|
||||||
@ -544,25 +544,25 @@ limcopy(struct proc *p)
|
|||||||
|
|
||||||
mutex_exit(&p->p_mutex);
|
mutex_exit(&p->p_mutex);
|
||||||
newlim = pool_get(&plimit_pool, PR_WAITOK);
|
newlim = pool_get(&plimit_pool, PR_WAITOK);
|
||||||
mutex_init(&newlim->p_lock, MUTEX_DEFAULT, IPL_NONE);
|
mutex_init(&newlim->pl_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||||
newlim->p_lflags = 0;
|
newlim->pl_flags = 0;
|
||||||
newlim->p_refcnt = 1;
|
newlim->pl_refcnt = 1;
|
||||||
mutex_enter(&p->p_mutex);
|
mutex_enter(&p->p_mutex);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
lim = p->p_limit;
|
lim = p->p_limit;
|
||||||
mutex_enter(&lim->p_lock);
|
mutex_enter(&lim->pl_lock);
|
||||||
if (lim->pl_corename != defcorename) {
|
if (lim->pl_corename != defcorename) {
|
||||||
l = strlen(lim->pl_corename) + 1;
|
l = strlen(lim->pl_corename) + 1;
|
||||||
|
|
||||||
mutex_exit(&lim->p_lock);
|
mutex_exit(&lim->pl_lock);
|
||||||
mutex_exit(&p->p_mutex);
|
mutex_exit(&p->p_mutex);
|
||||||
corename = malloc(l, M_TEMP, M_WAITOK);
|
corename = malloc(l, M_TEMP, M_WAITOK);
|
||||||
mutex_enter(&p->p_mutex);
|
mutex_enter(&p->p_mutex);
|
||||||
mutex_enter(&lim->p_lock);
|
mutex_enter(&lim->pl_lock);
|
||||||
|
|
||||||
if (l != strlen(lim->pl_corename) + 1) {
|
if (l != strlen(lim->pl_corename) + 1) {
|
||||||
mutex_exit(&lim->p_lock);
|
mutex_exit(&lim->pl_lock);
|
||||||
mutex_exit(&p->p_mutex);
|
mutex_exit(&p->p_mutex);
|
||||||
free(corename, M_TEMP);
|
free(corename, M_TEMP);
|
||||||
mutex_enter(&p->p_mutex);
|
mutex_enter(&p->p_mutex);
|
||||||
@ -577,7 +577,7 @@ limcopy(struct proc *p)
|
|||||||
strlcpy(newlim->pl_corename, lim->pl_corename, l);
|
strlcpy(newlim->pl_corename, lim->pl_corename, l);
|
||||||
else
|
else
|
||||||
newlim->pl_corename = defcorename;
|
newlim->pl_corename = defcorename;
|
||||||
mutex_exit(&lim->p_lock);
|
mutex_exit(&lim->pl_lock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,9 +589,9 @@ limfree(struct plimit *lim)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
mutex_enter(&lim->p_lock);
|
mutex_enter(&lim->pl_lock);
|
||||||
n = --lim->p_refcnt;
|
n = --lim->pl_refcnt;
|
||||||
mutex_exit(&lim->p_lock);
|
mutex_exit(&lim->pl_lock);
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
return;
|
return;
|
||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
@ -600,7 +600,7 @@ limfree(struct plimit *lim)
|
|||||||
#endif
|
#endif
|
||||||
if (lim->pl_corename != defcorename)
|
if (lim->pl_corename != defcorename)
|
||||||
free(lim->pl_corename, M_TEMP);
|
free(lim->pl_corename, M_TEMP);
|
||||||
mutex_destroy(&lim->p_lock);
|
mutex_destroy(&lim->pl_lock);
|
||||||
pool_put(&plimit_pool, lim);
|
pool_put(&plimit_pool, lim);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ sysctl_proc_corename(SYSCTLFN_ARGS)
|
|||||||
|
|
||||||
mutex_enter(&ptmp->p_mutex);
|
mutex_enter(&ptmp->p_mutex);
|
||||||
lim = ptmp->p_limit;
|
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);
|
ptmp->p_limit = limcopy(ptmp);
|
||||||
limfree(lim);
|
limfree(lim);
|
||||||
lim = ptmp->p_limit;
|
lim = ptmp->p_limit;
|
||||||
|
@ -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
|
* Copyright (c) 1991, 1993
|
||||||
@ -72,9 +72,9 @@ struct plimit {
|
|||||||
struct rlimit pl_rlimit[RLIM_NLIMITS];
|
struct rlimit pl_rlimit[RLIM_NLIMITS];
|
||||||
char *pl_corename;
|
char *pl_corename;
|
||||||
#define PL_SHAREMOD 0x01 /* modifications are shared */
|
#define PL_SHAREMOD 0x01 /* modifications are shared */
|
||||||
int p_lflags;
|
int pl_flags;
|
||||||
int p_refcnt; /* number of references */
|
int pl_refcnt; /* number of references */
|
||||||
kmutex_t p_lock; /* mutex for p_refcnt */
|
kmutex_t pl_lock; /* mutex for pl_refcnt */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* add user profiling from AST XXXSMP */
|
/* add user profiling from AST XXXSMP */
|
||||||
|
Loading…
Reference in New Issue
Block a user