[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/22] linux-user/syscall.c: eliminate other explicit LFS usages
From: |
Michael Tokarev |
Subject: |
[PULL 03/22] linux-user/syscall.c: eliminate other explicit LFS usages |
Date: |
Fri, 20 Sep 2024 10:41:15 +0300 |
Since we alwasy build with LFS enabled, and with -D_FILE_OFFSET_BITS=64
in particular, there is no need to use 64bit versions of various system
calls and constants, regular ones will do just fine. Eliminate a few
last uses of the following constructs in linux-user/syscall.c:
off64_t
ftruncate64()
lseek64()
pread64()
pwrite64()
This way it can be built on systems where the 64bit variants of
everything is not defined (since the system always uses 64bit
variants), such as on recent MUSL.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2215
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/syscall.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 48c459e515..a666986189 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7265,7 +7265,7 @@ static inline abi_long target_truncate64(CPUArchState
*cpu_env, const char *arg1
arg2 = arg3;
arg3 = arg4;
}
- return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
+ return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
}
#endif
@@ -7279,7 +7279,7 @@ static inline abi_long target_ftruncate64(CPUArchState
*cpu_env, abi_long arg1,
arg2 = arg3;
arg3 = arg4;
}
- return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
+ return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
}
#endif
@@ -8664,7 +8664,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2,
abi_long count)
void *tdirp;
int hlen, hoff, toff;
int hreclen, treclen;
- off64_t prev_diroff = 0;
+ off_t prev_diroff = 0;
hdirp = g_try_malloc(count);
if (!hdirp) {
@@ -8717,7 +8717,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2,
abi_long count)
* Return what we have, resetting the file pointer to the
* location of the first record not returned.
*/
- lseek64(dirfd, prev_diroff, SEEK_SET);
+ lseek(dirfd, prev_diroff, SEEK_SET);
break;
}
@@ -8751,7 +8751,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2,
abi_long count)
void *tdirp;
int hlen, hoff, toff;
int hreclen, treclen;
- off64_t prev_diroff = 0;
+ off_t prev_diroff = 0;
hdirp = g_try_malloc(count);
if (!hdirp) {
@@ -8793,7 +8793,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2,
abi_long count)
* Return what we have, resetting the file pointer to the
* location of the first record not returned.
*/
- lseek64(dirfd, prev_diroff, SEEK_SET);
+ lseek(dirfd, prev_diroff, SEEK_SET);
break;
}
@@ -11524,7 +11524,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int
num, abi_long arg1,
return -TARGET_EFAULT;
}
}
- ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
+ ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
unlock_user(p, arg2, ret);
return ret;
case TARGET_NR_pwrite64:
@@ -11541,7 +11541,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int
num, abi_long arg1,
return -TARGET_EFAULT;
}
}
- ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
+ ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
unlock_user(p, arg2, 0);
return ret;
#endif
--
2.39.5
- [PULL 00/22] Trivial patches for 2024-09-20, Michael Tokarev, 2024/09/20
- [PULL 01/22] mark <zlib.h> with for-crc32 in a consistent manner, Michael Tokarev, 2024/09/20
- [PULL 03/22] linux-user/syscall.c: eliminate other explicit LFS usages,
Michael Tokarev <=
- [PULL 02/22] linux-user/syscall.c: drop 64 suffix from flock64 &Co, Michael Tokarev, 2024/09/20
- [PULL 05/22] hw/mips/jazz: fix typo in in-built NIC alias, Michael Tokarev, 2024/09/20
- [PULL 04/22] ppc: fix incorrect spelling of PowerMac, Michael Tokarev, 2024/09/20
- [PULL 06/22] hw/loongarch/virt: Add description for virt machine type, Michael Tokarev, 2024/09/20
- [PULL 07/22] tests/unit: Really build pbkdf test on macOS, Michael Tokarev, 2024/09/20
- [PULL 08/22] hw/virtio/Kconfig: Include vhost-user-scmi only on arm targets, Michael Tokarev, 2024/09/20
- [PULL 09/22] hw/display: Fix mirrored output in dm163, Michael Tokarev, 2024/09/20
- [PULL 10/22] envlist: Remove unused envlist_parse, Michael Tokarev, 2024/09/20
- [PULL 11/22] hw/sysbus: Remove unused sysbus_mmio_unmap, Michael Tokarev, 2024/09/20
- [PULL 13/22] tests/qemu-iotests/testenv: Use the "virt" machine for or1k, Michael Tokarev, 2024/09/20