summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2003-06-19 04:07:12 +0000
committersilby <silby@FreeBSD.org>2003-06-19 04:07:12 +0000
commit82d03c66d5d36a6bc9db1738c71edd00b2d4e48c (patch)
tree708a41fafb19cb72a1d4e034ebebccacaa407ab5 /sys/kern/kern_descrip.c
parentca4dc263500f579375794e3f00560f5dbdef5a4f (diff)
downloadFreeBSD-src-82d03c66d5d36a6bc9db1738c71edd00b2d4e48c.zip
FreeBSD-src-82d03c66d5d36a6bc9db1738c71edd00b2d4e48c.tar.gz
Add a rate limited message reporting when kern.maxfiles is exceeded,
reporting who did it. Also, fix a style bug introduced in the previous change. MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 4651631..ca11323 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1193,11 +1193,17 @@ falloc(td, resultfp, resultfd)
struct file *fp, *fq;
int error, i;
int maxuserfiles = maxfiles - (maxfiles / 20);
+ static struct timeval lastfail;
+ static int curfail;
fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO);
sx_xlock(&filelist_lock);
- if (((nfiles >= maxuserfiles) && (td->td_ucred->cr_ruid != 0))
- || (nfiles >= maxfiles)) {
+ if ((nfiles >= maxuserfiles && td->td_ucred->cr_ruid != 0)
+ || nfiles >= maxfiles) {
+ if (ppsratecheck(&lastfail, &curfail, 1)) {
+ printf("kern.maxfiles limit exceeded by uid %i, please see tuning(7).\n",
+ td->td_ucred->cr_ruid);
+ }
sx_xunlock(&filelist_lock);
uma_zfree(file_zone, fp);
return (ENFILE);
OpenPOWER on IntegriCloud