From owner-p4-projects@FreeBSD.ORG Sun Aug 27 05:39:48 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8D98A16A4DF; Sun, 27 Aug 2006 05:39:48 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 23C9816A4DA for ; Sun, 27 Aug 2006 05:39:48 +0000 (UTC) (envelope-from als@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1BDB43D46 for ; Sun, 27 Aug 2006 05:39:43 +0000 (GMT) (envelope-from als@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7R5dhbB076896 for ; Sun, 27 Aug 2006 05:39:43 GMT (envelope-from als@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7R5dhGo076893 for perforce@freebsd.org; Sun, 27 Aug 2006 05:39:43 GMT (envelope-from als@FreeBSD.org) Date: Sun, 27 Aug 2006 05:39:43 GMT Message-Id: <200608270539.k7R5dhGo076893@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to als@FreeBSD.org using -f From: Alex Lyashkov To: Perforce Change Reviews Cc: Subject: PERFORCE change 105161 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Aug 2006 05:39:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=105161 Change 105161 by als@als_head on 2006/08/27 05:39:03 whitespace fixes, add assert Affected files ... .. //depot/projects/jail2/sys/kern/kern_descrip.c#5 edit Differences ... ==== //depot/projects/jail2/sys/kern/kern_descrip.c#5 (text+ko) ==== @@ -1350,14 +1350,14 @@ int maxuserfiles = maxfiles - (maxfiles / 20); static struct timeval lastfail; static int curfail; -#ifdef JAIL +#ifdef JAIL struct prison *jail = td->td_ucred->cr_prison; #endif fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); sx_xlock(&filelist_lock); -#ifdef JAIL +#ifdef JAIL if ((openfiles >= maxuserfiles && suser_cred(td->td_ucred, SUSER_RUID) != 0) || !JAIL_CAN_OPENFILE(jail) || openfiles >= maxfiles) { #else @@ -2187,10 +2187,11 @@ fdrop_locked(struct file *fp, struct thread *td) { int error; -#ifdef JAIL +#ifdef JAIL struct prison *jail = fp->f_cred->cr_prison; + + KASSERT(td->td_ucred->cr_prison == jail, ("File closed at different context!")); #endif - FILE_LOCK_ASSERT(fp, MA_OWNED); if (--fp->f_count > 0) { @@ -2210,7 +2211,7 @@ LIST_REMOVE(fp, f_list); openfiles--; sx_xunlock(&filelist_lock); -#ifdef JAIL +#ifdef JAIL JAIL_CLOSEFILE(jail); #endif crfree(fp->f_cred); @@ -2459,7 +2460,6 @@ struct file *fp; struct proc *p; int error, n; - /* * Note: because the number of file descriptors is calculated * in different ways for sizing vs returning the data, @@ -2614,7 +2614,7 @@ struct prison *jail = req->td->td_ucred->cr_prison; int error; int32_t maxfile = JAIL_FILE_GETLIMIT(jail); - + if (maxfile == 0) { maxfile = maxfiles; } @@ -2623,7 +2623,7 @@ return (error); if (jail != &jail_0) return (EPERM); - + /* Read in and verify the new value. */ error = SYSCTL_IN(req, &maxfile, sizeof(int)); if (error) @@ -2631,8 +2631,8 @@ if (maxfile <= 0) return (EINVAL); maxfiles = maxfile; + return (0); - } SYSCTL_PROC(_kern, OID_AUTO, maxfiles, CTLTYPE_INT | CTLFLAG_RW, @@ -2644,7 +2644,7 @@ { struct prison *jail = req->td->td_ucred->cr_prison; uint32_t fdcount = JAIL_FILE_GETCOUNT(jail); - + return SYSCTL_OUT(req, &fdcount, sizeof(int)); } @@ -2658,7 +2658,7 @@ SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD, &openfiles, 0, "System-wide number of open files"); - + #endif /* ARGSUSED*/