summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_descrip.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 4c21b8b..4651631 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1192,13 +1192,14 @@ falloc(td, resultfp, resultfd)
struct proc *p = td->td_proc;
struct file *fp, *fq;
int error, i;
+ int maxuserfiles = maxfiles - (maxfiles / 20);
fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO);
sx_xlock(&filelist_lock);
- if (nfiles >= maxfiles) {
+ if (((nfiles >= maxuserfiles) && (td->td_ucred->cr_ruid != 0))
+ || (nfiles >= maxfiles)) {
sx_xunlock(&filelist_lock);
uma_zfree(file_zone, fp);
- tablefull("file");
return (ENFILE);
}
nfiles++;
OpenPOWER on IntegriCloud