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