fdcopy() only needs a filedesc pointer.
This commit is contained in:
parent
9c85c6f625
commit
dd68501eb2
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user