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

Function pwd_chdir

freebsd/kern/kern_descrip.c:3942–3961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3940}
3941
3942void
3943pwd_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.

Callers 2

sys_fchdirFunction · 0.85
kern_chdirFunction · 0.85

Calls 4

pwd_allocFunction · 0.85
pwd_fillFunction · 0.85
pwd_setFunction · 0.85
pwd_dropFunction · 0.85

Tested by

no test coverage detected