diff options
author | alfred <alfred@FreeBSD.org> | 2003-01-01 01:19:31 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2003-01-01 01:19:31 +0000 |
commit | dd68501eb2ffc038a7b58abdbdfab424e80271b3 (patch) | |
tree | 3073c3511acda88e551b070a2ce8a321b648bc29 /sys | |
parent | 9c85c6f62556907879069023dd22c05b2589074e (diff) | |
download | FreeBSD-src-dd68501eb2ffc038a7b58abdbdfab424e80271b3.zip FreeBSD-src-dd68501eb2ffc038a7b58abdbdfab424e80271b3.tar.gz |
fdcopy() only needs a filedesc pointer.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_descrip.c | 9 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 4 | ||||
-rw-r--r-- | sys/sys/filedesc.h | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 94ff960..bc14c61 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1249,17 +1249,18 @@ fdshare(fdp) /* * Copy a filedesc structure. + * A NULL pointer in returns a NULL reference, this is to ease callers, + * not catch errors. */ struct filedesc * -fdcopy(td) - struct thread *td; +fdcopy(fdp) + struct filedesc *fdp; { - struct filedesc *newfdp, *fdp; + struct filedesc *newfdp; struct file **fpp; int i, j; /* Certain daemons might not have file descriptors. */ - fdp = td->td_proc->p_fd; if (fdp == NULL) return (NULL); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 58c0f82..acb12ee 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -377,7 +377,7 @@ interpret: if (p->p_fd->fd_refcnt > 1) { struct filedesc *tmp; - tmp = fdcopy(td); + tmp = fdcopy(td->td_proc->p_fd); FILEDESC_UNLOCK(p->p_fd); fdfree(td); p->p_fd = tmp; diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 7aa0dc0..7361757 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -271,7 +271,7 @@ fork1(td, flags, pages, procp) if (p1->p_fd->fd_refcnt > 1) { struct filedesc *newfd; - newfd = fdcopy(td); + newfd = fdcopy(td->td_proc->p_fd); FILEDESC_UNLOCK(p1->p_fd); fdfree(td); p1->p_fd = newfd; @@ -448,7 +448,7 @@ again: fd = fdinit(td->td_proc->p_fd); else if (flags & RFFDG) { FILEDESC_LOCK(p1->p_fd); - fd = fdcopy(td); + fd = fdcopy(td->td_proc->p_fd); FILEDESC_UNLOCK(p1->p_fd); } else fd = fdshare(p1->p_fd); diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 47fb043..254540c 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -148,7 +148,7 @@ int fdalloc(struct thread *p, int want, int *result); int fdavail(struct thread *td, int n); void fdcloseexec(struct thread *td); int fdcheckstd(struct thread *td); -struct filedesc *fdcopy(struct thread *td); +struct filedesc *fdcopy(struct filedesc *fdp); void fdfree(struct thread *td); struct filedesc *fdinit(struct filedesc *fdp); struct filedesc *fdshare(struct filedesc *fdp); |