Implementation of the getcwd syscall. */
| 2874 | |
| 2875 | /* Implementation of the getcwd syscall. */ |
| 2876 | int |
| 2877 | sys___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 | |
| 2897 | int |
| 2898 | vn_getcwd(char *buf, char **retbuf, size_t *buflen) |
nothing calls this directly
no test coverage detected