Lines 6812-6824
static int target_to_host_fcntl_cmd(int cmd)
Link Here
|
6812 |
ret = cmd; |
6812 |
ret = cmd; |
6813 |
break; |
6813 |
break; |
6814 |
case TARGET_F_GETLK: |
6814 |
case TARGET_F_GETLK: |
6815 |
ret = F_GETLK64; |
6815 |
ret = F_GETLK; |
6816 |
break; |
6816 |
break; |
6817 |
case TARGET_F_SETLK: |
6817 |
case TARGET_F_SETLK: |
6818 |
ret = F_SETLK64; |
6818 |
ret = F_SETLK; |
6819 |
break; |
6819 |
break; |
6820 |
case TARGET_F_SETLKW: |
6820 |
case TARGET_F_SETLKW: |
6821 |
ret = F_SETLKW64; |
6821 |
ret = F_SETLKW; |
6822 |
break; |
6822 |
break; |
6823 |
case TARGET_F_GETOWN: |
6823 |
case TARGET_F_GETOWN: |
6824 |
ret = F_GETOWN; |
6824 |
ret = F_GETOWN; |
Lines 6834-6846
static int target_to_host_fcntl_cmd(int cmd)
Link Here
|
6834 |
break; |
6834 |
break; |
6835 |
#if TARGET_ABI_BITS == 32 |
6835 |
#if TARGET_ABI_BITS == 32 |
6836 |
case TARGET_F_GETLK64: |
6836 |
case TARGET_F_GETLK64: |
6837 |
ret = F_GETLK64; |
6837 |
ret = F_GETLK; |
6838 |
break; |
6838 |
break; |
6839 |
case TARGET_F_SETLK64: |
6839 |
case TARGET_F_SETLK64: |
6840 |
ret = F_SETLK64; |
6840 |
ret = F_SETLK; |
6841 |
break; |
6841 |
break; |
6842 |
case TARGET_F_SETLKW64: |
6842 |
case TARGET_F_SETLKW64: |
6843 |
ret = F_SETLKW64; |
6843 |
ret = F_SETLKW; |
6844 |
break; |
6844 |
break; |
6845 |
#endif |
6845 |
#endif |
6846 |
case TARGET_F_SETLEASE: |
6846 |
case TARGET_F_SETLEASE: |
Lines 6894-6901
static int target_to_host_fcntl_cmd(int cmd)
Link Here
|
6894 |
* them to 5, 6 and 7 before making the syscall(). Since we make the |
6894 |
* them to 5, 6 and 7 before making the syscall(). Since we make the |
6895 |
* syscall directly, adjust to what is supported by the kernel. |
6895 |
* syscall directly, adjust to what is supported by the kernel. |
6896 |
*/ |
6896 |
*/ |
6897 |
if (ret >= F_GETLK64 && ret <= F_SETLKW64) { |
6897 |
if (ret >= F_GETLK && ret <= F_SETLKW) { |
6898 |
ret -= F_GETLK64 - 5; |
6898 |
ret -= F_GETLK - 5; |
6899 |
} |
6899 |
} |
6900 |
#endif |
6900 |
#endif |
6901 |
|
6901 |
|
Lines 6928-6934
static int host_to_target_flock(int type)
Link Here
|
6928 |
return type; |
6928 |
return type; |
6929 |
} |
6929 |
} |
6930 |
|
6930 |
|
6931 |
static inline abi_long copy_from_user_flock(struct flock64 *fl, |
6931 |
static inline abi_long copy_from_user_flock(struct flock *fl, |
6932 |
abi_ulong target_flock_addr) |
6932 |
abi_ulong target_flock_addr) |
6933 |
{ |
6933 |
{ |
6934 |
struct target_flock *target_fl; |
6934 |
struct target_flock *target_fl; |
Lines 6953-6959
static inline abi_long copy_from_user_flock(struct flock64 *fl,
Link Here
|
6953 |
} |
6953 |
} |
6954 |
|
6954 |
|
6955 |
static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, |
6955 |
static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, |
6956 |
const struct flock64 *fl) |
6956 |
const struct flock *fl) |
6957 |
{ |
6957 |
{ |
6958 |
struct target_flock *target_fl; |
6958 |
struct target_flock *target_fl; |
6959 |
short l_type; |
6959 |
short l_type; |
Lines 6972-6979
static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
Link Here
|
6972 |
return 0; |
6972 |
return 0; |
6973 |
} |
6973 |
} |
6974 |
|
6974 |
|
6975 |
typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr); |
6975 |
typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr); |
6976 |
typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl); |
6976 |
typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl); |
6977 |
|
6977 |
|
6978 |
#if defined(TARGET_ARM) && TARGET_ABI_BITS == 32 |
6978 |
#if defined(TARGET_ARM) && TARGET_ABI_BITS == 32 |
6979 |
struct target_oabi_flock64 { |
6979 |
struct target_oabi_flock64 { |
Lines 6984-6990
struct target_oabi_flock64 {
Link Here
|
6984 |
abi_int l_pid; |
6984 |
abi_int l_pid; |
6985 |
} QEMU_PACKED; |
6985 |
} QEMU_PACKED; |
6986 |
|
6986 |
|
6987 |
static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, |
6987 |
static inline abi_long copy_from_user_oabi_flock64(struct flock *fl, |
6988 |
abi_ulong target_flock_addr) |
6988 |
abi_ulong target_flock_addr) |
6989 |
{ |
6989 |
{ |
6990 |
struct target_oabi_flock64 *target_fl; |
6990 |
struct target_oabi_flock64 *target_fl; |
Lines 7009-7015
static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
Link Here
|
7009 |
} |
7009 |
} |
7010 |
|
7010 |
|
7011 |
static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, |
7011 |
static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, |
7012 |
const struct flock64 *fl) |
7012 |
const struct flock *fl) |
7013 |
{ |
7013 |
{ |
7014 |
struct target_oabi_flock64 *target_fl; |
7014 |
struct target_oabi_flock64 *target_fl; |
7015 |
short l_type; |
7015 |
short l_type; |
Lines 7029-7035
static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
Link Here
|
7029 |
} |
7029 |
} |
7030 |
#endif |
7030 |
#endif |
7031 |
|
7031 |
|
7032 |
static inline abi_long copy_from_user_flock64(struct flock64 *fl, |
7032 |
static inline abi_long copy_from_user_flock64(struct flock *fl, |
7033 |
abi_ulong target_flock_addr) |
7033 |
abi_ulong target_flock_addr) |
7034 |
{ |
7034 |
{ |
7035 |
struct target_flock64 *target_fl; |
7035 |
struct target_flock64 *target_fl; |
Lines 7054-7060
static inline abi_long copy_from_user_flock64(struct flock64 *fl,
Link Here
|
7054 |
} |
7054 |
} |
7055 |
|
7055 |
|
7056 |
static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, |
7056 |
static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, |
7057 |
const struct flock64 *fl) |
7057 |
const struct flock *fl) |
7058 |
{ |
7058 |
{ |
7059 |
struct target_flock64 *target_fl; |
7059 |
struct target_flock64 *target_fl; |
7060 |
short l_type; |
7060 |
short l_type; |
Lines 7075-7081
static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
Link Here
|
7075 |
|
7075 |
|
7076 |
static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) |
7076 |
static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) |
7077 |
{ |
7077 |
{ |
7078 |
struct flock64 fl64; |
7078 |
struct flock fl64; |
7079 |
#ifdef F_GETOWN_EX |
7079 |
#ifdef F_GETOWN_EX |
7080 |
struct f_owner_ex fox; |
7080 |
struct f_owner_ex fox; |
7081 |
struct target_f_owner_ex *target_fox; |
7081 |
struct target_f_owner_ex *target_fox; |
Lines 7347-7353
static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
Link Here
|
7347 |
arg2 = arg3; |
7347 |
arg2 = arg3; |
7348 |
arg3 = arg4; |
7348 |
arg3 = arg4; |
7349 |
} |
7349 |
} |
7350 |
return get_errno(truncate64(arg1, target_offset64(arg2, arg3))); |
7350 |
return get_errno(truncate(arg1, target_offset64(arg2, arg3))); |
7351 |
} |
7351 |
} |
7352 |
#endif |
7352 |
#endif |
7353 |
|
7353 |
|
Lines 7361-7367
static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
Link Here
|
7361 |
arg2 = arg3; |
7361 |
arg2 = arg3; |
7362 |
arg3 = arg4; |
7362 |
arg3 = arg4; |
7363 |
} |
7363 |
} |
7364 |
return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3))); |
7364 |
return get_errno(ftruncate(arg1, target_offset64(arg2, arg3))); |
7365 |
} |
7365 |
} |
7366 |
#endif |
7366 |
#endif |
7367 |
|
7367 |
|
Lines 8597-8603
static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
Link Here
|
8597 |
void *tdirp; |
8597 |
void *tdirp; |
8598 |
int hlen, hoff, toff; |
8598 |
int hlen, hoff, toff; |
8599 |
int hreclen, treclen; |
8599 |
int hreclen, treclen; |
8600 |
off64_t prev_diroff = 0; |
8600 |
off_t prev_diroff = 0; |
8601 |
|
8601 |
|
8602 |
hdirp = g_try_malloc(count); |
8602 |
hdirp = g_try_malloc(count); |
8603 |
if (!hdirp) { |
8603 |
if (!hdirp) { |
Lines 8650-8656
static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
Link Here
|
8650 |
* Return what we have, resetting the file pointer to the |
8650 |
* Return what we have, resetting the file pointer to the |
8651 |
* location of the first record not returned. |
8651 |
* location of the first record not returned. |
8652 |
*/ |
8652 |
*/ |
8653 |
lseek64(dirfd, prev_diroff, SEEK_SET); |
8653 |
lseek(dirfd, prev_diroff, SEEK_SET); |
8654 |
break; |
8654 |
break; |
8655 |
} |
8655 |
} |
8656 |
|
8656 |
|
Lines 8684-8690
static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
Link Here
|
8684 |
void *tdirp; |
8684 |
void *tdirp; |
8685 |
int hlen, hoff, toff; |
8685 |
int hlen, hoff, toff; |
8686 |
int hreclen, treclen; |
8686 |
int hreclen, treclen; |
8687 |
off64_t prev_diroff = 0; |
8687 |
off_t prev_diroff = 0; |
8688 |
|
8688 |
|
8689 |
hdirp = g_try_malloc(count); |
8689 |
hdirp = g_try_malloc(count); |
8690 |
if (!hdirp) { |
8690 |
if (!hdirp) { |
Lines 8726-8732
static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
Link Here
|
8726 |
* Return what we have, resetting the file pointer to the |
8726 |
* Return what we have, resetting the file pointer to the |
8727 |
* location of the first record not returned. |
8727 |
* location of the first record not returned. |
8728 |
*/ |
8728 |
*/ |
8729 |
lseek64(dirfd, prev_diroff, SEEK_SET); |
8729 |
lseek(dirfd, prev_diroff, SEEK_SET); |
8730 |
break; |
8730 |
break; |
8731 |
} |
8731 |
} |
8732 |
|
8732 |
|
Lines 11157-11163
static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
Link Here
|
11157 |
return -TARGET_EFAULT; |
11157 |
return -TARGET_EFAULT; |
11158 |
} |
11158 |
} |
11159 |
} |
11159 |
} |
11160 |
ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); |
11160 |
ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5))); |
11161 |
unlock_user(p, arg2, ret); |
11161 |
unlock_user(p, arg2, ret); |
11162 |
return ret; |
11162 |
return ret; |
11163 |
case TARGET_NR_pwrite64: |
11163 |
case TARGET_NR_pwrite64: |
Lines 11174-11180
static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
Link Here
|
11174 |
return -TARGET_EFAULT; |
11174 |
return -TARGET_EFAULT; |
11175 |
} |
11175 |
} |
11176 |
} |
11176 |
} |
11177 |
ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); |
11177 |
ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5))); |
11178 |
unlock_user(p, arg2, 0); |
11178 |
unlock_user(p, arg2, 0); |
11179 |
return ret; |
11179 |
return ret; |
11180 |
#endif |
11180 |
#endif |
Lines 12034-12040
static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
Link Here
|
12034 |
case TARGET_NR_fcntl64: |
12034 |
case TARGET_NR_fcntl64: |
12035 |
{ |
12035 |
{ |
12036 |
int cmd; |
12036 |
int cmd; |
12037 |
struct flock64 fl; |
12037 |
struct flock fl; |
12038 |
from_flock64_fn *copyfrom = copy_from_user_flock64; |
12038 |
from_flock64_fn *copyfrom = copy_from_user_flock64; |
12039 |
to_flock64_fn *copyto = copy_to_user_flock64; |
12039 |
to_flock64_fn *copyto = copy_to_user_flock64; |