]> git.ipfire.org Git - thirdparty/qemu.git/commit
linux-user: Fix fcntl() and fcntl64() to return O_LARGEFILE for 32-bit targets
authorHelge Deller <deller@gmx.de>
Sat, 8 Jul 2023 05:00:25 +0000 (07:00 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 31 Jul 2023 05:52:37 +0000 (08:52 +0300)
commit741df485e8aec3f509a4e26c975e4cdc94239c88
tree1fb211754b10740e45b0a5647d881d012a9dca2d
parent73d6ac24c81f1aeae554d469616c9181511e6523
linux-user: Fix fcntl() and fcntl64() to return O_LARGEFILE for 32-bit targets

When running a 32-bit guest on a 64-bit host, fcntl[64](F_GETFL) should
return with the TARGET_O_LARGEFILE flag set, because all 64-bit hosts
support large files unconditionally.

But on 64-bit hosts, O_LARGEFILE has the value 0, so the flag
translation can't be done with the fcntl_flags_tbl[]. Instead add the
TARGET_O_LARGEFILE flag afterwards.

Note that for 64-bit guests the compiler will optimize away this code,
since TARGET_O_LARGEFILE is zero.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit e0ddf8eac9f83c0bc5a3d39605d873ee0fe53421)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
linux-user/syscall.c