In the book "The C Programming Language" it says:
"Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly. In addition, the integer expression
errno
(declared in<errno.h>
) may contain an error number that gives further information about the most recent error."
Where can I see a list of these functions?
You can use your favorite editor and the "Find in files..." to search for files that contain the
errno
keyword.@Adam, as Neil said, any function can be compiled against errno.h and set errno. It is by definition, impossible to list all utilities that have been compiled in this way to use the core errno functionality.
That said, there are several ways that errors may be reported back to a user. Using errno is just one.
The standard says this about
errno
:Which says to me that any library function can screw around with
errno
in any way it likes except:errno
to0
Note that the standard suggests the following in a footnote:
As noted in other answers, it's common for functions that are not in the standard to set
errno
as well.A proper question might be what are the values
errno
can get and what each of them means. You can see them listed inintro(2)
.You should assume that any function can set errno, not just those in the standard library. A list would therefore be a little pointless.
Nearly all posix library functions can set errno if an error occurs, that is when the function returns -1. An exception are threading functions because setting one global error variable from multiple threads would be very dangerous. They return 0 on success, the errorcode otherwise (This code is compatible with errno so you can use the strerror and perror functions on it).