Note that chdir is universally provided. Signed-off-by: Richard Henderson <richard.hender...@linaro.org> --- linux-user/syscall-defs.h | 1 + linux-user/strace.c | 12 ------------ linux-user/syscall-file.inc.c | 14 ++++++++++++++ linux-user/syscall.c | 6 ------ linux-user/strace.list | 3 --- 5 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 392bd1579c..3fad9d51f0 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -19,6 +19,7 @@ SYSCALL_DEF_FULL(brk, .impl = impl_brk, .print_ret = print_syscall_ptr_ret, .arg_type = { ARG_PTR }); +SYSCALL_DEF(chdir, ARG_STR); SYSCALL_DEF_ARGS(clone, ARG_CLONEFLAG, ARG_PTR, ARG_PTR, ARG_PTR, ARG_PTR); SYSCALL_DEF(close, ARG_DEC); #ifdef TARGET_NR_creat diff --git a/linux-user/strace.c b/linux-user/strace.c index 9d6c765715..b234274034 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1113,18 +1113,6 @@ print_access(const struct syscallname *name, } #endif -#ifdef TARGET_NR_chdir -static void -print_chdir(const struct syscallname *name, - abi_long arg0, abi_long arg1, abi_long arg2, - abi_long arg3, abi_long arg4, abi_long arg5) -{ - print_syscall_prologue(name); - print_string(arg0, 1); - print_syscall_epilogue(name); -} -#endif - #ifdef TARGET_NR_chroot static void print_chroot(const struct syscallname *name, diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c index 5acd8ecc10..76637fe71b 100644 --- a/linux-user/syscall-file.inc.c +++ b/linux-user/syscall-file.inc.c @@ -16,6 +16,20 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ +SYSCALL_IMPL(chdir) +{ + abi_ulong target_path = arg1; + char *p = lock_user_string(target_path); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(chdir(p)); + unlock_user(p, target_path, 0); + return ret; +} + SYSCALL_IMPL(close) { int fd = arg1; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index affcd81273..0bf5901014 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5384,12 +5384,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_chdir: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(chdir(p)); - unlock_user(p, arg1, 0); - return ret; #ifdef TARGET_NR_time case TARGET_NR_time: { diff --git a/linux-user/strace.list b/linux-user/strace.list index c6bb475728..3f79159b63 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -61,9 +61,6 @@ #ifdef TARGET_NR_capset { TARGET_NR_capset, "capset" , "%s(%p,%p)", NULL, NULL }, #endif -#ifdef TARGET_NR_chdir -{ TARGET_NR_chdir, "chdir" , NULL, print_chdir, NULL }, -#endif #ifdef TARGET_NR_chmod { TARGET_NR_chmod, "chmod" , NULL, print_chmod, NULL }, #endif -- 2.17.1