diff options
author | trasz <trasz@FreeBSD.org> | 2011-04-06 19:13:04 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2011-04-06 19:13:04 +0000 |
commit | a0192d37e69b36c66e920e1050038e46084d28ee (patch) | |
tree | ec5868d709790bdebed3c6f3596d4da640e65fd8 /sys/fs/fdescfs | |
parent | 97c31deddee28ce34cbfea1a2d29d5d12830edb8 (diff) | |
download | FreeBSD-src-a0192d37e69b36c66e920e1050038e46084d28ee.zip FreeBSD-src-a0192d37e69b36c66e920e1050038e46084d28ee.tar.gz |
Add RACCT_NOFILE accounting.
Sponsored by: The FreeBSD Foundation
Reviewed by: kib (earlier version)
Diffstat (limited to 'sys/fs/fdescfs')
-rw-r--r-- | sys/fs/fdescfs/fdesc_vfsops.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index fdbcaba..ade38fe28 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -47,6 +47,7 @@ #include <sys/malloc.h> #include <sys/mount.h> #include <sys/proc.h> +#include <sys/racct.h> #include <sys/resourcevar.h> #include <sys/vnode.h> @@ -186,6 +187,7 @@ fdesc_statfs(mp, sbp) int i; int last; int freefd; + uint64_t limit; td = curthread; @@ -200,6 +202,9 @@ fdesc_statfs(mp, sbp) PROC_UNLOCK(td->td_proc); fdp = td->td_proc->p_fd; FILEDESC_SLOCK(fdp); + limit = racct_get_limit(td->td_proc, RACCT_NOFILE); + if (lim > limit) + lim = limit; last = min(fdp->fd_nfiles, lim); freefd = 0; for (i = fdp->fd_freefile; i < last; i++) |