[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 15/16] os-posix: cleanup: Replace perror with er
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 15/16] os-posix: cleanup: Replace perror with error_report |
Date: |
Tue, 24 Apr 2018 10:43:09 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 04/24/2018 10:40 AM, Eric Blake wrote:
> On 04/24/2018 10:18 AM, Daniel P. Berrangé wrote:
>
>>> - static void vreport(report_type type, const char *fmt, va_list ap)
>>> + static void vreport(report_type type, int errnoval, const char *fmt,
>>> va_list ap)
>>> ...
>>> + if (errnoval >= 0) {
>>> + error_printf(": %s", strerror(errnoval);
>>> + }
>>>
>>> and then add both
>>> error_report_errno
>>> error_vreport_errno
>>> with the obvious semantics.
>>
>> That would be nice, because then we can make these two functions actually
>> use strerror_r() instead of strerror(), for thread safety on all platforms.
>
> Except that strerror_r() is a bear to use portably, given that glibc's
> default declaration differs from the POSIX requirement (you can force
> glibc to give you the POSIX version, but doing so causes you to lose
> access to many other useful extensions). It's rather telling that 'git
> grep strerror_r' currently comes up empty.
That said, glib's g_strerror() may be suitable for this purpose,
although we are currently using it only in tests/ivshmem-test.c.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 16/16] configure: do_compiler: Dump some extra info under bash, Ian Jackson, 2018/04/19
Re: [Qemu-devel] [PATCH v7 00/16] xen: xen-domid-restrict improvements, no-reply, 2018/04/19