What is errno
?
errno
is a positive integer.
errno
is normally a global integer variable indicating the exact type of errors for most functions.
errno
may also be a macro expanded into a function.
What is errno
in a POSIX threaded program?
errno
is defined as a macro expanded into a function __errno
which returns the pointer to the actual errno
variable.
- POSIX threaded function will return an error number same as the type of
errno
, which indicates the exact type of error.
The definition of errno
#if defined(_REENTRANT) || _POSIX_C_SOURCE - 0 >= 199506L
extern int *___errno();
#define errno (*(___errno()))
#else
extern int errno;
/* ANSI C++ requires that errno be a macro */
#if __cplusplus >= 199711L
#define errno errno
#endif
#endif /* defined(_REENTRANT) */