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