]> pd.if.org Git - pdclib.old/blob - man3/errno.3
Add _cbprintf/_vcbprintf (callback based printf formatters)
[pdclib.old] / man3 / errno.3
1 .\" This file is part of the Public Domain C Library (PDCLib).\r
2 .\" Permission is granted to use, modify, and / or redistribute at will.\r
3 .\"\r
4 .Dd\r
5 .Dt ERRNO 3\r
6 .Os\r
7 .\"\r
8 .Sh NAME\r
9 .Nm errno\r
10 .Nd library error result\r
11 .\"\r
12 .Sh SYNOPSIS\r
13 .In errno.h\r
14 .Pp\r
15 .Sy #define errno <object of thread local storage duration>\r
16 .\"\r
17 .Sh DESCRIPTION\r
18 The header\r
19 .In errno.h\r
20 defines the name\r
21 .Va errno\r
22 to refer to an object of thread local storage duration. It is undefined whether\r
23 or not \r
24 .Va errno\r
25 refers to a preprocessor symbol or not.\r
26 .\"\r
27 .Pp\r
28 At program startup, the runtime shall initialize\r
29 .Va errno\r
30 to contain the value zero (the initial value in other threads is undefined). It \r
31 is guaranteed that no function provided by the C standard library shall set the \r
32 value of \r
33 .Va errno\r
34 to zero; therefore, for functions which do not have a unique return value for\r
35 indicating error, it is possible to determine whether an error occured by \r
36 setting\r
37 .Va errno\r
38 to zero before the call, then after the call seeing if an error value has been\r
39 stored into \r
40 .Va errno.\r
41 .Pp\r
42 .Bf Sy\r
43 Note that it is valid for any function which is not described as explicitly \r
44 setting \r
45 .Va errno \r
46 to set it to a non-zero value. Checking for a non-zero value is only valid with\r
47 functions which are defined to modify \r
48 .Va errno .\r
49 .Ef\r
50 .\"\r
51 .Pp\r
52 In some historical versions of the POSIX standard, the prescribed method of \r
53 using errno was to define\r
54 .Va extern int errno .\r
55 This is no longer supported by the POSIX or C standards, and will not work on \r
56 the majority of implementations, including this one.\r
57 .\"\r
58 .Sh SEE ALSO\r
59 .Xr errno.h 3\r
60 .Xr abort 3\r
61 .Xr assert 3\r
62 \"\r
63 .Sh STANDARDS\r
64 Conforming to\r
65 .St -isoC-90 ,\r
66 .St -isoC-99 .