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