summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2004-01-17 00:59:04 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2004-01-17 00:59:04 +0000
commita6d4491c71877016dd4d4dd04846121224fcd47c (patch)
tree221c7a4f82947fbe26b0d3fa84d845d12d5d1164
parentf8edfc0dd6a52f0808b5351a8d0f2a0898888823 (diff)
Notes
-rw-r--r--sys/kern/kern_descrip.c8
-rw-r--r--sys/kern/uipc_usrreq.c2
-rw-r--r--sys/sys/filedesc.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index a391fed95135..b6eaee271a6c 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -602,7 +602,7 @@ do_dup(td, type, old, new, retval)
if (fdp->fd_ofiles[new] == NULL)
fdused(fdp, new);
} else {
- if ((error = fdalloc(td, &new)) != 0) {
+ if ((error = fdalloc(td, new, &new)) != 0) {
FILEDESC_UNLOCK(fdp);
fdrop(fp, td);
return (error);
@@ -1205,7 +1205,7 @@ fdgrowtable(struct filedesc *fdp, int nfd)
* Allocate a file descriptor for the process.
*/
int
-fdalloc(struct thread *td, int *result)
+fdalloc(struct thread *td, int minfd, int *result)
{
struct proc *p = td->td_proc;
struct filedesc *fdp = p->p_fd;
@@ -1222,7 +1222,7 @@ fdalloc(struct thread *td, int *result)
* may drop the filedesc lock, so we're in a race.
*/
for (;;) {
- fd = fd_first_free(fdp, fdp->fd_freefile, fdp->fd_nfiles);
+ fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
if (fd >= maxfd)
return (EMFILE);
if (fd < fdp->fd_nfiles)
@@ -1326,7 +1326,7 @@ falloc(td, resultfp, resultfd)
LIST_INSERT_HEAD(&filehead, fp, f_list);
}
sx_xunlock(&filelist_lock);
- if ((error = fdalloc(td, &i))) {
+ if ((error = fdalloc(td, 0, &i))) {
FILEDESC_UNLOCK(p->p_fd);
fdrop(fp, td);
if (resultfp)
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 8dd9b7e4595d..1f9ca3d2007b 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1047,7 +1047,7 @@ unp_externalize(control, controlp)
fdp = (int *)
CMSG_DATA(mtod(*controlp, struct cmsghdr *));
for (i = 0; i < newfds; i++) {
- if (fdalloc(td, &f))
+ if (fdalloc(td, 0, &f))
panic("unp_externalize fdalloc failed");
fp = *rp++;
td->td_proc->p_fd->fd_ofiles[f] = fp;
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
index ff8cefea2fff..8904435f32e5 100644
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -147,7 +147,7 @@ int dupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd,
int falloc(struct thread *p, struct file **resultfp, int *resultfd);
void fdused(struct filedesc *fdp, int fd);
void fdunused(struct filedesc *fdp, int fd);
-int fdalloc(struct thread *p, int *result);
+int fdalloc(struct thread *p, int minfd, int *result);
int fdavail(struct thread *td, int n);
void fdcloseexec(struct thread *td);
int fdcheckstd(struct thread *td);