1explain_fpathconf(3) Library Functions Manual explain_fpathconf(3)
2
3
4
6 explain_fpathconf - explain fpathconf(3) errors
7
9 #include <libexplain/fpathconf.h>
10 const char *explain_fpathconf(int fildes, int name);
11 const char *explain_errno_fpathconf(int errnum, int fildes, int name);
12 void explain_message_fpathconf(char *message, int message_size, int
13 fildes, int name);
14 void explain_message_errno_fpathconf(char *message, int message_size,
15 int errnum, int fildes, int name);
16
18 These functions may be used to obtain explanations for errors returned
19 by the fpathconf(3) system call.
20
21 explain_fpathconf
22 const char *explain_fpathconf(int fildes, int name);
23
24 The explain_fpathconf function is used to obtain an explanation of an
25 error returned by the fpathconf(3) system call. The least the message
26 will contain is the value of strerror(errno), but usually it will do
27 much better, and indicate the underlying cause in more detail.
28
29 The errno global variable will be used to obtain the error value to be
30 decoded.
31
32 This function is intended to be used in a fashion similar to the fol‐
33 lowing example:
34 if (fpathconf(fildes, name) < 0)
35 {
36 fprintf(stderr, "%s\n", explain_fpathconf(fildes, name));
37 exit(EXIT_FAILURE);
38 }
39
40 The above code example is available pre‐packaged as the explain_fpath‐
41 conf_or_die(3) function.
42
43 fildes The original fildes, exactly as passed to the fpathconf(3) sys‐
44 tem call.
45
46 name The original name, exactly as passed to the fpathconf(3) system
47 call.
48
49 Returns:
50 The message explaining the error. This message buffer is
51 shared by all libexplain functions which do not supply a buffer
52 in their argument list. This will be overwritten by the next
53 call to any libexplain function which shares this buffer,
54 including other threads.
55
56 Note: This function is not thread safe, because it shares a return buf‐
57 fer across all threads, and many other functions in this library.
58
59 explain_errno_fpathconf
60 const char *explain_errno_fpathconf(int errnum, int fildes, int name);
61
62 The explain_errno_fpathconf function is used to obtain an explanation
63 of an error returned by the fpathconf(3) system call. The least the
64 message will contain is the value of strerror(errnum), but usually it
65 will do much better, and indicate the underlying cause in more detail.
66
67 This function is intended to be used in a fashion similar to the fol‐
68 lowing example:
69 if (fpathconf(fildes, name) < 0)
70 {
71 int err = errno;
72 fprintf(stderr, "%s\n", explain_errno_fpathconf(err, fildes, name));
73 exit(EXIT_FAILURE);
74 }
75
76 The above code example is available pre‐packaged as the explain_fpath‐
77 conf_or_die(3) function.
78
79 errnum The error value to be decoded, usually obtained from the errno
80 global variable just before this function is called. This is
81 necessary if you need to call any code between the system call
82 to be explained and this function, because many libc functions
83 will alter the value of errno.
84
85 fildes The original fildes, exactly as passed to the fpathconf(3) sys‐
86 tem call.
87
88 name The original name, exactly as passed to the fpathconf(3) system
89 call.
90
91 Returns:
92 The message explaining the error. This message buffer is
93 shared by all libexplain functions which do not supply a buffer
94 in their argument list. This will be overwritten by the next
95 call to any libexplain function which shares this buffer,
96 including other threads.
97
98 Note: This function is not thread safe, because it shares a return buf‐
99 fer across all threads, and many other functions in this library.
100
101 explain_message_fpathconf
102 void explain_message_fpathconf(char *message, int message_size, int
103 fildes, int name);
104
105 The explain_message_fpathconf function may be used to obtain an expla‐
106 nation of an error returned by the fpathconf(3) system call. The least
107 the message will contain is the value of strerror(errno), but usually
108 it will do much better, and indicate the underlying cause in more
109 detail.
110
111 The errno global variable will be used to obtain the error value to be
112 decoded.
113
114 This function is intended to be used in a fashion similar to the fol‐
115 lowing example:
116 if (fpathconf(fildes, name) < 0)
117 {
118 char message[3000];
119 explain_message_fpathconf(message, sizeof(message), fildes, name);
120 fprintf(stderr, "%s\n", message);
121 exit(EXIT_FAILURE);
122 }
123
124 The above code example is available pre‐packaged as the explain_fpath‐
125 conf_or_die(3) function.
126
127 message The location in which to store the returned message. If a
128 suitable message return buffer is supplied, this function is
129 thread safe.
130
131 message_size
132 The size in bytes of the location in which to store the
133 returned message.
134
135 fildes The original fildes, exactly as passed to the fpathconf(3) sys‐
136 tem call.
137
138 name The original name, exactly as passed to the fpathconf(3) system
139 call.
140
141 explain_message_errno_fpathconf
142 void explain_message_errno_fpathconf(char *message, int message_size,
143 int errnum, int fildes, int name);
144
145 The explain_message_errno_fpathconf function may be used to obtain an
146 explanation of an error returned by the fpathconf(3) system call. The
147 least the message will contain is the value of strerror(errnum), but
148 usually it will do much better, and indicate the underlying cause in
149 more detail.
150
151 This function is intended to be used in a fashion similar to the fol‐
152 lowing example:
153 if (fpathconf(fildes, name) < 0)
154 {
155 int err = errno;
156 char message[3000];
157 explain_message_errno_fpathconf(message, sizeof(message),
158 err, fildes, name);
159 fprintf(stderr, "%s\n", message);
160 exit(EXIT_FAILURE);
161 }
162
163 The above code example is available pre‐packaged as the explain_fpath‐
164 conf_or_die(3) function.
165
166 message The location in which to store the returned message. If a
167 suitable message return buffer is supplied, this function is
168 thread safe.
169
170 message_size
171 The size in bytes of the location in which to store the
172 returned message.
173
174 errnum The error value to be decoded, usually obtained from the errno
175 global variable just before this function is called. This is
176 necessary if you need to call any code between the system call
177 to be explained and this function, because many libc functions
178 will alter the value of errno.
179
180 fildes The original fildes, exactly as passed to the fpathconf(3) sys‐
181 tem call.
182
183 name The original name, exactly as passed to the fpathconf(3) system
184 call.
185
187 fpathconf(3)
188 get configuration values for files
189
190 explain_fpathconf_or_die(3)
191 get configuration values for files and report errors
192
194 libexplain version 1.4
195 Copyright (C) 2008 Peter Miller
196
197
198
199 explain_fpathconf(3)