PERFORCE change 105161 for review
Alex Lyashkov
als at FreeBSD.org
Sun Aug 27 05:39:48 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105161
Change 105161 by als at 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*/
More information about the p4-projects
mailing list