[PATCH 2/5] manual: Document error codes missing for 'if_indextoname'

Florian Weimer fweimer@redhat.com
Tue May 27 14:10:44 GMT 2025


* Maciej W. Rozycki:

> On Mon, 26 May 2025, Florian Weimer wrote:
>
>> > +@item ENOSYS
>> > +This function is not implemented.
>> > +@end table
>> 
>> I think ENOSYS comes from the unused stub, so we don't need to document
>> it.  The Hurd implementation has an error path for ENOSYS, but that
>> looks effectively dead (it requires a race condition on the socket
>> descriptor).
>
>  Is it this code sequence:
>
>   if (__ioctl (fd, SIOCGIFNAME, &ifr) < 0)
>     {
>       int saved_errno = errno;
>       __close (fd);
>       if (saved_errno == EINVAL || saved_errno == ENOTTY)
>         __hurd_fail (ENOSYS);
>
> that you refer to?  If so, then it seems like an implementation bug to me, 
> as POSIX has it:
>
> [ENOSYS]
>      Functionality not supported.  An attempt was made to use optional 
>      functionality that is not supported in this implementation.
>
> which does not seem adequate for reporting a request failure coming from a 
> race condition.

I would say that the race condition (due to closing file descriptors
used by the implementation) triggers undefined behavior, and as a result
the error codes mandated by POSIX do not matter.

Thanks,
Florian



More information about the Libc-alpha mailing list