fdcopy() only needs a filedesc pointer.

This commit is contained in:
Alfred Perlstein 2003-01-01 01:19:31 +00:00
parent 03282e6e3d
commit c522c1bf4b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108522
4 changed files with 9 additions and 8 deletions

View File

@ -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);

View File

@ -377,7 +377,7 @@ kern_execve(td, fname, argv, envv, mac_p)
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;

View File

@ -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 @@ fork1(td, flags, pages, procp)
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);

View File

@ -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);