Many functions set an error code on failure in the global
variable, errno
.
There is a slight complication with newlib
, because
errno
is not implemented as a variable, but a
macro (this make life easier for reentrant functions).
The solution for standard system call implementations, which must return an error code is to undefine the macro and use the external variable instead. At the head of such functions use the following.
#include <errno.h> #undef errno extern int errno;
Note | |
---|---|
|