1ERRNO(P) POSIX Programmer's Manual ERRNO(P)
2
3
4
6 errno - error return value
7
9 #include <errno.h>
10
12 The lvalue errno is used by many functions to return error values.
13
14 Many functions provide an error number in errno, which has type int and
15 is defined in <errno.h>. The value of errno shall be defined only after
16 a call to a function for which it is explicitly stated to be set and
17 until it is changed by the next function call or if the application
18 assigns it a value. The value of errno should only be examined when it
19 is indicated to be valid by a function's return value. Applications
20 shall obtain the definition of errno by the inclusion of <errno.h>. No
21 function in this volume of IEEE Std 1003.1-2001 shall set errno to 0.
22
23 It is unspecified whether errno is a macro or an identifier declared
24 with external linkage. If a macro definition is suppressed in order to
25 access an actual object, or a program defines an identifier with the
26 name errno, the behavior is undefined.
27
28 The symbolic values stored in errno are documented in the ERRORS sec‐
29 tions on all relevant pages.
30
32 None.
33
35 None.
36
37 The following sections are informative.
38
40 None.
41
43 Previously both POSIX and X/Open documents were more restrictive than
44 the ISO C standard in that they required errno to be defined as an
45 external variable, whereas the ISO C standard required only that errno
46 be defined as a modifiable lvalue with type int.
47
48 An application that needs to examine the value of errno to determine
49 the error should set it to 0 before a function call, then inspect it
50 before a subsequent function call.
51
53 None.
54
56 None.
57
59 Error Numbers , the Base Definitions volume of IEEE Std 1003.1-2001,
60 <errno.h>
61
63 Portions of this text are reprinted and reproduced in electronic form
64 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
65 -- Portable Operating System Interface (POSIX), The Open Group Base
66 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
67 Electrical and Electronics Engineers, Inc and The Open Group. In the
68 event of any discrepancy between this version and the original IEEE and
69 The Open Group Standard, the original IEEE and The Open Group Standard
70 is the referee document. The original Standard can be obtained online
71 at http://www.opengroup.org/unix/online.html .
72
73
74
75IEEE/The Open Group 2003 ERRNO(P)