Set the umask in a new file descriptor table earlier in fdcopy() to remove

two lock operations.
This commit is contained in:
John Baldwin 2009-05-20 18:42:04 +00:00
parent 498a9afee2
commit 6ca33ea345

View File

@ -1626,17 +1626,15 @@ fdcopy(struct filedesc *fdp)
newfdp->fd_freefile = i;
}
}
newfdp->fd_cmask = fdp->fd_cmask;
FILEDESC_SUNLOCK(fdp);
FILEDESC_XLOCK(newfdp);
for (i = 0; i <= newfdp->fd_lastfile; ++i)
if (newfdp->fd_ofiles[i] != NULL)
fdused(newfdp, i);
FILEDESC_XUNLOCK(newfdp);
FILEDESC_SLOCK(fdp);
if (newfdp->fd_freefile == -1)
newfdp->fd_freefile = i;
newfdp->fd_cmask = fdp->fd_cmask;
FILEDESC_SUNLOCK(fdp);
FILEDESC_XUNLOCK(newfdp);
return (newfdp);
}