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

Function vn_getcwd

freebsd/kern/vfs_cache.c:2897–2920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2895}
2896
2897int
2898vn_getcwd(char *buf, char **retbuf, size_t *buflen)
2899{
2900 struct pwd *pwd;
2901 int error;
2902
2903 vfs_smr_enter();
2904 pwd = pwd_get_smr();
2905 error = vn_fullpath_any_smr(pwd->pwd_cdir, pwd->pwd_rdir, buf, retbuf,
2906 buflen, 0);
2907 VFS_SMR_ASSERT_NOT_ENTERED();
2908 if (error < 0) {
2909 pwd = pwd_hold(curthread);
2910 error = vn_fullpath_any(pwd->pwd_cdir, pwd->pwd_rdir, buf,
2911 retbuf, buflen);
2912 pwd_drop(pwd);
2913 }
2914
2915#ifdef KTRACE
2916 if (KTRPOINT(curthread, KTR_NAMEI) && error == 0)
2917 ktrnamei(*retbuf);
2918#endif
2919 return (error);
2920}
2921
2922static int
2923kern___realpathat(struct thread *td, int fd, const char *path, char *buf,

Callers 2

coredumpFunction · 0.85
sys___getcwdFunction · 0.85

Calls 5

vn_fullpath_any_smrFunction · 0.85
pwd_holdFunction · 0.85
vn_fullpath_anyFunction · 0.85
pwd_dropFunction · 0.85
ktrnameiFunction · 0.85

Tested by

no test coverage detected