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
This commit is contained in:
Mike Silbersack 2003-06-19 04:07:12 +00:00
parent c5d061c17a
commit 4d7dfc31b8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116564

View File

@ -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);