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