- 论坛徽章:
- 0
|
DESCRIPTION
The <errno.h> header file defines the integer variable errno, which is set by system calls and some library functions in
the event of an error to indicate what went wrong. Its value is significant only when the call returned an error (usu鈥[m
ally -1), and a function that does succeed is allowed to change errno.
Sometimes, when -1 is also a valid successful return value one has to zero errno before the call in order to detect pos鈥[m
sible errors.
errno is defined by the ISO C standard to be a modifiable lvalue of type int, and must not be explicitly declared; errno
may be a macro. errno is thread-local; setting it in one thread does not affect its value in any other thread. Valid error numbers are all non-zero; errno is never set to zero by any library function. All the error names specified
by POSIX.1 must have distinct values, with the exception of EAGAIN and EWOULDBLOCK, which may be the same.
Below is a list of the symbolic error names that are defined on Linux. Some of these are marked POSIX.1, indicating that
the name is defined by POSIX.1-2001, or C99, indicating that the name is defined by C99.
errno是线程本地存储的?
另外如果recv系统调用导致errno被设置为EINTER,其它的系统调用如果调用成功了,errno有时会被设置为0,有时还是旧值,怎么回事情啊? |
|