@@ -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
@@ -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,
@@ -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;
@@ -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:
{
@@ -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
Note that chdir is universally provided. Signed-off-by: Richard Henderson <richard.henderson@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(-) -- 2.17.1