|
| 1 | +commit a868cc88bde245a274923be481408c6660587b72 |
| 2 | +Author: Michael Dusan < [email protected]> |
| 3 | +Date: Wed Jun 5 11:09:44 2024 -0400 |
| 4 | + |
| 5 | + syscall.c |
| 6 | + |
| 7 | +diff --git a/linux-user/syscall.c b/linux-user/syscall.c |
| 8 | +index 29420959bf..cdb0aadf6e 100644 |
| 9 | +--- a/linux-user/syscall.c |
| 10 | ++++ b/linux-user/syscall.c |
| 11 | +@@ -6744,13 +6744,13 @@ static int target_to_host_fcntl_cmd(int cmd) |
| 12 | + ret = cmd; |
| 13 | + break; |
| 14 | + case TARGET_F_GETLK: |
| 15 | +- ret = F_GETLK64; |
| 16 | ++ ret = F_GETLK; |
| 17 | + break; |
| 18 | + case TARGET_F_SETLK: |
| 19 | +- ret = F_SETLK64; |
| 20 | ++ ret = F_SETLK; |
| 21 | + break; |
| 22 | + case TARGET_F_SETLKW: |
| 23 | +- ret = F_SETLKW64; |
| 24 | ++ ret = F_SETLKW; |
| 25 | + break; |
| 26 | + case TARGET_F_GETOWN: |
| 27 | + ret = F_GETOWN; |
| 28 | +@@ -6766,13 +6766,13 @@ static int target_to_host_fcntl_cmd(int cmd) |
| 29 | + break; |
| 30 | + #if TARGET_ABI_BITS == 32 |
| 31 | + case TARGET_F_GETLK64: |
| 32 | +- ret = F_GETLK64; |
| 33 | ++ ret = F_GETLK; |
| 34 | + break; |
| 35 | + case TARGET_F_SETLK64: |
| 36 | +- ret = F_SETLK64; |
| 37 | ++ ret = F_SETLK; |
| 38 | + break; |
| 39 | + case TARGET_F_SETLKW64: |
| 40 | +- ret = F_SETLKW64; |
| 41 | ++ ret = F_SETLKW; |
| 42 | + break; |
| 43 | + #endif |
| 44 | + case TARGET_F_SETLEASE: |
| 45 | +@@ -6826,8 +6826,8 @@ static int target_to_host_fcntl_cmd(int cmd) |
| 46 | + * them to 5, 6 and 7 before making the syscall(). Since we make the |
| 47 | + * syscall directly, adjust to what is supported by the kernel. |
| 48 | + */ |
| 49 | +- if (ret >= F_GETLK64 && ret <= F_SETLKW64) { |
| 50 | +- ret -= F_GETLK64 - 5; |
| 51 | ++ if (ret >= F_GETLK && ret <= F_SETLKW) { |
| 52 | ++ ret -= F_GETLK - 5; |
| 53 | + } |
| 54 | + #endif |
| 55 | + |
| 56 | +@@ -6860,7 +6860,7 @@ static int host_to_target_flock(int type) |
| 57 | + return type; |
| 58 | + } |
| 59 | + |
| 60 | +-static inline abi_long copy_from_user_flock(struct flock64 *fl, |
| 61 | ++static inline abi_long copy_from_user_flock(struct flock *fl, |
| 62 | + abi_ulong target_flock_addr) |
| 63 | + { |
| 64 | + struct target_flock *target_fl; |
| 65 | +@@ -6885,7 +6885,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl, |
| 66 | + } |
| 67 | + |
| 68 | + static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, |
| 69 | +- const struct flock64 *fl) |
| 70 | ++ const struct flock *fl) |
| 71 | + { |
| 72 | + struct target_flock *target_fl; |
| 73 | + short l_type; |
| 74 | +@@ -6904,8 +6904,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr, |
| 75 | + return 0; |
| 76 | + } |
| 77 | + |
| 78 | +-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr); |
| 79 | +-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl); |
| 80 | ++typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr); |
| 81 | ++typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl); |
| 82 | + |
| 83 | + #if defined(TARGET_ARM) && TARGET_ABI_BITS == 32 |
| 84 | + struct target_oabi_flock64 { |
| 85 | +@@ -6916,7 +6916,7 @@ struct target_oabi_flock64 { |
| 86 | + abi_int l_pid; |
| 87 | + } QEMU_PACKED; |
| 88 | + |
| 89 | +-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, |
| 90 | ++static inline abi_long copy_from_user_oabi_flock64(struct flock *fl, |
| 91 | + abi_ulong target_flock_addr) |
| 92 | + { |
| 93 | + struct target_oabi_flock64 *target_fl; |
| 94 | +@@ -6941,7 +6941,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl, |
| 95 | + } |
| 96 | + |
| 97 | + static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, |
| 98 | +- const struct flock64 *fl) |
| 99 | ++ const struct flock *fl) |
| 100 | + { |
| 101 | + struct target_oabi_flock64 *target_fl; |
| 102 | + short l_type; |
| 103 | +@@ -6961,7 +6961,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr, |
| 104 | + } |
| 105 | + #endif |
| 106 | + |
| 107 | +-static inline abi_long copy_from_user_flock64(struct flock64 *fl, |
| 108 | ++static inline abi_long copy_from_user_flock64(struct flock *fl, |
| 109 | + abi_ulong target_flock_addr) |
| 110 | + { |
| 111 | + struct target_flock64 *target_fl; |
| 112 | +@@ -6986,7 +6986,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl, |
| 113 | + } |
| 114 | + |
| 115 | + static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, |
| 116 | +- const struct flock64 *fl) |
| 117 | ++ const struct flock *fl) |
| 118 | + { |
| 119 | + struct target_flock64 *target_fl; |
| 120 | + short l_type; |
| 121 | +@@ -7007,7 +7007,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr, |
| 122 | + |
| 123 | + static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) |
| 124 | + { |
| 125 | +- struct flock64 fl64; |
| 126 | ++ struct flock fl64; |
| 127 | + #ifdef F_GETOWN_EX |
| 128 | + struct f_owner_ex fox; |
| 129 | + struct target_f_owner_ex *target_fox; |
| 130 | +@@ -7283,7 +7283,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1 |
| 131 | + arg2 = arg3; |
| 132 | + arg3 = arg4; |
| 133 | + } |
| 134 | +- return get_errno(truncate64(arg1, target_offset64(arg2, arg3))); |
| 135 | ++ return get_errno(truncate(arg1, target_offset64(arg2, arg3))); |
| 136 | + } |
| 137 | + #endif |
| 138 | + |
| 139 | +@@ -7297,7 +7297,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1, |
| 140 | + arg2 = arg3; |
| 141 | + arg3 = arg4; |
| 142 | + } |
| 143 | +- return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3))); |
| 144 | ++ return get_errno(ftruncate(arg1, target_offset64(arg2, arg3))); |
| 145 | + } |
| 146 | + #endif |
| 147 | + |
| 148 | +@@ -8683,7 +8683,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) |
| 149 | + void *tdirp; |
| 150 | + int hlen, hoff, toff; |
| 151 | + int hreclen, treclen; |
| 152 | +- off64_t prev_diroff = 0; |
| 153 | ++ off_t prev_diroff = 0; |
| 154 | + |
| 155 | + hdirp = g_try_malloc(count); |
| 156 | + if (!hdirp) { |
| 157 | +@@ -8736,7 +8736,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count) |
| 158 | + * Return what we have, resetting the file pointer to the |
| 159 | + * location of the first record not returned. |
| 160 | + */ |
| 161 | +- lseek64(dirfd, prev_diroff, SEEK_SET); |
| 162 | ++ lseek(dirfd, prev_diroff, SEEK_SET); |
| 163 | + break; |
| 164 | + } |
| 165 | + |
| 166 | +@@ -8770,7 +8770,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) |
| 167 | + void *tdirp; |
| 168 | + int hlen, hoff, toff; |
| 169 | + int hreclen, treclen; |
| 170 | +- off64_t prev_diroff = 0; |
| 171 | ++ off_t prev_diroff = 0; |
| 172 | + |
| 173 | + hdirp = g_try_malloc(count); |
| 174 | + if (!hdirp) { |
| 175 | +@@ -8812,7 +8812,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count) |
| 176 | + * Return what we have, resetting the file pointer to the |
| 177 | + * location of the first record not returned. |
| 178 | + */ |
| 179 | +- lseek64(dirfd, prev_diroff, SEEK_SET); |
| 180 | ++ lseek(dirfd, prev_diroff, SEEK_SET); |
| 181 | + break; |
| 182 | + } |
| 183 | + |
| 184 | +@@ -11543,7 +11543,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, |
| 185 | + return -TARGET_EFAULT; |
| 186 | + } |
| 187 | + } |
| 188 | +- ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); |
| 189 | ++ ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5))); |
| 190 | + unlock_user(p, arg2, ret); |
| 191 | + return ret; |
| 192 | + case TARGET_NR_pwrite64: |
| 193 | +@@ -11560,7 +11560,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, |
| 194 | + return -TARGET_EFAULT; |
| 195 | + } |
| 196 | + } |
| 197 | +- ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); |
| 198 | ++ ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5))); |
| 199 | + unlock_user(p, arg2, 0); |
| 200 | + return ret; |
| 201 | + #endif |
| 202 | +@@ -12420,7 +12420,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, |
| 203 | + case TARGET_NR_fcntl64: |
| 204 | + { |
| 205 | + int cmd; |
| 206 | +- struct flock64 fl; |
| 207 | ++ struct flock fl; |
| 208 | + from_flock64_fn *copyfrom = copy_from_user_flock64; |
| 209 | + to_flock64_fn *copyto = copy_to_user_flock64; |
| 210 | + |
0 commit comments