xref: /freebsd/contrib/openbsm/libbsm/au_errno.3 (revision 9a14aa017b21c292740c00ee098195cd46642730)
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#4 $
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
67The
68.Fn au_errno_to_bsm
69function accepts a local
70.Xr errno 2
71value, and returns the BSM error number for it.
72This call cannot fail, and instead returns a BSM error number indicating to
73a later decoder that the error could not be encoded.
74.Pp
75The
76.Fn au_strerror
77function converts a BSM error value to a string, generally by converting first to a
78local error number and using the local
79.Xr strerror 3
80function, but will also work for errors that are not locally defined.
81.Sh RETURN VALULES
82On success,
83.Fn au_bsm_to_errno
84returns 0 and a converted error value; on failure, it returns -1 but does not
85set
86.Xr errno 2 .
87.Pp
88On success,
89.Fn au_strerror
90returns a pointer to an error string; on failure it will return
91.Dv NULL .
92.Sh SEE ALSO
93.Xr au_to_return 3 ,
94.Xr au_to_return32 3 ,
95.Xr au_to_return64 3 ,
96.Xr libbsm 3
97.Sh HISTORY
98.Fn au_bsm_to_errno
99and
100.Fn au_errno_to_bsm
101were introduced in OpenBSM 1.1.
102.Sh AUTHORS
103These functions were implemented by
104.An Robert Watson
105under contract to Apple Inc.
106.Pp
107The Basic Security Module (BSM) interface to audit records and audit event
108stream format were defined by Sun Microsystems.
109.Sh BUGS
110.Nm au_strerror
111is unable to provide localized strings for errors not available in the local
112operating system.
113