From b1e341ebb7fc177434e2fda728174fc0e962578e Mon Sep 17 00:00:00 2001 From: ths Date: Tue, 20 Mar 2007 21:50:52 +0000 Subject: [PATCH] fcntl64 fix, by Kirill A. Shutemov. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2517 c046a42c-6fe2-441c-8c8c-71466251a162 --- linux-user/syscall.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5eb5b39..5ff364d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3872,15 +3872,27 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, #if TARGET_LONG_BITS == 32 case TARGET_NR_fcntl64: { + int cmd; struct flock64 fl; struct target_flock64 *target_fl; #ifdef TARGET_ARM struct target_eabi_flock64 *target_efl; #endif + switch(arg2){ + case TARGET_F_GETLK64: + cmd = F_GETLK64; + case TARGET_F_SETLK64: + cmd = F_SETLK64; + case TARGET_F_SETLKW64: + cmd = F_SETLK64; + default: + cmd = arg2; + } + switch(arg2) { - case F_GETLK64: - ret = get_errno(fcntl(arg1, arg2, &fl)); + case TARGET_F_GETLK64: + ret = get_errno(fcntl(arg1, cmd, &fl)); if (ret == 0) { #ifdef TARGET_ARM if (((CPUARMState *)cpu_env)->eabi) { @@ -3905,8 +3917,8 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, } break; - case F_SETLK64: - case F_SETLKW64: + case TARGET_F_SETLK64: + case TARGET_F_SETLKW64: #ifdef TARGET_ARM if (((CPUARMState *)cpu_env)->eabi) { lock_user_struct(target_efl, arg3, 1); @@ -3927,10 +3939,10 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, fl.l_pid = tswapl(target_fl->l_pid); unlock_user_struct(target_fl, arg3, 0); } - ret = get_errno(fcntl(arg1, arg2, &fl)); + ret = get_errno(fcntl(arg1, cmd, &fl)); break; default: - ret = get_errno(do_fcntl(arg1, arg2, arg3)); + ret = get_errno(do_fcntl(arg1, cmd, arg3)); break; } break; -- 2.7.4