Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2013 20:53:32 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259330 - head/sys/kern
Message-ID:  <201312132053.rBDKrW1w017931@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Fri Dec 13 20:53:31 2013
New Revision: 259330
URL: http://svnweb.freebsd.org/changeset/base/259330

Log:
  rlimit: add and utilize lim_shared
  
  MFC after:	2 weeks

Modified:
  head/sys/kern/kern_resource.c

Modified: head/sys/kern/kern_resource.c
==============================================================================
--- head/sys/kern/kern_resource.c	Fri Dec 13 20:43:11 2013	(r259329)
+++ head/sys/kern/kern_resource.c	Fri Dec 13 20:53:31 2013	(r259330)
@@ -80,6 +80,8 @@ static int	donice(struct thread *td, str
 static struct uidinfo *uilookup(uid_t uid);
 static void	ruxagg_locked(struct rusage_ext *rux, struct thread *td);
 
+static __inline int	lim_shared(struct plimit *limp);
+
 /*
  * Resource controls and accounting.
  */
@@ -1129,6 +1131,14 @@ lim_hold(limp)
 	return (limp);
 }
 
+static __inline int
+lim_shared(limp)
+	struct plimit *limp;
+{
+
+	return (limp->pl_refcnt > 1);
+}
+
 void
 lim_fork(struct proc *p1, struct proc *p2)
 {
@@ -1162,7 +1172,7 @@ lim_copy(dst, src)
 	struct plimit *dst, *src;
 {
 
-	KASSERT(dst->pl_refcnt == 1, ("lim_copy to shared limit"));
+	KASSERT(!lim_shared(dst), ("lim_copy to shared limit"));
 	bcopy(src->pl_rlimit, dst->pl_rlimit, sizeof(src->pl_rlimit));
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312132053.rBDKrW1w017931>