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; @@ -1666,35 +1663,6 @@ fdallocn(struct thread *td, int minfd, int *fds, int n) return (0); } -/* - * 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 diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 968ceffe9ffa..516ef1b6192e 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -148,7 +148,6 @@ int finstall(struct thread *td, struct file *fp, int *resultfp, int flags, struct filecaps *fcaps); int fdalloc(struct thread *td, int minfd, int *result); int fdallocn(struct thread *td, int minfd, int *fds, int n); -int fdavail(struct thread *td, int n); int fdcheckstd(struct thread *td); void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td); void fdcloseexec(struct thread *td);