question about Glibc extensions
Rich Felker
dalias@libc.org
Thu May 21 01:00:58 GMT 2020
On Wed, May 20, 2020 at 10:22:55PM +0200, Andreas Schwab wrote:
> On Mai 20 2020, Martin Sebor wrote:
>
> > For readlink, using EINVAL to also mean "buffer size is greater
> > than SSIZE_MAX" implies programs cannot interpret that error value
> > alone as meaning the path doesn't refer to a symbolic link.
>
> You cannot do that anyway. There is no one-to-one mapping between error
> conditions and error numbers. The only guarantee is that a defined
> error condition results in a unique error number, not the other way
> round.
POSIX does have something to say about this:
"Implementations may generate error numbers listed here under
circumstances other than those described, if and only if all those
error conditions can always be treated identically to the error
conditions as described in this volume of POSIX.1-2017."
but just before that, it also says:
"Implementations may support additional errors not included in
this list, may generate errors included in this list under
circumstances other than those described here, or may contain
extensions or limitations that prevent some errors from
occurring."
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_03
More information about the Libc-alpha
mailing list