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

Function kern_chdir

freebsd/kern/vfs_syscalls.c:938–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

936}
937
938int
939kern_chdir(struct thread *td, const char *path, enum uio_seg pathseg)
940{
941 struct nameidata nd;
942 int error;
943
944 NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
945 pathseg, path, td);
946 if ((error = namei(&nd)) != 0)
947 return (error);
948 if ((error = change_dir(nd.ni_vp, td)) != 0) {
949 vput(nd.ni_vp);
950 NDFREE_NOTHING(&nd);
951 return (error);
952 }
953 VOP_UNLOCK(nd.ni_vp);
954 NDFREE_NOTHING(&nd);
955 pwd_chdir(td, nd.ni_vp);
956 return (0);
957}
958
959/*
960 * Change notion of root (``/'') directory.

Callers 1

sys_chdirFunction · 0.85

Calls 5

nameiFunction · 0.85
change_dirFunction · 0.85
vputFunction · 0.85
NDFREE_NOTHINGFunction · 0.85
pwd_chdirFunction · 0.85

Tested by

no test coverage detected