PERFORCE change 181097 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Jul 17 15:19:27 UTC 2010


http://p4web.freebsd.org/@@181097?ac=10

Change 181097 by trasz at trasz_victim on 2010/07/17 15:19:11

	Fix thinko - we don't want to ifndef out calls to chg*cnt(); this project
	is not about per-user limits.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#39 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#19 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#39 (text+ko) ====

@@ -1491,7 +1491,6 @@
 	return (1);
 }
 
-#ifndef CONTAINERS
 /*
  * Change the count associated with number of pseudo-terminals
  * a given user is using.  When 'max' is 0, don't enforce a limit
@@ -1516,4 +1515,3 @@
 	}
 	return (1);
 }
-#endif

==== //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#19 (text+ko) ====

@@ -686,9 +686,7 @@
 	if (psc->pts_unit >= 0)
 		free_unr(pts_pool, psc->pts_unit);
 
-#ifndef CONTAINERS
 	chgptscnt(psc->pts_uidinfo, -1, 0);
-#endif
 	uifree(psc->pts_uidinfo);
 
 	knlist_destroy(&psc->pts_inpoll.si_note);
@@ -728,22 +726,26 @@
 	/* Resource limiting. */
 #ifdef CONTAINERS
 	ok = !rusage_add(p, RUSAGE_PTY, 1);
-#else
+	if (!ok)
+		return (EAGAIN);
+#endif
 	PROC_LOCK(p);
 	ok = chgptscnt(uid, 1, lim_cur(p, RLIMIT_NPTS));
 	PROC_UNLOCK(p);
+	if (!ok) {
+#ifdef CONTAINERS
+		rusage_sub(p, RUSAGE_PTY, 1);
 #endif
-	if (!ok)
 		return (EAGAIN);
+	}
 
 	/* Try to allocate a new pts unit number. */
 	unit = alloc_unr(pts_pool);
 	if (unit < 0) {
 #ifdef CONTAINERS
 		rusage_sub(p, RUSAGE_PTY, 1);
-#else
+#endif
 		chgptscnt(uid, -1, 0);
-#endif
 		return (EAGAIN);
 	}
 
@@ -782,13 +784,18 @@
 	/* Resource limiting. */
 #ifdef CONTAINERS
 	ok = !rusage_add(p, RUSAGE_PTY, 1);
-#else
+	if (!ok)
+		return (EAGAIN);
+#endif
 	PROC_LOCK(p);
 	ok = chgptscnt(uid, 1, lim_cur(p, RLIMIT_NPTS));
 	PROC_UNLOCK(p);
+	if (!ok) {
+#ifdef CONTAINERS
+		rusage_sub(p, RUSAGE_PTY, 1);
 #endif
-	if (!ok)
 		return (EAGAIN);
+	}
 
 	/* Allocate TTY and softc. */
 	psc = malloc(sizeof(struct pts_softc), M_PTS, M_WAITOK|M_ZERO);


More information about the p4-projects mailing list