Skip to content
Snippets Groups Projects
Commit 7d6a2ce8 authored by Natanael Copa's avatar Natanael Copa Committed by Michael Tokarev
Browse files

target/riscv/kvm: do not use non-portable strerrorname_np()

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 082e9e4a (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: default avatarNatanael Copa <ncopa@alpinelinux.org>
Reviewed-by: default avatarDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit d424db235434b8356c6b2d9420b846c7ddcc83ea)
parent 11b0730d
No related branches found
No related tags found
No related merge requests found
......@@ -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, &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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment