From a0087e29ad992a054c2ff01b4580d329e9895ae8 Mon Sep 17 00:00:00 2001 From: gallatin Date: Wed, 29 Aug 2001 19:05:27 +0000 Subject: Fix linux_getcwd() so that if the cwd isn't cached (__getcwd() fails), the cwd is looked up inside the kernel. The native getcwd() in libc handles this in userland if __getcwd() fails. Obtained from: NetBSD via OpenBSD Tested by: Chris Casey , Markus Holmberg Reviewed by: Darrell Anderson PR: kern/24315 --- sys/compat/linux/linux_file.c | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'sys/compat/linux/linux_file.c') diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 0f68ab5..2a5d673 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -830,34 +830,6 @@ linux_link(struct proc *p, struct linux_link_args *args) return link(p, &bsd); } -int -linux_getcwd(struct proc *p, struct linux_getcwd_args *args) -{ - struct __getcwd_args bsd; - caddr_t sg; - int error, len; - -#ifdef DEBUG - if (ldebug(getcwd)) - printf(ARGS(getcwd, "%p, %ld"), args->buf, args->bufsize); -#endif - - sg = stackgap_init(); - bsd.buf = stackgap_alloc(&sg, SPARE_USRSPACE); - bsd.buflen = SPARE_USRSPACE; - error = __getcwd(p, &bsd); - if (!error) { - len = strlen(bsd.buf) + 1; - if (len <= args->bufsize) { - p->p_retval[0] = len; - error = copyout(bsd.buf, args->buf, len); - } - else - error = ERANGE; - } - return (error); -} - #ifndef __alpha__ int linux_fdatasync(p, uap) -- cgit v1.1