errno(3) - Linux man page

以下内容摘自, man 3  errno


errno(3) - Linux man page

Name
errno - number of last error 
Synopsis
#include 
Description
The 
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 (usually
-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 possible 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. 

从最后一句可以看到, errno 是多线程安全的。

你可能感兴趣的:(errno(3) - Linux man page)