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