xref: /freebsd/contrib/openbsm/libbsm/au_errno.3 (revision 39beb93c3f8bdbf72a61fda42300b5ebed7390c8)
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
9.\"     notice, this list of conditions and the following disclaimer.
10.\" 2.  Redistributions in binary form must reproduce the above copyright
11.\"     notice, this list of conditions and the following disclaimer in the
12.\"     documentation and/or other materials provided with the distribution.
13.\" 3.  Neither the name of Apple Inc. ("Apple") nor the names of
14.\"     its contributors may be used to endorse or promote products derived
15.\"     from this software without specific prior written permission.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20.\" ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR
21.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
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/au_errno.3#3 $
30.\"
31.Dd December 8, 2008
32.Dt AU_BSM_TO_ERRNO 3
33.Os
34.Sh NAME
35.Nm au_bsm_to_errno ,
36.Nm au_errno_to_bsm ,
37.Nm au_strerror
38.Nd "convert between BSM and local error numbers"
39.Sh LIBRARY
40.Lb libbsm
41.Sh SYNOPSIS
42.In bsm/libbsm.h
43.Ft int
44.Fn au_bsm_to_errno "u_char bsm_error" "int *errorp"
45.Ft u_char
46.Fn au_errno_to_bsm "int error"
47.Ft const char *
48.Fn au_strerror "int bsm_error"
49.Sh DESCRIPTION
50These interfaces may be used to convert between the local (
51.Xr errno 2 )
52and BSM error number spaces found in BSM return tokens.
53.Pp
54The
55.Fn au_bsm_to_errno
56function accepts a BSM error value,
57.Fa bsm_error,
58and converts it to an
59.Xr errno 2
60that will be stored in the integer pointed to by
61.Fa errorp
62if successful.
63This call will fail if the BSM error cannot be mapped into a local error
64number, which may occur if the return token was generated on another
65operating system.
66.Pp
67.Fn au_errno_to_bsm
68function accepts a local
69.Xr errno 2
70value, and returns the BSM error number for it.
71This call cannot fail, and instead returns a BSM error number indicating to
72a later decoder that the error could not be encoded.
73.Pp
74The
75.Fn au_strerror
76converts a BSM error value to a string, generally by converting first to a
77local error number and using the local
78.Xr strerror 3
79function, but will also work for errors that are not locally defined.
80.Sh RETURN VALULES
81On success,
82.Fn au_bsm_to_errno
83returns 0 and a converted error value; on failure, it returns -1 but does not
84set
85.Xr errno 2 .
86.Pp
87On success,
88.Fn au_strerror
89returns a pointer to an error string; on failure it will return
90.Dv NULL .
91.Sh SEE ALSO
92.Xr au_to_return 3 ,
93.Xr au_to_return32 3 ,
94.Xr au_to_return64 3 ,
95.Xr libbsm 3
96.Sh HISTORY
97.Fn au_bsm_to_errno
98and
99.Fn au_errno_to_bsm
100were introduced in OpenBSM 1.1.
101.Sh AUTHORS
102These functions were implemented by
103.An Robert Watson
104under contract to Apple Inc.
105.Pp
106The Basic Security Module (BSM) interface to audit records and audit event
107stream format were defined by Sun Microsystems.
108.Sh BUGS
109.Nm au_strerror
110is unable to provide localized strings for errors not available in the local
111operating system.
112