Merge branch 'master' of git://github.com/illumos/illumos-gate
[unleashed.git] / usr / src / man / man3bsm / au_open.3bsm
blob0985efbfd2e35d33571a51c67dcf60ba9a048ec4
1 '\" te
2 .\" Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH AU_OPEN 3BSM "Mar 31, 2005"
7 .SH NAME
8 au_open, au_close, au_write \- construct and write audit records
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lbsm\fR [ \fIlibrary\fR... ]
13 #include <bsm/libbsm.h>
15 \fBint\fR \fBau_close\fR(\fBint\fR \fId\fR, \fBint\fR \fIkeep\fR, \fBshort\fR \fIevent\fR);
16 .fi
18 .LP
19 .nf
20 \fBint\fR \fBau_open\fR(\fB\fR\fIvoid\fR);
21 .fi
23 .LP
24 .nf
25 \fBint\fR \fBau_write\fR(\fBint\fR \fId\fR, \fBtoken_t *\fR\fIm\fR);
26 .fi
28 .SH DESCRIPTION
29 .sp
30 .LP
31 The \fBau_open()\fR function returns an audit record descriptor to which audit
32 tokens can be written using \fBau_write()\fR. The audit record descriptor is an
33 integer value that identifies a storage area where audit records are
34 accumulated.
35 .sp
36 .LP
37 The \fBau_close()\fR function terminates the life of an audit record  \fId\fR
38 of type \fIevent\fR started by \fBau_open()\fR. If the \fIkeep\fR parameter is
39 \fBAU_TO_NO_WRITE\fR, the data contained therein is discarded. If the
40 \fIkeep\fR parameter is \fBAU_TO_WRITE\fR, the additional parameters are used
41 to create a header token.  Depending on the audit policy information  obtained
42 by \fBauditon\fR(2), additional tokens such as  \fIsequence\fR and
43 \fItrailer\fR tokens can be added to the record. The \fBau_close()\fR function
44 then writes the record to the audit trail by calling \fBaudit\fR(2).  Any
45 memory used is freed by calling \fBfree\fR(3C).
46 .sp
47 .LP
48 The \fBau_write()\fR function adds the audit token pointed to by \fIm\fR to the
49 audit record identified by the descriptor \fId\fR. After this call is made the
50 audit token is no longer available to the caller.
51 .SH RETURN VALUES
52 .sp
53 .LP
54 Upon successful completion, \fBau_open()\fR returns an audit record descriptor.
55 If a descriptor could not be allocated, \fBau_open()\fR returns \fB\(mi1\fR and
56 sets \fBerrno\fR to indicate the error.
57 .sp
58 .LP
59 Upon successful completion, \fBau_close()\fR  returns \fB0\fR. If \fId\fR is an
60 invalid or corrupted descriptor or if \fBaudit()\fR fails, \fBau_close()\fR
61 returns \(mi1 without setting \fBerrno\fR. If \fBaudit()\fR fails, \fBerrno\fR
62 is set to one of the error values described on the \fBaudit\fR(2) manual page.
63 .sp
64 .LP
65 Upon successful completion, \fBau_write()\fR  returns \fB0\fR. If \fId\fR is an
66 invalid descriptor or \fIm\fR is an invalid token, or if \fBaudit()\fR fails,
67 \fBau_write()\fR returns \(mi1 without setting \fBerrno\fR. If \fBaudit()\fR
68 fails, \fBerrno\fR is set to one of the error values described on the
69 \fBaudit\fR(2) manual page.
70 .SH ERRORS
71 .sp
72 .LP
73 The \fBau_open()\fR function will fail if:
74 .sp
75 .ne 2
76 .na
77 \fB\fBENOMEM\fR\fR
78 .ad
79 .RS 10n
80 The physical limits of the system have been exceeded such that sufficient
81 memory cannot be allocated.
82 .RE
84 .sp
85 .ne 2
86 .na
87 \fB\fBEAGAIN\fR\fR
88 .ad
89 .RS 10n
90 There is currently insufficient memory available. The application can try again
91 later.
92 .RE
94 .SH ATTRIBUTES
95 .sp
96 .LP
97 See \fBattributes\fR(5) for descriptions of the following attributes:
98 .sp
102 box;
103 c | c
104 l | l .
105 ATTRIBUTE TYPE  ATTRIBUTE VALUE
107 Interface Stability     Stable
109 MT-Level        MT-Safe
112 .SH SEE ALSO
115 \fBbsmconv\fR(1M), \fBaudit\fR(2), \fBauditon\fR(2), \fBau_preselect\fR(3BSM),
116 \fBau_to\fR(3BSM), \fBfree\fR(3C), \fBattributes\fR(5)
117 .SH NOTES
120 The functionality described on this manual page is available only if the
121 Solaris Auditing has been enabled.  See \fBbsmconv\fR(1M) for more information.