* Unshare a filedesc structure, if necessary by making a copy */
| 2282 | * Unshare a filedesc structure, if necessary by making a copy |
| 2283 | */ |
| 2284 | void |
| 2285 | fdunshare(struct thread *td) |
| 2286 | { |
| 2287 | struct filedesc *tmp; |
| 2288 | struct proc *p = td->td_proc; |
| 2289 | |
| 2290 | if (refcount_load(&p->p_fd->fd_refcnt) == 1) |
| 2291 | return; |
| 2292 | |
| 2293 | tmp = fdcopy(p->p_fd); |
| 2294 | fdescfree(td); |
| 2295 | p->p_fd = tmp; |
| 2296 | } |
| 2297 | |
| 2298 | /* |
| 2299 | * Unshare a pwddesc structure. |
no test coverage detected