[PATCH v5 13/13] string: Add strerrorname and strerrordesc
Carlos O'Donell
carlos@redhat.com
Mon Jul 6 12:43:44 GMT 2020
On 7/3/20 6:34 PM, Adhemerval Zanella wrote:
>
>
> On 03/07/2020 18:19, Carlos O'Donell wrote:
>> On 7/3/20 5:01 PM, Adhemerval Zanella wrote:
>>>
>>>
>>> On 02/07/2020 18:43, Carlos O'Donell wrote:
>>>> On 6/19/20 9:43 AM, Adhemerval Zanella wrote:
>>>>> The strerrorname returns error number name (i.g. "EINVAL" for EINVAL)
>>>>> while strerrordesc returns string describing error number (i.g
>>>>> "Invalid argument" for EINVAL). Different than strerror, strerrordesc
>>>>> does not attempt to translate the return description and both functions
>>>>> return NULL for an invalid error number.
>>>>>
>>>>> They should be used instead of sys_errlist and sys_nerr and both are
>>>>
>>>> s/and both/, both/g
>>>
>>> Ack.
>>>
>>>>
>>>>> thread and async-signal safe. These functions are GNU extensions.
>>>>>
>>>>> Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
>>>>> and s390x-linux-gnu.
>>>>
>>>> Why not strerrorname_np or strerrordesc_np? We don't have to use *_np,
>>>> but these functions are fiarly close in name to 'strerror' and so it
>>>> might be beneficial to use _np at the end, like you did for sigabbrev_np
>>>> and sigdescr_np. Thoughts?
>>>
>>> I don't have a strong preference here, on a patch iteration I used
>>> the the _np suffix and Florian has pointed out the str* namespace
>>> is reserved for libc implementations.
>>>
>>> But I think the _np is slight better to indicate it is an extension.
>>> If it is eventually adopted by other system without the _np suffix
>>> we can easily create an alias.
>>>
>>> So I have added the _np suffix.
>>>
>>>>
>>>> No regression on x86_64 and i686.
>>>>
>>>> Tested-by: Carlos O'Donell <carlos@redhat.com>
>>>
>>> Should I add the Reviewed-by as well?
>>
>> No. I want to review the final patch and I'll give Reviewed-by there.
>>
>
> Alright, should I re-send it with the _np changes?
Yes please. I think the _np APIs are very clearly intended to be APIs
within a known namespace e.g. str* which are non-portable and then we
can try to get POSIX to standardize on existing practice.
--
Cheers,
Carlos.
More information about the Libc-alpha
mailing list