| 3940 | } |
| 3941 | |
| 3942 | void |
| 3943 | pwd_chdir(struct thread *td, struct vnode *vp) |
| 3944 | { |
| 3945 | struct pwddesc *pdp; |
| 3946 | struct pwd *newpwd, *oldpwd; |
| 3947 | |
| 3948 | VNPASS(vp->v_usecount > 0, vp); |
| 3949 | |
| 3950 | newpwd = pwd_alloc(); |
| 3951 | pdp = td->td_proc->p_pd; |
| 3952 | PWDDESC_XLOCK(pdp); |
| 3953 | #pragma GCC diagnostic ignored "-Wcast-qual" |
| 3954 | oldpwd = PWDDESC_XLOCKED_LOAD_PWD(pdp); |
| 3955 | #pragma GCC diagnostic error "-Wcast-qual" |
| 3956 | newpwd->pwd_cdir = vp; |
| 3957 | pwd_fill(oldpwd, newpwd); |
| 3958 | pwd_set(pdp, newpwd); |
| 3959 | PWDDESC_XUNLOCK(pdp); |
| 3960 | pwd_drop(oldpwd); |
| 3961 | } |
| 3962 | |
| 3963 | /* |
| 3964 | * jail_attach(2) changes both root and working directories. |
no test coverage detected