mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
filedesc: lock filedesc lock in fdcloseexec only when needed
This commit is contained in:
parent
7bd12696d7
commit
d3f3e12a4f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273956
@ -2160,19 +2160,17 @@ fdcloseexec(struct thread *td)
|
||||
|
||||
fdp = td->td_proc->p_fd;
|
||||
KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
|
||||
FILEDESC_XLOCK(fdp);
|
||||
for (i = 0; i <= fdp->fd_lastfile; i++) {
|
||||
fde = &fdp->fd_ofiles[i];
|
||||
fp = fde->fde_file;
|
||||
if (fp != NULL && (fp->f_type == DTYPE_MQUEUE ||
|
||||
(fde->fde_flags & UF_EXCLOSE))) {
|
||||
FILEDESC_XLOCK(fdp);
|
||||
fdfree(fdp, i);
|
||||
(void) closefp(fdp, i, fp, td, 0);
|
||||
/* closefp() drops the FILEDESC lock. */
|
||||
FILEDESC_XLOCK(fdp);
|
||||
}
|
||||
}
|
||||
FILEDESC_XUNLOCK(fdp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user