Commit 5813427b1ddcd74c39f49563c12f1f4a6dba5cea
1 parent
e126cf13
fcntl() remaining fix, by Stuart Anderson.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2559 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
34 additions
and
0 deletions
linux-user/syscall.c
... | ... | @@ -1793,6 +1793,13 @@ static long do_fcntl(int fd, int cmd, target_ulong arg) |
1793 | 1793 | |
1794 | 1794 | switch(cmd) { |
1795 | 1795 | case TARGET_F_GETLK: |
1796 | + lock_user_struct(target_fl, arg, 1); | |
1797 | + fl.l_type = tswap16(target_fl->l_type); | |
1798 | + fl.l_whence = tswap16(target_fl->l_whence); | |
1799 | + fl.l_start = tswapl(target_fl->l_start); | |
1800 | + fl.l_len = tswapl(target_fl->l_len); | |
1801 | + fl.l_pid = tswapl(target_fl->l_pid); | |
1802 | + unlock_user_struct(target_fl, arg, 0); | |
1796 | 1803 | ret = fcntl(fd, cmd, &fl); |
1797 | 1804 | if (ret == 0) { |
1798 | 1805 | lock_user_struct(target_fl, arg, 0); |
... | ... | @@ -1818,6 +1825,13 @@ static long do_fcntl(int fd, int cmd, target_ulong arg) |
1818 | 1825 | break; |
1819 | 1826 | |
1820 | 1827 | case TARGET_F_GETLK64: |
1828 | + lock_user_struct(target_fl64, arg, 1); | |
1829 | + fl64.l_type = tswap16(target_fl64->l_type) >> 1; | |
1830 | + fl64.l_whence = tswap16(target_fl64->l_whence); | |
1831 | + fl64.l_start = tswapl(target_fl64->l_start); | |
1832 | + fl64.l_len = tswapl(target_fl64->l_len); | |
1833 | + fl64.l_pid = tswap16(target_fl64->l_pid); | |
1834 | + unlock_user_struct(target_fl64, arg, 0); | |
1821 | 1835 | ret = fcntl(fd, cmd >> 1, &fl64); |
1822 | 1836 | if (ret == 0) { |
1823 | 1837 | lock_user_struct(target_fl64, arg, 0); |
... | ... | @@ -3896,6 +3910,26 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3896 | 3910 | |
3897 | 3911 | switch(arg2) { |
3898 | 3912 | case TARGET_F_GETLK64: |
3913 | +#ifdef TARGET_ARM | |
3914 | + if (((CPUARMState *)cpu_env)->eabi) { | |
3915 | + lock_user_struct(target_efl, arg3, 1); | |
3916 | + fl.l_type = tswap16(target_efl->l_type); | |
3917 | + fl.l_whence = tswap16(target_efl->l_whence); | |
3918 | + fl.l_start = tswap64(target_efl->l_start); | |
3919 | + fl.l_len = tswap64(target_efl->l_len); | |
3920 | + fl.l_pid = tswapl(target_efl->l_pid); | |
3921 | + unlock_user_struct(target_efl, arg3, 0); | |
3922 | + } else | |
3923 | +#endif | |
3924 | + { | |
3925 | + lock_user_struct(target_fl, arg3, 1); | |
3926 | + fl.l_type = tswap16(target_fl->l_type); | |
3927 | + fl.l_whence = tswap16(target_fl->l_whence); | |
3928 | + fl.l_start = tswap64(target_fl->l_start); | |
3929 | + fl.l_len = tswap64(target_fl->l_len); | |
3930 | + fl.l_pid = tswapl(target_fl->l_pid); | |
3931 | + unlock_user_struct(target_fl, arg3, 0); | |
3932 | + } | |
3899 | 3933 | ret = get_errno(fcntl(arg1, cmd, &fl)); |
3900 | 3934 | if (ret == 0) { |
3901 | 3935 | #ifdef TARGET_ARM | ... | ... |