[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/7] target/riscv/kvm: do not use non-portable strerrorname_np()
From: |
Michael Tokarev |
Subject: |
[PULL 1/7] target/riscv/kvm: do not use non-portable strerrorname_np() |
Date: |
Mon, 25 Dec 2023 11:10:01 +0300 |
From: Natanael Copa <ncopa@alpinelinux.org>
strerrorname_np is non-portable and breaks building with musl libc.
Use strerror(errno) instead, like we do other places.
Cc: qemu-stable@nongnu.org
Fixes: commit 082e9e4a58ba (target/riscv/kvm: improve 'init_multiext_cfg' error
msg)
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2041
Buglink: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15541
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
target/riscv/kvm/kvm-cpu.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
index 45b6cf1cfa..117e33cf90 100644
--- a/target/riscv/kvm/kvm-cpu.c
+++ b/target/riscv/kvm/kvm-cpu.c
@@ -832,9 +832,8 @@ static void kvm_riscv_read_multiext_legacy(RISCVCPU *cpu,
multi_ext_cfg->supported = false;
val = false;
} else {
- error_report("Unable to read ISA_EXT KVM register %s, "
- "error code: %s", multi_ext_cfg->name,
- strerrorname_np(errno));
+ error_report("Unable to read ISA_EXT KVM register %s: %s",
+ multi_ext_cfg->name, strerror(errno));
exit(EXIT_FAILURE);
}
} else {
@@ -895,8 +894,8 @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu,
KVMScratchCPU *kvmcpu)
*
* Error out if we get any other errno.
*/
- error_report("Error when accessing get-reg-list, code: %s",
- strerrorname_np(errno));
+ error_report("Error when accessing get-reg-list: %s",
+ strerror(errno));
exit(EXIT_FAILURE);
}
@@ -905,8 +904,8 @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu,
KVMScratchCPU *kvmcpu)
reglist->n = rl_struct.n;
ret = ioctl(kvmcpu->cpufd, KVM_GET_REG_LIST, reglist);
if (ret) {
- error_report("Error when reading KVM_GET_REG_LIST, code %s ",
- strerrorname_np(errno));
+ error_report("Error when reading KVM_GET_REG_LIST: %s",
+ strerror(errno));
exit(EXIT_FAILURE);
}
@@ -927,9 +926,8 @@ static void kvm_riscv_init_multiext_cfg(RISCVCPU *cpu,
KVMScratchCPU *kvmcpu)
reg.addr = (uint64_t)&val;
ret = ioctl(kvmcpu->cpufd, KVM_GET_ONE_REG, ®);
if (ret != 0) {
- error_report("Unable to read ISA_EXT KVM register %s, "
- "error code: %s", multi_ext_cfg->name,
- strerrorname_np(errno));
+ error_report("Unable to read ISA_EXT KVM register %s: %s",
+ multi_ext_cfg->name, strerror(errno));
exit(EXIT_FAILURE);
}
--
2.39.2
- [PULL 0/7] Trivial patches for 2023-12-25, Michael Tokarev, 2023/12/25
- [PULL 1/7] target/riscv/kvm: do not use non-portable strerrorname_np(),
Michael Tokarev <=
- [PULL 2/7] qemu-options: Unify the help entries for cocoa, Michael Tokarev, 2023/12/25
- [PULL 5/7] accel/kvm: Turn DPRINTF macro use into tracepoints, Michael Tokarev, 2023/12/25
- [PULL 3/7] qemu-options: Tell more for -display cocoa, Michael Tokarev, 2023/12/25
- [PULL 4/7] docs/tools/qemu-img.rst: fix typo (sumarizes), Michael Tokarev, 2023/12/25
- [PULL 6/7] include/ui/rect.h: fix qemu_rect_init() mis-assignment, Michael Tokarev, 2023/12/25
- [PULL 7/7] virtio-blk: Fix potential nullpointer read access in virtio_blk_data_plane_destroy, Michael Tokarev, 2023/12/25
- Re: [PULL 0/7] Trivial patches for 2023-12-25, Philippe Mathieu-Daudé, 2023/12/26
- Re: [PULL 0/7] Trivial patches for 2023-12-25, Stefan Hajnoczi, 2023/12/26