diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 05:19:34 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-14 05:19:34 +0000 |
commit | 0b1e65db7b3fc3c7d5572cc348ef03a53fcb56e7 (patch) | |
tree | 47642d0f71ff1a92476603e9773e56b75a4b1b61 /sys/kern/kern_resource.c | |
parent | 94e7bd1c1ec76c7e08243e8e674c3ce5395b1de8 (diff) |
from netbsd; limfree()
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r-- | sys/kern/kern_resource.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index d3a956b5d72..7f4e56a16ae 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_resource.c,v 1.31 1995/10/07 06:28:23 mycroft Exp $ */ +/* $NetBSD: kern_resource.c,v 1.32 1995/12/09 04:09:34 mycroft Exp $ */ /*- * Copyright (c) 1982, 1986, 1991, 1993 @@ -435,13 +435,23 @@ struct plimit * limcopy(lim) struct plimit *lim; { - register struct plimit *copy; + register struct plimit *newlim; - MALLOC(copy, struct plimit *, sizeof(struct plimit), + MALLOC(newlim, struct plimit *, sizeof(struct plimit), M_SUBPROC, M_WAITOK); - bcopy(lim->pl_rlimit, copy->pl_rlimit, + bcopy(lim->pl_rlimit, newlim->pl_rlimit, sizeof(struct rlimit) * RLIM_NLIMITS); - copy->p_lflags = 0; - copy->p_refcnt = 1; - return (copy); + newlim->p_lflags = 0; + newlim->p_refcnt = 1; + return (newlim); +} + +void +limfree(lim) + struct plimit *lim; +{ + + if (--lim->p_refcnt > 0) + return; + FREE(lim, M_SUBPROC); } |