MCPcopy Create free account
hub / github.com/F-Stack/f-stack / closefp_hl

Function closefp_hl

freebsd/kern/kern_descrip.c:1286–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1284}
1285
1286static int
1287closefp_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
1320static int
1321closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td,

Callers 1

closefpFunction · 0.85

Calls 2

closefp_implFunction · 0.85
wakeupFunction · 0.70

Tested by

no test coverage detected