diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2014-04-04 05:07:36 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2014-04-04 05:07:36 +0000 |
commit | 210a5d168972142c3c4c7d6dc8cac24225e27246 (patch) | |
tree | a499282ef6a52e4976d27ecf3bea73d206a155d9 /sys/kern/kern_descrip.c | |
parent | 10b54ef6a9e5ccf1e8dd6fc23fb089f6d9bd1e5a (diff) | |
download | src-210a5d168972142c3c4c7d6dc8cac24225e27246.tar.gz src-210a5d168972142c3c4c7d6dc8cac24225e27246.zip |
Garbage collect fdavail.
It rarely returns an error and fdallocn handles the failure of fdalloc
just fine.
Notes
Notes:
svn path=/head/; revision=264104
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 09d748f69457..bc78785aea90 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1650,9 +1650,6 @@ fdallocn(struct thread *td, int minfd, int *fds, int n) FILEDESC_XLOCK_ASSERT(fdp); - if (!fdavail(td, n)) - return (EMFILE); - for (i = 0; i < n; i++) if (fdalloc(td, 0, &fds[i]) != 0) break; @@ -1667,35 +1664,6 @@ fdallocn(struct thread *td, int minfd, int *fds, int n) } /* - * Check to see whether n user file descriptors are available to the process - * p. - */ -int -fdavail(struct thread *td, int n) -{ - struct proc *p = td->td_proc; - struct filedesc *fdp = td->td_proc->p_fd; - int i, lim, last; - - FILEDESC_LOCK_ASSERT(fdp); - - /* - * XXX: This is only called from uipc_usrreq.c:unp_externalize(); - * call racct_add() from there instead of dealing with containers - * here. - */ - lim = getmaxfd(p); - if ((i = lim - fdp->fd_nfiles) > 0 && (n -= i) <= 0) - return (1); - last = min(fdp->fd_nfiles, lim); - for (i = fdp->fd_freefile; i < last; i++) { - if (fdp->fd_ofiles[i].fde_file == NULL && --n <= 0) - return (1); - } - return (0); -} - -/* * Create a new open file structure and allocate a file decriptor for the * process that refers to it. We add one reference to the file for the * descriptor table and one reference for resultfp. This is to prevent us |