diff options
| -rw-r--r-- | sys/kern/kern_descrip.c | 12 | ||||
| -rw-r--r-- | sys/kern/uipc_usrreq.c | 4 | ||||
| -rw-r--r-- | sys/sys/file.h | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 305470eaac7d..ffb5e6dc4c83 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -140,7 +140,7 @@ struct filedesc0 { * Descriptor management. */ struct filelist filehead; /* head of list of open files */ -int nfiles; /* actual number of open files */ +int openfiles; /* actual number of open files */ struct sx filelist_lock; /* sx to protect filelist */ struct mtx sigio_lock; /* mtx to protect pointers to sigio */ @@ -1363,8 +1363,8 @@ falloc(td, resultfp, resultfd) fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); sx_xlock(&filelist_lock); - if ((nfiles >= maxuserfiles && (td->td_ucred->cr_ruid != 0 || - jailed(td->td_ucred))) || nfiles >= maxfiles) { + if ((openfiles >= maxuserfiles && (td->td_ucred->cr_ruid != 0 || + jailed(td->td_ucred))) || openfiles >= maxfiles) { if (ppsratecheck(&lastfail, &curfail, 1)) { printf("kern.maxfiles limit exceeded by uid %i, please see tuning(7).\n", td->td_ucred->cr_ruid); @@ -1373,7 +1373,7 @@ falloc(td, resultfp, resultfd) uma_zfree(file_zone, fp); return (ENFILE); } - nfiles++; + openfiles++; /* * If the process has file descriptor zero open, add the new file @@ -1421,7 +1421,7 @@ ffree(struct file *fp) KASSERT(fp->f_count == 0, ("ffree: fp_fcount not 0!")); sx_xlock(&filelist_lock); LIST_REMOVE(fp, f_list); - nfiles--; + openfiles--; sx_xunlock(&filelist_lock); crfree(fp->f_cred); uma_zfree(file_zone, fp); @@ -2460,7 +2460,7 @@ SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW, &maxfiles, 0, "Maximum number of files"); SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD, - &nfiles, 0, "System-wide number of open files"); + &openfiles, 0, "System-wide number of open files"); static void fildesc_drvinit(void *unused) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index af93e2ed1c5d..be4bcb276be0 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1664,11 +1664,11 @@ unp_gc() * 91/09/19, bsy@cs.cmu.edu */ again: - nfiles_snap = nfiles + nfiles_slack; /* some slack */ + nfiles_snap = openfiles + nfiles_slack; /* some slack */ extra_ref = malloc(nfiles_snap * sizeof(struct file *), M_TEMP, M_WAITOK); sx_slock(&filelist_lock); - if (nfiles_snap < nfiles) { + if (nfiles_snap < openfiles) { sx_sunlock(&filelist_lock); free(extra_ref, M_TEMP); nfiles_slack += 20; diff --git a/sys/sys/file.h b/sys/sys/file.h index 1fa8ed6c5769..784ae575b526 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -166,8 +166,8 @@ extern struct fileops badfileops; extern struct fileops socketops; extern int maxfiles; /* kernel limit on number of open files */ extern int maxfilesperproc; /* per process limit on number of open files */ -extern int nfiles; /* (fl) actual number of open files */ -extern struct sx filelist_lock; /* sx to protect filelist and nfiles */ +extern int openfiles; /* (fl) actual number of open files */ +extern struct sx filelist_lock; /* sx to protect filelist and openfiles */ int fget(struct thread *td, int fd, struct file **fpp); int fget_read(struct thread *td, int fd, struct file **fpp); |
