linux-user: Fix fcntl64() and accept4() for 32-bit targets
A set of 3 patches: The first two patches fix fcntl64() and accept4(). the 3rd patch enhances the strace output for pread64/pwrite64(). This pull request does not includes Richard's mmap2 patch: https://patchew.org/QEMU/20230630132159.376995-1-richard.henderson@linaro.org/20230630132159.376995-12-richard.henderson@linaro.org/ Changes: v3: - added r-b from Richard to patches #1 and #2 v2: - rephrased commmit logs - return O_LARGFILE for fcntl() syscall too - dropped #ifdefs in accept4() patch - Dropped my mmap2() patch (former patch #3) - added r-b from Richard to 3rd patch Helge -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCZKl5RQAKCRD3ErUQojoP X82sAQDnW53s7YkU4sZ1YREPWPVoCXZXgm587jTrmwT4v9AenQEAlbKdsw4hzzr/ ptuKvgZfZaIp5QjBUl/Dh/CI5aVOLgc= =hd4O -----END PGP SIGNATURE----- Merge tag 'linux-user-fcntl64-pull-request' of https://github.com/hdeller/qemu-hppa into staging linux-user: Fix fcntl64() and accept4() for 32-bit targets A set of 3 patches: The first two patches fix fcntl64() and accept4(). the 3rd patch enhances the strace output for pread64/pwrite64(). This pull request does not includes Richard's mmap2 patch: https://patchew.org/QEMU/20230630132159.376995-1-richard.henderson@linaro.org/20230630132159.376995-12-richard.henderson@linaro.org/ Changes: v3: - added r-b from Richard to patches #1 and #2 v2: - rephrased commmit logs - return O_LARGFILE for fcntl() syscall too - dropped #ifdefs in accept4() patch - Dropped my mmap2() patch (former patch #3) - added r-b from Richard to 3rd patch Helge # -----BEGIN PGP SIGNATURE----- # # iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCZKl5RQAKCRD3ErUQojoP # X82sAQDnW53s7YkU4sZ1YREPWPVoCXZXgm587jTrmwT4v9AenQEAlbKdsw4hzzr/ # ptuKvgZfZaIp5QjBUl/Dh/CI5aVOLgc= # =hd4O # -----END PGP SIGNATURE----- # gpg: Signature made Sat 08 Jul 2023 03:57:09 PM BST # gpg: using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F # gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown] # gpg: aka "Helge Deller <deller@kernel.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 4544 8228 2CD9 10DB EF3D 25F8 3E5F 3D04 A7A2 4603 # Subkey fingerprint: BCE9 123E 1AD2 9F07 C049 BBDE F712 B510 A23A 0F5F * tag 'linux-user-fcntl64-pull-request' of https://github.com/hdeller/qemu-hppa: linux-user: Improve strace output of pread64() and pwrite64() linux-user: Fix accept4(SOCK_NONBLOCK) syscall linux-user: Fix fcntl() and fcntl64() to return O_LARGEFILE for 32-bit targets Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
fc61742e44
@ -3999,6 +3999,25 @@ print_tgkill(CPUArchState *cpu_env, const struct syscallname *name,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)
|
||||
static void
|
||||
print_pread64(CPUArchState *cpu_env, const struct syscallname *name,
|
||||
abi_long arg0, abi_long arg1, abi_long arg2,
|
||||
abi_long arg3, abi_long arg4, abi_long arg5)
|
||||
{
|
||||
if (regpairs_aligned(cpu_env, TARGET_NR_pread64)) {
|
||||
arg3 = arg4;
|
||||
arg4 = arg5;
|
||||
}
|
||||
print_syscall_prologue(name);
|
||||
print_raw_param("%d", arg0, 0);
|
||||
print_pointer(arg1, 0);
|
||||
print_raw_param("%d", arg2, 0);
|
||||
print_raw_param("%" PRIu64, target_offset64(arg3, arg4), 1);
|
||||
print_syscall_epilogue(name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_NR_statx
|
||||
static void
|
||||
print_statx(CPUArchState *cpu_env, const struct syscallname *name,
|
||||
|
@ -1068,7 +1068,7 @@
|
||||
{ TARGET_NR_prctl, "prctl" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_pread64
|
||||
{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
|
||||
{ TARGET_NR_pread64, "pread64" , NULL, print_pread64, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_preadv
|
||||
{ TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
|
||||
@ -1099,7 +1099,7 @@
|
||||
{ TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_pwrite64
|
||||
{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
|
||||
{ TARGET_NR_pwrite64, "pwrite64" , NULL, print_pread64, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_pwritev
|
||||
{ TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },
|
||||
|
@ -3440,7 +3440,17 @@ static abi_long do_accept4(int fd, abi_ulong target_addr,
|
||||
abi_long ret;
|
||||
int host_flags;
|
||||
|
||||
host_flags = target_to_host_bitmask(flags, fcntl_flags_tbl);
|
||||
if (flags & ~(TARGET_SOCK_CLOEXEC | TARGET_SOCK_NONBLOCK)) {
|
||||
return -TARGET_EINVAL;
|
||||
}
|
||||
|
||||
host_flags = 0;
|
||||
if (flags & TARGET_SOCK_NONBLOCK) {
|
||||
host_flags |= SOCK_NONBLOCK;
|
||||
}
|
||||
if (flags & TARGET_SOCK_CLOEXEC) {
|
||||
host_flags |= SOCK_CLOEXEC;
|
||||
}
|
||||
|
||||
if (target_addr == 0) {
|
||||
return get_errno(safe_accept4(fd, NULL, NULL, host_flags));
|
||||
@ -7132,6 +7142,10 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
|
||||
ret = get_errno(safe_fcntl(fd, host_cmd, arg));
|
||||
if (ret >= 0) {
|
||||
ret = host_to_target_bitmask(ret, fcntl_flags_tbl);
|
||||
/* tell 32-bit guests it uses largefile on 64-bit hosts: */
|
||||
if (O_LARGEFILE == 0 && HOST_LONG_BITS == 64) {
|
||||
ret |= TARGET_O_LARGEFILE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user