diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-05-31 04:46:19 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-05-31 04:46:19 +0000 |
commit | 621fc57ca7856660a488de908381c9e35c17102e (patch) | |
tree | baa45fb8f102ff7811d9e1f9a54d4794e1726e18 | |
parent | fe9f6e8ee69bd90dd8127abeb749a46a44c34cb9 (diff) |
Rename struct plimit field p_refcnt to pl_refcnt to avoid confusion
with the fields of struct proc. Make pl_refcnt unsigned for upcoming
atomic updating.
OK deraadt@ guenther@
-rw-r--r-- | sys/kern/init_main.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_resource.c | 8 | ||||
-rw-r--r-- | sys/sys/resourcevar.h | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index effefd552c3..22a510c1f0d 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.284 2019/02/26 14:24:21 visa Exp $ */ +/* $OpenBSD: init_main.c,v 1.285 2019/05/31 04:46:18 visa Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -330,7 +330,7 @@ main(void *framep) limit0.pl_rlimit[RLIMIT_RSS].rlim_max = lim; limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_max = lim; limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3; - limit0.p_refcnt = 1; + limit0.pl_refcnt = 1; /* Allocate a prototype map so we have something to fork. */ uvmspace_init(&vmspace0, pmap_kernel(), round_page(VM_MIN_ADDRESS), diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 578752c75aa..0d7f58bf890 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.209 2019/01/06 12:59:45 visa Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.210 2019/05/31 04:46:18 visa Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -240,7 +240,7 @@ process_new(struct proc *p, struct process *parent, int flags) /* post-copy fixups */ pr->ps_pptr = parent; - pr->ps_limit->p_refcnt++; + pr->ps_limit->pl_refcnt++; if (pr->ps_limit->pl_rlimit[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) timeout_add_msec(&pr->ps_rucheck_to, RUCHECK_INTERVAL); diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index e80439fdb6b..ffe560d7e38 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.59 2019/01/06 12:59:45 visa Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.60 2019/05/31 04:46:18 visa Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -236,7 +236,7 @@ dosetrlimit(struct proc *p, u_int which, struct rlimit *limp) if (limp->rlim_max > alimp->rlim_max) if ((error = suser(p)) != 0) return (error); - if (p->p_p->ps_limit->p_refcnt > 1) { + if (p->p_p->ps_limit->pl_refcnt > 1) { struct plimit *l = p->p_p->ps_limit; /* limcopy() can sleep, so copy before decrementing refcnt */ @@ -552,14 +552,14 @@ limcopy(struct plimit *lim) newlim = pool_get(&plimit_pool, PR_WAITOK); memcpy(newlim->pl_rlimit, lim->pl_rlimit, sizeof(struct rlimit) * RLIM_NLIMITS); - newlim->p_refcnt = 1; + newlim->pl_refcnt = 1; return (newlim); } void limfree(struct plimit *lim) { - if (--lim->p_refcnt > 0) + if (--lim->pl_refcnt > 0) return; pool_put(&plimit_pool, lim); } diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index 6329aaa346f..a27ba30dee2 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resourcevar.h,v 1.19 2019/01/06 12:59:45 visa Exp $ */ +/* $OpenBSD: resourcevar.h,v 1.20 2019/05/31 04:46:18 visa Exp $ */ /* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */ /* @@ -44,7 +44,7 @@ */ struct plimit { struct rlimit pl_rlimit[RLIM_NLIMITS]; - int p_refcnt; /* number of references */ + u_int pl_refcnt; /* number of references */ }; /* add user profiling from AST */ |