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