Deleted Added
full compact
bsm_errno.c (186650) bsm_errno.c (187214)
1/*-
2 * Copyright (c) 2008 Apple Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#12
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Apple Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#12
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/security/audit/audit_bsm_errno.c 186650 2008-12-31 13:56:31Z rwatson $");
33__FBSDID("$FreeBSD: head/sys/security/audit/audit_bsm_errno.c 187214 2009-01-14 10:44:16Z rwatson $");
34
35#include <sys/param.h>
36
37#include <security/audit/audit.h>
38
39#include <bsm/audit_errno.h>
40#include <bsm/audit_record.h>
41
42#include <sys/errno.h>
43
44/*
45 * Different operating systems use different numeric constants for different
46 * error numbers, and sometimes error numbers don't exist in more than one
47 * operating system. These routines convert between BSM and local error
48 * number spaces, subject to the above realities. BSM error numbers are
49 * stored in a single 8-bit character, so don't have a byte order.
34
35#include <sys/param.h>
36
37#include <security/audit/audit.h>
38
39#include <bsm/audit_errno.h>
40#include <bsm/audit_record.h>
41
42#include <sys/errno.h>
43
44/*
45 * Different operating systems use different numeric constants for different
46 * error numbers, and sometimes error numbers don't exist in more than one
47 * operating system. These routines convert between BSM and local error
48 * number spaces, subject to the above realities. BSM error numbers are
49 * stored in a single 8-bit character, so don't have a byte order.
50 *
51 * Don't include string definitions when this code is compiled into a kernel.
50 */
52 */
51
52struct bsm_errors {
53 int be_bsm_error;
54 int be_os_error;
53struct bsm_errno {
54 int be_bsm_errno;
55 int be_local_errno;
56#if !defined(KERNEL) && !defined(_KERNEL)
55 const char *be_strerror;
57 const char *be_strerror;
58#endif
56};
57
58#define ERRNO_NO_LOCAL_MAPPING -600
59
59};
60
61#define ERRNO_NO_LOCAL_MAPPING -600
62
63#if !defined(KERNEL) && !defined(_KERNEL)
64#define ES(x) x
65#else
66#define ES(x)
67#endif
68
60/*
61 * Mapping table -- please maintain in numeric sorted order with respect to
62 * the BSM constant. Today we do a linear lookup, but could switch to a
63 * binary search if it makes sense. We only ifdef errors that aren't
64 * generally available, but it does make the table a lot more ugly.
65 *
66 * XXXRW: It would be nice to have a similar ordered table mapping to BSM
67 * constant from local constant, but the order of local constants varies by
68 * OS. Really we need to build that table at compile-time but don't do that
69 * yet.
70 *
71 * XXXRW: We currently embed English-language error strings here, but should
72 * support catalogues; these are only used if the OS doesn't have an error
73 * string using strerror(3).
74 */
69/*
70 * Mapping table -- please maintain in numeric sorted order with respect to
71 * the BSM constant. Today we do a linear lookup, but could switch to a
72 * binary search if it makes sense. We only ifdef errors that aren't
73 * generally available, but it does make the table a lot more ugly.
74 *
75 * XXXRW: It would be nice to have a similar ordered table mapping to BSM
76 * constant from local constant, but the order of local constants varies by
77 * OS. Really we need to build that table at compile-time but don't do that
78 * yet.
79 *
80 * XXXRW: We currently embed English-language error strings here, but should
81 * support catalogues; these are only used if the OS doesn't have an error
82 * string using strerror(3).
83 */
75static const struct bsm_errors bsm_errors[] = {
76 { BSM_ESUCCESS, 0, "Success" },
77 { BSM_EPERM, EPERM, "Operation not permitted" },
78 { BSM_ENOENT, ENOENT, "No such file or directory" },
79 { BSM_ESRCH, ESRCH, "No such process" },
80 { BSM_EINTR, EINTR, "Interrupted system call" },
81 { BSM_EIO, EIO, "Input/output error" },
82 { BSM_ENXIO, ENXIO, "Device not configured" },
83 { BSM_E2BIG, E2BIG, "Argument list too long" },
84 { BSM_ENOEXEC, ENOEXEC, "Exec format error" },
85 { BSM_EBADF, EBADF, "BAd file descriptor" },
86 { BSM_ECHILD, ECHILD, "No child processes" },
87 { BSM_EAGAIN, EAGAIN, "Resource temporarily unavailable" },
88 { BSM_ENOMEM, ENOMEM, "Cannot allocate memory" },
89 { BSM_EACCES, EACCES, "Permission denied" },
90 { BSM_EFAULT, EFAULT, "Bad address" },
91 { BSM_ENOTBLK, ENOTBLK, "Block device required" },
92 { BSM_EBUSY, EBUSY, "Device busy" },
93 { BSM_EEXIST, EEXIST, "File exists" },
94 { BSM_EXDEV, EXDEV, "Cross-device link" },
95 { BSM_ENODEV, ENODEV, "Operation not supported by device" },
96 { BSM_ENOTDIR, ENOTDIR, "Not a directory" },
97 { BSM_EISDIR, EISDIR, "Is a directory" },
98 { BSM_EINVAL, EINVAL, "Invalid argument" },
99 { BSM_ENFILE, ENFILE, "Too many open files in system" },
100 { BSM_EMFILE, EMFILE, "Too many open files" },
101 { BSM_ENOTTY, ENOTTY, "Inappropriate ioctl for device" },
102 { BSM_ETXTBSY, ETXTBSY, "Text file busy" },
103 { BSM_EFBIG, EFBIG, "File too large" },
104 { BSM_ENOSPC, ENOSPC, "No space left on device" },
105 { BSM_ESPIPE, ESPIPE, "Illegal seek" },
106 { BSM_EROFS, EROFS, "Read-only file system" },
107 { BSM_EMLINK, EMLINK, "Too many links" },
108 { BSM_EPIPE, EPIPE, "Broken pipe" },
109 { BSM_EDOM, EDOM, "Numerical argument out of domain" },
110 { BSM_ERANGE, ERANGE, "Result too large" },
111 { BSM_ENOMSG, ENOMSG, "No message of desired type" },
112 { BSM_EIDRM, EIDRM, "Identifier removed" },
113 { BSM_ECHRNG,
84static const struct bsm_errno bsm_errnos[] = {
85 { BSM_ERRNO_ESUCCESS, 0, ES("Success") },
86 { BSM_ERRNO_EPERM, EPERM, ES("Operation not permitted") },
87 { BSM_ERRNO_ENOENT, ENOENT, ES("No such file or directory") },
88 { BSM_ERRNO_ESRCH, ESRCH, ES("No such process") },
89 { BSM_ERRNO_EINTR, EINTR, ES("Interrupted system call") },
90 { BSM_ERRNO_EIO, EIO, ES("Input/output error") },
91 { BSM_ERRNO_ENXIO, ENXIO, ES("Device not configured") },
92 { BSM_ERRNO_E2BIG, E2BIG, ES("Argument list too long") },
93 { BSM_ERRNO_ENOEXEC, ENOEXEC, ES("Exec format error") },
94 { BSM_ERRNO_EBADF, EBADF, ES("Bad file descriptor") },
95 { BSM_ERRNO_ECHILD, ECHILD, ES("No child processes") },
96 { BSM_ERRNO_EAGAIN, EAGAIN, ES("Resource temporarily unavailable") },
97 { BSM_ERRNO_ENOMEM, ENOMEM, ES("Cannot allocate memory") },
98 { BSM_ERRNO_EACCES, EACCES, ES("Permission denied") },
99 { BSM_ERRNO_EFAULT, EFAULT, ES("Bad address") },
100 { BSM_ERRNO_ENOTBLK, ENOTBLK, ES("Block device required") },
101 { BSM_ERRNO_EBUSY, EBUSY, ES("Device busy") },
102 { BSM_ERRNO_EEXIST, EEXIST, ES("File exists") },
103 { BSM_ERRNO_EXDEV, EXDEV, ES("Cross-device link") },
104 { BSM_ERRNO_ENODEV, ENODEV, ES("Operation not supported by device") },
105 { BSM_ERRNO_ENOTDIR, ENOTDIR, ES("Not a directory") },
106 { BSM_ERRNO_EISDIR, EISDIR, ES("Is a directory") },
107 { BSM_ERRNO_EINVAL, EINVAL, ES("Invalid argument") },
108 { BSM_ERRNO_ENFILE, ENFILE, ES("Too many open files in system") },
109 { BSM_ERRNO_EMFILE, EMFILE, ES("Too many open files") },
110 { BSM_ERRNO_ENOTTY, ENOTTY, ES("Inappropriate ioctl for device") },
111 { BSM_ERRNO_ETXTBSY, ETXTBSY, ES("Text file busy") },
112 { BSM_ERRNO_EFBIG, EFBIG, ES("File too large") },
113 { BSM_ERRNO_ENOSPC, ENOSPC, ES("No space left on device") },
114 { BSM_ERRNO_ESPIPE, ESPIPE, ES("Illegal seek") },
115 { BSM_ERRNO_EROFS, EROFS, ES("Read-only file system") },
116 { BSM_ERRNO_EMLINK, EMLINK, ES("Too many links") },
117 { BSM_ERRNO_EPIPE, EPIPE, ES("Broken pipe") },
118 { BSM_ERRNO_EDOM, EDOM, ES("Numerical argument out of domain") },
119 { BSM_ERRNO_ERANGE, ERANGE, ES("Result too large") },
120 { BSM_ERRNO_ENOMSG, ENOMSG, ES("No message of desired type") },
121 { BSM_ERRNO_EIDRM, EIDRM, ES("Identifier removed") },
122 { BSM_ERRNO_ECHRNG,
114#ifdef ECHRNG
115 ECHRNG,
116#else
117 ERRNO_NO_LOCAL_MAPPING,
118#endif
123#ifdef ECHRNG
124 ECHRNG,
125#else
126 ERRNO_NO_LOCAL_MAPPING,
127#endif
119 "Channel number out of range" },
120 { BSM_EL2NSYNC,
128 ES("Channel number out of range") },
129 { BSM_ERRNO_EL2NSYNC,
121#ifdef EL2NSYNC
122 EL2NSYNC,
123#else
124 ERRNO_NO_LOCAL_MAPPING,
125#endif
130#ifdef EL2NSYNC
131 EL2NSYNC,
132#else
133 ERRNO_NO_LOCAL_MAPPING,
134#endif
126 "Level 2 not synchronized" },
127 { BSM_EL3HLT,
135 ES("Level 2 not synchronized") },
136 { BSM_ERRNO_EL3HLT,
128#ifdef EL3HLT
129 EL3HLT,
130#else
131 ERRNO_NO_LOCAL_MAPPING,
132#endif
137#ifdef EL3HLT
138 EL3HLT,
139#else
140 ERRNO_NO_LOCAL_MAPPING,
141#endif
133 "Level 3 halted" },
134 { BSM_EL3RST,
142 ES("Level 3 halted") },
143 { BSM_ERRNO_EL3RST,
135#ifdef EL3RST
136 EL3RST,
137#else
138 ERRNO_NO_LOCAL_MAPPING,
139#endif
144#ifdef EL3RST
145 EL3RST,
146#else
147 ERRNO_NO_LOCAL_MAPPING,
148#endif
140 "Level 3 reset" },
141 { BSM_ELNRNG,
149 ES("Level 3 reset") },
150 { BSM_ERRNO_ELNRNG,
142#ifdef ELNRNG
143 ELNRNG,
144#else
145 ERRNO_NO_LOCAL_MAPPING,
146#endif
151#ifdef ELNRNG
152 ELNRNG,
153#else
154 ERRNO_NO_LOCAL_MAPPING,
155#endif
147 "Link number out of range" },
148 { BSM_EUNATCH,
156 ES("Link number out of range") },
157 { BSM_ERRNO_EUNATCH,
149#ifdef EUNATCH
150 EUNATCH,
151#else
152 ERRNO_NO_LOCAL_MAPPING,
153#endif
158#ifdef EUNATCH
159 EUNATCH,
160#else
161 ERRNO_NO_LOCAL_MAPPING,
162#endif
154 "Protocol driver not attached" },
155 { BSM_ENOCSI,
163 ES("Protocol driver not attached") },
164 { BSM_ERRNO_ENOCSI,
156#ifdef ENOCSI
157 ENOCSI,
158#else
159 ERRNO_NO_LOCAL_MAPPING,
160#endif
165#ifdef ENOCSI
166 ENOCSI,
167#else
168 ERRNO_NO_LOCAL_MAPPING,
169#endif
161 "No CSI structure available" },
162 { BSM_EL2HLT,
170 ES("No CSI structure available") },
171 { BSM_ERRNO_EL2HLT,
163#ifdef EL2HLT
164 EL2HLT,
165#else
166 ERRNO_NO_LOCAL_MAPPING,
167#endif
172#ifdef EL2HLT
173 EL2HLT,
174#else
175 ERRNO_NO_LOCAL_MAPPING,
176#endif
168 "Level 2 halted" },
169 { BSM_EDEADLK, EDEADLK, "Resource deadlock avoided" },
170 { BSM_ENOLCK, ENOLCK, "No locks available" },
171 { BSM_ECANCELED, ECANCELED, "Operation canceled" },
172 { BSM_ENOTSUP, ENOTSUP, "Operation not supported" },
173 { BSM_EDQUOT, EDQUOT, "Disc quota exceeded" },
174 { BSM_EBADE,
177 ES("Level 2 halted") },
178 { BSM_ERRNO_EDEADLK, EDEADLK, ES("Resource deadlock avoided") },
179 { BSM_ERRNO_ENOLCK, ENOLCK, ES("No locks available") },
180 { BSM_ERRNO_ECANCELED, ECANCELED, ES("Operation canceled") },
181 { BSM_ERRNO_ENOTSUP, ENOTSUP, ES("Operation not supported") },
182 { BSM_ERRNO_EDQUOT, EDQUOT, ES("Disc quota exceeded") },
183 { BSM_ERRNO_EBADE,
175#ifdef EBADE
176 EBADE,
177#else
178 ERRNO_NO_LOCAL_MAPPING,
179#endif
184#ifdef EBADE
185 EBADE,
186#else
187 ERRNO_NO_LOCAL_MAPPING,
188#endif
180 "Invalid exchange" },
181 { BSM_EBADR,
189 ES("Invalid exchange") },
190 { BSM_ERRNO_EBADR,
182#ifdef EBADR
183 EBADR,
184#else
185 ERRNO_NO_LOCAL_MAPPING,
186#endif
191#ifdef EBADR
192 EBADR,
193#else
194 ERRNO_NO_LOCAL_MAPPING,
195#endif
187 "Invalid request descriptor" },
188 { BSM_EXFULL,
196 ES("Invalid request descriptor") },
197 { BSM_ERRNO_EXFULL,
189#ifdef EXFULL
190 EXFULL,
191#else
192 ERRNO_NO_LOCAL_MAPPING,
193#endif
198#ifdef EXFULL
199 EXFULL,
200#else
201 ERRNO_NO_LOCAL_MAPPING,
202#endif
194 "Exchange full" },
195 { BSM_ENOANO,
203 ES("Exchange full") },
204 { BSM_ERRNO_ENOANO,
196#ifdef ENOANO
197 ENOANO,
198#else
199 ERRNO_NO_LOCAL_MAPPING,
200#endif
205#ifdef ENOANO
206 ENOANO,
207#else
208 ERRNO_NO_LOCAL_MAPPING,
209#endif
201 "No anode" },
202 { BSM_EBADRQC,
210 ES("No anode") },
211 { BSM_ERRNO_EBADRQC,
203#ifdef EBADRQC
204 EBADRQC,
205#else
206 ERRNO_NO_LOCAL_MAPPING,
207#endif
212#ifdef EBADRQC
213 EBADRQC,
214#else
215 ERRNO_NO_LOCAL_MAPPING,
216#endif
208 "Invalid request descriptor" },
209 { BSM_EBADSLT,
217 ES("Invalid request descriptor") },
218 { BSM_ERRNO_EBADSLT,
210#ifdef EBADSLT
211 EBADSLT,
212#else
213 ERRNO_NO_LOCAL_MAPPING,
214#endif
219#ifdef EBADSLT
220 EBADSLT,
221#else
222 ERRNO_NO_LOCAL_MAPPING,
223#endif
215 "Invalid slot" },
216 { BSM_EDEADLOCK,
224 ES("Invalid slot") },
225 { BSM_ERRNO_EDEADLOCK,
217#ifdef EDEADLOCK
218 EDEADLOCK,
219#else
220 ERRNO_NO_LOCAL_MAPPING,
221#endif
226#ifdef EDEADLOCK
227 EDEADLOCK,
228#else
229 ERRNO_NO_LOCAL_MAPPING,
230#endif
222 "Resource deadlock avoided" },
223 { BSM_EBFONT,
231 ES("Resource deadlock avoided") },
232 { BSM_ERRNO_EBFONT,
224#ifdef EBFONT
225 EBFONT,
226#else
227 ERRNO_NO_LOCAL_MAPPING,
228#endif
233#ifdef EBFONT
234 EBFONT,
235#else
236 ERRNO_NO_LOCAL_MAPPING,
237#endif
229 "Bad font file format" },
230 { BSM_EOWNERDEAD,
238 ES("Bad font file format") },
239 { BSM_ERRNO_EOWNERDEAD,
231#ifdef EOWNERDEAD
232 EOWNERDEAD,
233#else
234 ERRNO_NO_LOCAL_MAPPING,
235#endif
240#ifdef EOWNERDEAD
241 EOWNERDEAD,
242#else
243 ERRNO_NO_LOCAL_MAPPING,
244#endif
236 "Process died with the lock" },
237 { BSM_ENOTRECOVERABLE,
245 ES("Process died with the lock") },
246 { BSM_ERRNO_ENOTRECOVERABLE,
238#ifdef ENOTRECOVERABLE
239 ENOTRECOVERABLE,
240#else
241 ERRNO_NO_LOCAL_MAPPING,
242#endif
247#ifdef ENOTRECOVERABLE
248 ENOTRECOVERABLE,
249#else
250 ERRNO_NO_LOCAL_MAPPING,
251#endif
243 "Lock is not recoverable" },
244 { BSM_ENOSTR,
252 ES("Lock is not recoverable") },
253 { BSM_ERRNO_ENOSTR,
245#ifdef ENOSTR
246 ENOSTR,
247#else
248 ERRNO_NO_LOCAL_MAPPING,
249#endif
254#ifdef ENOSTR
255 ENOSTR,
256#else
257 ERRNO_NO_LOCAL_MAPPING,
258#endif
250 "Device not a stream" },
251 { BSM_ENONET,
259 ES("Device not a stream") },
260 { BSM_ERRNO_ENONET,
252#ifdef ENONET
253 ENONET,
254#else
255 ERRNO_NO_LOCAL_MAPPING,
256#endif
261#ifdef ENONET
262 ENONET,
263#else
264 ERRNO_NO_LOCAL_MAPPING,
265#endif
257 "Machine is not on the network" },
258 { BSM_ENOPKG,
266 ES("Machine is not on the network") },
267 { BSM_ERRNO_ENOPKG,
259#ifdef ENOPKG
260 ENOPKG,
261#else
262 ERRNO_NO_LOCAL_MAPPING,
263#endif
268#ifdef ENOPKG
269 ENOPKG,
270#else
271 ERRNO_NO_LOCAL_MAPPING,
272#endif
264 "Package not installed" },
265 { BSM_EREMOTE, EREMOTE, "Too many levels of remote in path" },
266 { BSM_ENOLINK,
273 ES("Package not installed") },
274 { BSM_ERRNO_EREMOTE, EREMOTE,
275 ES("Too many levels of remote in path") },
276 { BSM_ERRNO_ENOLINK,
267#ifdef ENOLINK
268 ENOLINK,
269#else
270 ERRNO_NO_LOCAL_MAPPING,
271#endif
277#ifdef ENOLINK
278 ENOLINK,
279#else
280 ERRNO_NO_LOCAL_MAPPING,
281#endif
272 "Link has been severed" },
273 { BSM_EADV,
282 ES("Link has been severed") },
283 { BSM_ERRNO_EADV,
274#ifdef EADV
275 EADV,
276#else
277 ERRNO_NO_LOCAL_MAPPING,
278#endif
284#ifdef EADV
285 EADV,
286#else
287 ERRNO_NO_LOCAL_MAPPING,
288#endif
279 "Advertise error" },
280 { BSM_ESRMNT,
289 ES("Advertise error") },
290 { BSM_ERRNO_ESRMNT,
281#ifdef ESRMNT
282 ESRMNT,
283#else
284 ERRNO_NO_LOCAL_MAPPING,
285#endif
291#ifdef ESRMNT
292 ESRMNT,
293#else
294 ERRNO_NO_LOCAL_MAPPING,
295#endif
286 "srmount error" },
287 { BSM_ECOMM,
296 ES("srmount error") },
297 { BSM_ERRNO_ECOMM,
288#ifdef ECOMM
289 ECOMM,
290#else
291 ERRNO_NO_LOCAL_MAPPING,
292#endif
298#ifdef ECOMM
299 ECOMM,
300#else
301 ERRNO_NO_LOCAL_MAPPING,
302#endif
293 "Communication error on send" },
294 { BSM_EPROTO,
303 ES("Communication error on send") },
304 { BSM_ERRNO_EPROTO,
295#ifdef EPROTO
296 EPROTO,
297#else
298 ERRNO_NO_LOCAL_MAPPING,
299#endif
305#ifdef EPROTO
306 EPROTO,
307#else
308 ERRNO_NO_LOCAL_MAPPING,
309#endif
300 "Protocol error" },
301 { BSM_ELOCKUNMAPPED,
310 ES("Protocol error") },
311 { BSM_ERRNO_ELOCKUNMAPPED,
302#ifdef ELOCKUNMAPPED
303 ELOCKUNMAPPED,
304#else
305 ERRNO_NO_LOCAL_MAPPING,
306#endif
312#ifdef ELOCKUNMAPPED
313 ELOCKUNMAPPED,
314#else
315 ERRNO_NO_LOCAL_MAPPING,
316#endif
307 "Locked lock was unmapped" },
308 { BSM_ENOTACTIVE,
317 ES("Locked lock was unmapped") },
318 { BSM_ERRNO_ENOTACTIVE,
309#ifdef ENOTACTIVE
310 ENOTACTIVE,
311#else
312 ERRNO_NO_LOCAL_MAPPING,
313#endif
319#ifdef ENOTACTIVE
320 ENOTACTIVE,
321#else
322 ERRNO_NO_LOCAL_MAPPING,
323#endif
314 "Facility is not active" },
315 { BSM_EMULTIHOP,
324 ES("Facility is not active") },
325 { BSM_ERRNO_EMULTIHOP,
316#ifdef EMULTIHOP
317 EMULTIHOP,
318#else
319 ERRNO_NO_LOCAL_MAPPING,
320#endif
326#ifdef EMULTIHOP
327 EMULTIHOP,
328#else
329 ERRNO_NO_LOCAL_MAPPING,
330#endif
321 "Multihop attempted" },
322 { BSM_EBADMSG,
331 ES("Multihop attempted") },
332 { BSM_ERRNO_EBADMSG,
323#ifdef EBADMSG
324 EBADMSG,
325#else
326 ERRNO_NO_LOCAL_MAPPING,
327#endif
333#ifdef EBADMSG
334 EBADMSG,
335#else
336 ERRNO_NO_LOCAL_MAPPING,
337#endif
328 "Bad message" },
329 { BSM_ENAMETOOLONG, ENAMETOOLONG, "File name too long" },
330 { BSM_EOVERFLOW, EOVERFLOW, "Value too large to be stored in data type" },
331 { BSM_ENOTUNIQ,
338 ES("Bad message") },
339 { BSM_ERRNO_ENAMETOOLONG, ENAMETOOLONG, ES("File name too long") },
340 { BSM_ERRNO_EOVERFLOW, EOVERFLOW,
341 ES("Value too large to be stored in data type") },
342 { BSM_ERRNO_ENOTUNIQ,
332#ifdef ENOTUNIQ
333 ENOTUNIQ,
334#else
335 ERRNO_NO_LOCAL_MAPPING,
336#endif
343#ifdef ENOTUNIQ
344 ENOTUNIQ,
345#else
346 ERRNO_NO_LOCAL_MAPPING,
347#endif
337 "Given log name not unique" },
338 { BSM_EBADFD,
348 ES("Given log name not unique") },
349 { BSM_ERRNO_EBADFD,
339#ifdef EBADFD
340 EBADFD,
341#else
342 ERRNO_NO_LOCAL_MAPPING,
343#endif
350#ifdef EBADFD
351 EBADFD,
352#else
353 ERRNO_NO_LOCAL_MAPPING,
354#endif
344 "Given f.d. invalid for this operation" },
345 { BSM_EREMCHG,
355 ES("Given f.d. invalid for this operation") },
356 { BSM_ERRNO_EREMCHG,
346#ifdef EREMCHG
347 EREMCHG,
348#else
349 ERRNO_NO_LOCAL_MAPPING,
350#endif
357#ifdef EREMCHG
358 EREMCHG,
359#else
360 ERRNO_NO_LOCAL_MAPPING,
361#endif
351 "Remote address changed" },
352 { BSM_ELIBACC,
362 ES("Remote address changed") },
363 { BSM_ERRNO_ELIBACC,
353#ifdef ELIBACC
354 ELIBACC,
355#else
356 ERRNO_NO_LOCAL_MAPPING,
357#endif
364#ifdef ELIBACC
365 ELIBACC,
366#else
367 ERRNO_NO_LOCAL_MAPPING,
368#endif
358 "Can't access a needed shared lib" },
359 { BSM_ELIBBAD,
369 ES("Can't access a needed shared lib") },
370 { BSM_ERRNO_ELIBBAD,
360#ifdef ELIBBAD
361 ELIBBAD,
362#else
363 ERRNO_NO_LOCAL_MAPPING,
364#endif
371#ifdef ELIBBAD
372 ELIBBAD,
373#else
374 ERRNO_NO_LOCAL_MAPPING,
375#endif
365 "Accessing a corrupted shared lib" },
366 { BSM_ELIBSCN,
376 ES("Accessing a corrupted shared lib") },
377 { BSM_ERRNO_ELIBSCN,
367#ifdef ELIBSCN
368 ELIBSCN,
369#else
370 ERRNO_NO_LOCAL_MAPPING,
371#endif
378#ifdef ELIBSCN
379 ELIBSCN,
380#else
381 ERRNO_NO_LOCAL_MAPPING,
382#endif
372 ".lib section in a.out corrupted" },
373 { BSM_ELIBMAX,
383 ES(".lib section in a.out corrupted") },
384 { BSM_ERRNO_ELIBMAX,
374#ifdef ELIBMAX
375 ELIBMAX,
376#else
377 ERRNO_NO_LOCAL_MAPPING,
378#endif
385#ifdef ELIBMAX
386 ELIBMAX,
387#else
388 ERRNO_NO_LOCAL_MAPPING,
389#endif
379 "Attempting to link in too many libs" },
380 { BSM_ELIBEXEC,
390 ES("Attempting to link in too many libs") },
391 { BSM_ERRNO_ELIBEXEC,
381#ifdef ELIBEXEC
382 ELIBEXEC,
383#else
384 ERRNO_NO_LOCAL_MAPPING,
385#endif
392#ifdef ELIBEXEC
393 ELIBEXEC,
394#else
395 ERRNO_NO_LOCAL_MAPPING,
396#endif
386 "Attempting to exec a shared library" },
387 { BSM_EILSEQ, EILSEQ, "Illegal byte sequence" },
388 { BSM_ENOSYS, ENOSYS, "Function not implemented" },
389 { BSM_ELOOP, ELOOP, "Too many levels of symbolic links" },
390 { BSM_ERESTART,
397 ES("Attempting to exec a shared library") },
398 { BSM_ERRNO_EILSEQ, EILSEQ, ES("Illegal byte sequence") },
399 { BSM_ERRNO_ENOSYS, ENOSYS, ES("Function not implemented") },
400 { BSM_ERRNO_ELOOP, ELOOP, ES("Too many levels of symbolic links") },
401 { BSM_ERRNO_ERESTART,
391#ifdef ERESTART
392 ERESTART,
393#else
394 ERRNO_NO_LOCAL_MAPPING,
395#endif
402#ifdef ERESTART
403 ERESTART,
404#else
405 ERRNO_NO_LOCAL_MAPPING,
406#endif
396 "Restart syscall" },
397 { BSM_ESTRPIPE,
407 ES("Restart syscall") },
408 { BSM_ERRNO_ESTRPIPE,
398#ifdef ESTRPIPE
399 ESTRPIPE,
400#else
401 ERRNO_NO_LOCAL_MAPPING,
402#endif
409#ifdef ESTRPIPE
410 ESTRPIPE,
411#else
412 ERRNO_NO_LOCAL_MAPPING,
413#endif
403 "If pipe/FIFO, don't sleep in stream head" },
404 { BSM_ENOTEMPTY, ENOTEMPTY, "Directory not empty" },
405 { BSM_EUSERS, EUSERS, "Too many users" },
406 { BSM_ENOTSOCK, ENOTSOCK, "Socket operation on non-socket" },
407 { BSM_EDESTADDRREQ, EDESTADDRREQ, "Destination address required" },
408 { BSM_EMSGSIZE, EMSGSIZE, "Message too long" },
409 { BSM_EPROTOTYPE, EPROTOTYPE, "Protocol wrong type for socket" },
410 { BSM_ENOPROTOOPT, ENOPROTOOPT, "Protocol not available" },
411 { BSM_EPROTONOSUPPORT, EPROTONOSUPPORT, "Protocol not supported" },
412 { BSM_ESOCKTNOSUPPORT, ESOCKTNOSUPPORT, "Socket type not supported" },
413 { BSM_EOPNOTSUPP, EOPNOTSUPP, "Operation not supported" },
414 { BSM_EPFNOSUPPORT, EPFNOSUPPORT, "Protocol family not supported" },
415 { BSM_EAFNOSUPPORT, EAFNOSUPPORT, "Address family not supported by protocol family" },
416 { BSM_EADDRINUSE, EADDRINUSE, "Address already in use" },
417 { BSM_EADDRNOTAVAIL, EADDRNOTAVAIL, "Can't assign requested address" },
418 { BSM_ENETDOWN, ENETDOWN, "Network is down" },
419 { BSM_ENETRESET, ENETRESET, "Network dropped connection on reset" },
420 { BSM_ECONNABORTED, ECONNABORTED, "Software caused connection abort" },
421 { BSM_ECONNRESET, ECONNRESET, "Connection reset by peer" },
422 { BSM_ENOBUFS, ENOBUFS, "No buffer space available" },
423 { BSM_EISCONN, EISCONN, "Socket is already connected" },
424 { BSM_ENOTCONN, ENOTCONN, "Socket is not connected" },
425 { BSM_ESHUTDOWN, ESHUTDOWN, "Can't send after socket shutdown" },
426 { BSM_ETOOMANYREFS, ETOOMANYREFS, "Too many references: can't splice" },
427 { BSM_ETIMEDOUT, ETIMEDOUT, "Operation timed out" },
428 { BSM_ECONNREFUSED, ECONNREFUSED, "Connection refused" },
429 { BSM_EHOSTDOWN, EHOSTDOWN, "Host is down" },
430 { BSM_EHOSTUNREACH, EHOSTUNREACH, "No route to host" },
431 { BSM_EALREADY, EALREADY, "Operation already in progress" },
432 { BSM_EINPROGRESS, EINPROGRESS, "Operation now in progress" },
433 { BSM_ESTALE, ESTALE, "Stale NFS file handle" },
434 { BSM_EPWROFF,
414 ES("If pipe/FIFO, don't sleep in stream head") },
415 { BSM_ERRNO_ENOTEMPTY, ENOTEMPTY, ES("Directory not empty") },
416 { BSM_ERRNO_EUSERS, EUSERS, ES("Too many users") },
417 { BSM_ERRNO_ENOTSOCK, ENOTSOCK,
418 ES("Socket operation on non-socket") },
419 { BSM_ERRNO_EDESTADDRREQ, EDESTADDRREQ,
420 ES("Destination address required") },
421 { BSM_ERRNO_EMSGSIZE, EMSGSIZE, ES("Message too long") },
422 { BSM_ERRNO_EPROTOTYPE, EPROTOTYPE,
423 ES("Protocol wrong type for socket") },
424 { BSM_ERRNO_ENOPROTOOPT, ENOPROTOOPT, ES("Protocol not available") },
425 { BSM_ERRNO_EPROTONOSUPPORT, EPROTONOSUPPORT,
426 ES("Protocol not supported") },
427 { BSM_ERRNO_ESOCKTNOSUPPORT, ESOCKTNOSUPPORT,
428 ES("Socket type not supported") },
429 { BSM_ERRNO_EOPNOTSUPP, EOPNOTSUPP, ES("Operation not supported") },
430 { BSM_ERRNO_EPFNOSUPPORT, EPFNOSUPPORT,
431 ES("Protocol family not supported") },
432 { BSM_ERRNO_EAFNOSUPPORT, EAFNOSUPPORT,
433 ES("Address family not supported by protocol family") },
434 { BSM_ERRNO_EADDRINUSE, EADDRINUSE, ES("Address already in use") },
435 { BSM_ERRNO_EADDRNOTAVAIL, EADDRNOTAVAIL,
436 ES("Can't assign requested address") },
437 { BSM_ERRNO_ENETDOWN, ENETDOWN, ES("Network is down") },
438 { BSM_ERRNO_ENETRESET, ENETRESET,
439 ES("Network dropped connection on reset") },
440 { BSM_ERRNO_ECONNABORTED, ECONNABORTED,
441 ES("Software caused connection abort") },
442 { BSM_ERRNO_ECONNRESET, ECONNRESET, ES("Connection reset by peer") },
443 { BSM_ERRNO_ENOBUFS, ENOBUFS, ES("No buffer space available") },
444 { BSM_ERRNO_EISCONN, EISCONN, ES("Socket is already connected") },
445 { BSM_ERRNO_ENOTCONN, ENOTCONN, ES("Socket is not connected") },
446 { BSM_ERRNO_ESHUTDOWN, ESHUTDOWN,
447 ES("Can't send after socket shutdown") },
448 { BSM_ERRNO_ETOOMANYREFS, ETOOMANYREFS,
449 ES("Too many references: can't splice") },
450 { BSM_ERRNO_ETIMEDOUT, ETIMEDOUT, ES("Operation timed out") },
451 { BSM_ERRNO_ECONNREFUSED, ECONNREFUSED, ES("Connection refused") },
452 { BSM_ERRNO_EHOSTDOWN, EHOSTDOWN, ES("Host is down") },
453 { BSM_ERRNO_EHOSTUNREACH, EHOSTUNREACH, ES("No route to host") },
454 { BSM_ERRNO_EALREADY, EALREADY, ES("Operation already in progress") },
455 { BSM_ERRNO_EINPROGRESS, EINPROGRESS,
456 ES("Operation now in progress") },
457 { BSM_ERRNO_ESTALE, ESTALE, ES("Stale NFS file handle") },
458 { BSM_ERRNO_EPWROFF,
435#ifdef EPWROFF
436 EPWROFF,
437#else
438 ERRNO_NO_LOCAL_MAPPING,
439#endif
459#ifdef EPWROFF
460 EPWROFF,
461#else
462 ERRNO_NO_LOCAL_MAPPING,
463#endif
440 "Device power is off" },
441 { BSM_EDEVERR,
464 ES("Device power is off") },
465 { BSM_ERRNO_EDEVERR,
442#ifdef EDEVERR
443 EDEVERR,
444#else
445 ERRNO_NO_LOCAL_MAPPING,
446#endif
466#ifdef EDEVERR
467 EDEVERR,
468#else
469 ERRNO_NO_LOCAL_MAPPING,
470#endif
447 "Device error" },
448 { BSM_EBADEXEC,
471 ES("Device error") },
472 { BSM_ERRNO_EBADEXEC,
449#ifdef EBADEXEC
450 EBADEXEC,
451#else
452 ERRNO_NO_LOCAL_MAPPING,
453#endif
473#ifdef EBADEXEC
474 EBADEXEC,
475#else
476 ERRNO_NO_LOCAL_MAPPING,
477#endif
454 "Bad executable" },
455 { BSM_EBADARCH,
478 ES("Bad executable") },
479 { BSM_ERRNO_EBADARCH,
456#ifdef EBADARCH
457 EBADARCH,
458#else
459 ERRNO_NO_LOCAL_MAPPING,
460#endif
480#ifdef EBADARCH
481 EBADARCH,
482#else
483 ERRNO_NO_LOCAL_MAPPING,
484#endif
461 "Bad CPU type in executable" },
462 { BSM_ESHLIBVERS,
485 ES("Bad CPU type in executable") },
486 { BSM_ERRNO_ESHLIBVERS,
463#ifdef ESHLIBVERS
464 ESHLIBVERS,
465#else
466 ERRNO_NO_LOCAL_MAPPING,
467#endif
487#ifdef ESHLIBVERS
488 ESHLIBVERS,
489#else
490 ERRNO_NO_LOCAL_MAPPING,
491#endif
468 "Shared library version mismatch" },
469 { BSM_EBADMACHO,
492 ES("Shared library version mismatch") },
493 { BSM_ERRNO_EBADMACHO,
470#ifdef EBADMACHO
471 EBADMACHO,
472#else
473 ERRNO_NO_LOCAL_MAPPING,
474#endif
494#ifdef EBADMACHO
495 EBADMACHO,
496#else
497 ERRNO_NO_LOCAL_MAPPING,
498#endif
475 "Malfored Macho file" },
476 { BSM_EPOLICY,
499 ES("Malfored Macho file") },
500 { BSM_ERRNO_EPOLICY,
477#ifdef EPOLICY
478 EPOLICY,
479#else
480 ERRNO_NO_LOCAL_MAPPING,
481#endif
501#ifdef EPOLICY
502 EPOLICY,
503#else
504 ERRNO_NO_LOCAL_MAPPING,
505#endif
482 "Operation failed by policy" },
483 { BSM_EDOTDOT,
506 ES("Operation failed by policy") },
507 { BSM_ERRNO_EDOTDOT,
484#ifdef EDOTDOT
485 EDOTDOT,
486#else
487 ERRNO_NO_LOCAL_MAPPING,
488#endif
508#ifdef EDOTDOT
509 EDOTDOT,
510#else
511 ERRNO_NO_LOCAL_MAPPING,
512#endif
489 "RFS specific error" },
490 { BSM_EUCLEAN,
513 ES("RFS specific error") },
514 { BSM_ERRNO_EUCLEAN,
491#ifdef EUCLEAN
492 EUCLEAN,
493#else
494 ERRNO_NO_LOCAL_MAPPING,
495#endif
515#ifdef EUCLEAN
516 EUCLEAN,
517#else
518 ERRNO_NO_LOCAL_MAPPING,
519#endif
496 "Structure needs cleaning" },
497 { BSM_ENOTNAM,
520 ES("Structure needs cleaning") },
521 { BSM_ERRNO_ENOTNAM,
498#ifdef ENOTNAM
499 ENOTNAM,
500#else
501 ERRNO_NO_LOCAL_MAPPING,
502#endif
522#ifdef ENOTNAM
523 ENOTNAM,
524#else
525 ERRNO_NO_LOCAL_MAPPING,
526#endif
503 "Not a XENIX named type file" },
504 { BSM_ENAVAIL,
527 ES("Not a XENIX named type file") },
528 { BSM_ERRNO_ENAVAIL,
505#ifdef ENAVAIL
506 ENAVAIL,
507#else
508 ERRNO_NO_LOCAL_MAPPING,
509#endif
529#ifdef ENAVAIL
530 ENAVAIL,
531#else
532 ERRNO_NO_LOCAL_MAPPING,
533#endif
510 "No XENIX semaphores available" },
511 { BSM_EISNAM,
534 ES("No XENIX semaphores available") },
535 { BSM_ERRNO_EISNAM,
512#ifdef EISNAM
513 EISNAM,
514#else
515 ERRNO_NO_LOCAL_MAPPING,
516#endif
536#ifdef EISNAM
537 EISNAM,
538#else
539 ERRNO_NO_LOCAL_MAPPING,
540#endif
517 "Is a named type file" },
518 { BSM_EREMOTEIO,
541 ES("Is a named type file") },
542 { BSM_ERRNO_EREMOTEIO,
519#ifdef EREMOTEIO
520 EREMOTEIO,
521#else
522 ERRNO_NO_LOCAL_MAPPING,
523#endif
543#ifdef EREMOTEIO
544 EREMOTEIO,
545#else
546 ERRNO_NO_LOCAL_MAPPING,
547#endif
524 "Remote I/O error" },
525 { BSM_ENOMEDIUM,
548 ES("Remote I/O error") },
549 { BSM_ERRNO_ENOMEDIUM,
526#ifdef ENOMEDIUM
527 ENOMEDIUM,
528#else
529 ERRNO_NO_LOCAL_MAPPING,
530#endif
550#ifdef ENOMEDIUM
551 ENOMEDIUM,
552#else
553 ERRNO_NO_LOCAL_MAPPING,
554#endif
531 "No medium found" },
532 { BSM_EMEDIUMTYPE,
555 ES("No medium found") },
556 { BSM_ERRNO_EMEDIUMTYPE,
533#ifdef EMEDIUMTYPE
534 EMEDIUMTYPE,
535#else
536 ERRNO_NO_LOCAL_MAPPING,
537#endif
557#ifdef EMEDIUMTYPE
558 EMEDIUMTYPE,
559#else
560 ERRNO_NO_LOCAL_MAPPING,
561#endif
538 "Wrong medium type" },
539 { BSM_ENOKEY,
562 ES("Wrong medium type") },
563 { BSM_ERRNO_ENOKEY,
540#ifdef ENOKEY
541 ENOKEY,
542#else
543 ERRNO_NO_LOCAL_MAPPING,
544#endif
564#ifdef ENOKEY
565 ENOKEY,
566#else
567 ERRNO_NO_LOCAL_MAPPING,
568#endif
545 "Required key not available" },
546 { BSM_EKEYEXPIRED,
569 ES("Required key not available") },
570 { BSM_ERRNO_EKEYEXPIRED,
547#ifdef EKEEXPIRED
548 EKEYEXPIRED,
549#else
550 ERRNO_NO_LOCAL_MAPPING,
551#endif
571#ifdef EKEEXPIRED
572 EKEYEXPIRED,
573#else
574 ERRNO_NO_LOCAL_MAPPING,
575#endif
552 "Key has expired" },
553 { BSM_EKEYREVOKED,
576 ES("Key has expired") },
577 { BSM_ERRNO_EKEYREVOKED,
554#ifdef EKEYREVOKED
555 EKEYREVOKED,
556#else
557 ERRNO_NO_LOCAL_MAPPING,
558#endif
578#ifdef EKEYREVOKED
579 EKEYREVOKED,
580#else
581 ERRNO_NO_LOCAL_MAPPING,
582#endif
559 "Key has been revoked" },
560 { BSM_EKEYREJECTED,
583 ES("Key has been revoked") },
584 { BSM_ERRNO_EKEYREJECTED,
561#ifdef EKEREJECTED
562 EKEYREJECTED,
563#else
564 ERRNO_NO_LOCAL_MAPPING,
565#endif
585#ifdef EKEREJECTED
586 EKEYREJECTED,
587#else
588 ERRNO_NO_LOCAL_MAPPING,
589#endif
566 "Key was rejected by service" },
590 ES("Key was rejected by service") },
567};
591};
568static const int bsm_errors_count = sizeof(bsm_errors) / sizeof(bsm_errors[0]);
592static const int bsm_errnos_count = sizeof(bsm_errnos) / sizeof(bsm_errnos[0]);
569
593
570static const struct bsm_errors *
571au_bsm_error_lookup_errno(int error)
594static const struct bsm_errno *
595bsm_lookup_errno_local(int local_errno)
572{
573 int i;
574
596{
597 int i;
598
575 if (error == ERRNO_NO_LOCAL_MAPPING)
576 return (NULL);
577 for (i = 0; i < bsm_errors_count; i++) {
578 if (bsm_errors[i].be_os_error == error)
579 return (&bsm_errors[i]);
599 for (i = 0; i < bsm_errnos_count; i++) {
600 if (bsm_errnos[i].be_local_errno == local_errno)
601 return (&bsm_errnos[i]);
580 }
581 return (NULL);
582}
583
602 }
603 return (NULL);
604}
605
584static const struct bsm_errors *
585au_bsm_error_lookup_bsm(u_char bsm_error)
606/*
607 * Conversion to the BSM errno space isn't allowed to fail; we simply map to
608 * BSM_ERRNO_UNKNOWN and let the remote endpoint deal with it.
609 */
610u_char
611au_errno_to_bsm(int local_errno)
586{
612{
613 const struct bsm_errno *bsme;
614
615 bsme = bsm_lookup_errno_local(local_errno);
616 if (bsme == NULL)
617 return (BSM_ERRNO_UNKNOWN);
618 return (bsme->be_bsm_errno);
619}
620
621static const struct bsm_errno *
622bsm_lookup_errno_bsm(u_char bsm_errno)
623{
587 int i;
588
624 int i;
625
589 for (i = 0; i < bsm_errors_count; i++) {
590 if (bsm_errors[i].be_bsm_error == bsm_error)
591 return (&bsm_errors[i]);
626 for (i = 0; i < bsm_errnos_count; i++) {
627 if (bsm_errnos[i].be_bsm_errno == bsm_errno)
628 return (&bsm_errnos[i]);
592 }
593 return (NULL);
594}
595
596/*
597 * Converstion from a BSM error to a local error number may fail if either
598 * OpenBSM doesn't recognize the error on the wire, or because there is no
629 }
630 return (NULL);
631}
632
633/*
634 * Converstion from a BSM error to a local error number may fail if either
635 * OpenBSM doesn't recognize the error on the wire, or because there is no
599 * appropriate local mapping. However, we don't allow conversion to BSM to
600 * fail, we just convert to BSM_UKNOWNERR.
636 * appropriate local mapping.
601 */
602int
637 */
638int
603au_bsm_to_errno(u_char bsm_error, int *errorp)
639au_bsm_to_errno(u_char bsm_errno, int *errorp)
604{
640{
605 const struct bsm_errors *bsme;
641 const struct bsm_errno *bsme;
606
642
607 bsme = au_bsm_error_lookup_bsm(bsm_error);
608 if (bsme == NULL || bsme->be_os_error == ERRNO_NO_LOCAL_MAPPING)
643 bsme = bsm_lookup_errno_bsm(bsm_errno);
644 if (bsme == NULL || bsme->be_local_errno == ERRNO_NO_LOCAL_MAPPING)
609 return (-1);
645 return (-1);
610 *errorp = bsme->be_os_error;
646 *errorp = bsme->be_local_errno;
611 return (0);
612}
613
647 return (0);
648}
649
614u_char
615au_errno_to_bsm(int error)
616{
617 const struct bsm_errors *bsme;
618
619 /*
620 * We should never be passed this libbsm-internal constant, and
621 * because it is ambiguous we just return an error.
622 */
623 if (error == ERRNO_NO_LOCAL_MAPPING)
624 return (BSM_UNKNOWNERR);
625 bsme = au_bsm_error_lookup_errno(error);
626 if (bsme == NULL)
627 return (BSM_UNKNOWNERR);
628 return (bsme->be_bsm_error);
629}
630
631#if !defined(KERNEL) && !defined(_KERNEL)
632const char *
650#if !defined(KERNEL) && !defined(_KERNEL)
651const char *
633au_strerror(u_char bsm_error)
652au_strerror(u_char bsm_errno)
634{
653{
635 const struct bsm_errors *bsme;
654 const struct bsm_errno *bsme;
636
655
637 bsme = au_bsm_error_lookup_bsm(bsm_error);
656 bsme = bsm_lookup_errno_bsm(bsm_errno);
638 if (bsme == NULL)
639 return ("Unrecognized BSM error");
657 if (bsme == NULL)
658 return ("Unrecognized BSM error");
640 if (bsme->be_os_error != ERRNO_NO_LOCAL_MAPPING)
641 return (strerror(bsme->be_os_error));
659 if (bsme->be_local_errno != ERRNO_NO_LOCAL_MAPPING)
660 return (strerror(bsme->be_local_errno));
642 return (bsme->be_strerror);
643}
644#endif
661 return (bsme->be_strerror);
662}
663#endif