1explain_statfs(3)          Library Functions Manual          explain_statfs(3)
2
3
4

NAME

6       explain_statfs - explain statfs(2) errors
7

SYNOPSIS

9       #include <libexplain/statfs.h>
10       const char *explain_statfs(const char *pathname, struct statfs *data);
11       const char *explain_errno_statfs(int errnum, const char *pathname,
12       struct statfs *data);
13       void explain_message_statfs(char *message, int message_size, const char
14       *pathname, struct statfs *data);
15       void explain_message_errno_statfs(char *message, int message_size, int
16       errnum, const char *pathname, struct statfs *data);
17

DESCRIPTION

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

SEE ALSO

193       statfs(2)
194               get file system statistics
195
196       explain_statfs_or_die(3)
197               get file system statistics and report errors
198
200       libexplain version 1.4
201       Copyright (C) 2009 Peter Miller
202
203
204
205                                                             explain_statfs(3)
Impressum