From owner-p4-projects@FreeBSD.ORG Sat Jul 17 15:19:27 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D194D1065675; Sat, 17 Jul 2010 15:19:26 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95D59106566B for ; Sat, 17 Jul 2010 15:19:26 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6AB688FC1C for ; Sat, 17 Jul 2010 15:19:26 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o6HFJQvx068555 for ; Sat, 17 Jul 2010 15:19:26 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o6HFJQgP068553 for perforce@freebsd.org; Sat, 17 Jul 2010 15:19:26 GMT (envelope-from trasz@freebsd.org) Date: Sat, 17 Jul 2010 15:19:26 GMT Message-Id: <201007171519.o6HFJQgP068553@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 181097 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jul 2010 15:19:27 -0000 http://p4web.freebsd.org/@@181097?ac=10 Change 181097 by trasz@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);