| 1284 | } |
| 1285 | |
| 1286 | static int |
| 1287 | closefp_hl(struct filedesc *fdp, int fd, struct file *fp, struct thread *td, |
| 1288 | bool holdleaders, bool audit) |
| 1289 | { |
| 1290 | int error; |
| 1291 | |
| 1292 | FILEDESC_XLOCK_ASSERT(fdp); |
| 1293 | |
| 1294 | if (holdleaders) { |
| 1295 | if (td->td_proc->p_fdtol != NULL) { |
| 1296 | /* |
| 1297 | * Ask fdfree() to sleep to ensure that all relevant |
| 1298 | * process leaders can be traversed in closef(). |
| 1299 | */ |
| 1300 | fdp->fd_holdleaderscount++; |
| 1301 | } else { |
| 1302 | holdleaders = false; |
| 1303 | } |
| 1304 | } |
| 1305 | |
| 1306 | error = closefp_impl(fdp, fd, fp, td, audit); |
| 1307 | if (holdleaders) { |
| 1308 | FILEDESC_XLOCK(fdp); |
| 1309 | fdp->fd_holdleaderscount--; |
| 1310 | if (fdp->fd_holdleaderscount == 0 && |
| 1311 | fdp->fd_holdleaderswakeup != 0) { |
| 1312 | fdp->fd_holdleaderswakeup = 0; |
| 1313 | wakeup(&fdp->fd_holdleaderscount); |
| 1314 | } |
| 1315 | FILEDESC_XUNLOCK(fdp); |
| 1316 | } |
| 1317 | return (error); |
| 1318 | } |
| 1319 | |
| 1320 | static int |
| 1321 | closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td, |
no test coverage detected