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

Function sys___getcwd

freebsd/kern/vfs_cache.c:2876–2895  ·  view source on GitHub ↗

Implementation of the getcwd syscall. */

Source from the content-addressed store, hash-verified

2874
2875/* Implementation of the getcwd syscall. */
2876int
2877sys___getcwd(struct thread *td, struct __getcwd_args *uap)
2878{
2879 char *buf, *retbuf;
2880 size_t buflen;
2881 int error;
2882
2883 buflen = uap->buflen;
2884 if (__predict_false(buflen < 2))
2885 return (EINVAL);
2886 if (buflen > MAXPATHLEN)
2887 buflen = MAXPATHLEN;
2888
2889 buf = uma_zalloc(namei_zone, M_WAITOK);
2890 error = vn_getcwd(buf, &retbuf, &buflen);
2891 if (error == 0)
2892 error = copyout(retbuf, uap->buf, buflen);
2893 uma_zfree(namei_zone, buf);
2894 return (error);
2895}
2896
2897int
2898vn_getcwd(char *buf, char **retbuf, size_t *buflen)

Callers

nothing calls this directly

Calls 4

vn_getcwdFunction · 0.85
uma_zallocFunction · 0.50
copyoutFunction · 0.50
uma_zfreeFunction · 0.50

Tested by

no test coverage detected