2 ms·
`errno` is a userland concept; the kernel returns negative error numbers that libc then turns into -1 and sets errno. Thus the correct manpage is errno(3).
by aaronmdjones 4mo ago
`errno` is a userland concept; the kernel returns negative error numbers that libc then turns into -1 and sets errno. Thus the correct manpage is errno(3).
- eqvinox 4mo agoOpenBSD up to 5.9 had errno(2) symlinked to intro(2), describing error codes: https://man.freebsd.org/cgi/man.cgi?query=errno&apropos=0&sektion=2&manpath=OpenBSD+5.9&arch=default&format=html https://man.freebsd.org/cgi/man.cgi?query=errno&apropos=0&se... Also, your statements about the kernel and libc are OS specific.
- deleted 4mo ago[deleted]
- WhyNotHugo 4mo agoWhy does libc do this instead of simply returning that same negative number?
- rcxdude 4mo agoPOSIX, basically. It was already a convention by the time linux/glibc implemented it.
- matheusmoreira 4mo agoLegacy. It's always been this way and it can't change without breaking everything.