'\" te .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. .\" 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. .\" 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. .\" 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] .TH AU_OPEN 3BSM "Mar 6, 2017" .SH NAME au_open, au_close, au_write \- construct and write audit records .SH SYNOPSIS .LP .nf \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lbsm\fR \fB -lsocket \fR \fB -lnsl \fR [ \fIlibrary\fR... ] #include \fBint\fR \fBau_close\fR(\fBint\fR \fId\fR, \fBint\fR \fIkeep\fR, \fBshort\fR \fIevent\fR); .fi .LP .nf \fBint\fR \fBau_open\fR(\fB\fR\fIvoid\fR); .fi .LP .nf \fBint\fR \fBau_write\fR(\fBint\fR \fId\fR, \fBtoken_t *\fR\fIm\fR); .fi .SH DESCRIPTION .LP The \fBau_open()\fR function returns an audit record descriptor to which audit tokens can be written using \fBau_write()\fR. The audit record descriptor is an integer value that identifies a storage area where audit records are accumulated. .sp .LP The \fBau_close()\fR function terminates the life of an audit record \fId\fR of type \fIevent\fR started by \fBau_open()\fR. If the \fIkeep\fR parameter is \fBAU_TO_NO_WRITE\fR, the data contained therein is discarded. If the \fIkeep\fR parameter is \fBAU_TO_WRITE\fR, the additional parameters are used to create a header token. Depending on the audit policy information obtained by \fBauditon\fR(2), additional tokens such as \fIsequence\fR and \fItrailer\fR tokens can be added to the record. The \fBau_close()\fR function then writes the record to the audit trail by calling \fBaudit\fR(2). Any memory used is freed by calling \fBfree\fR(3C). .sp .LP The \fBau_write()\fR function adds the audit token pointed to by \fIm\fR to the audit record identified by the descriptor \fId\fR. After this call is made the audit token is no longer available to the caller. .SH RETURN VALUES .LP Upon successful completion, \fBau_open()\fR returns an audit record descriptor. If a descriptor could not be allocated, \fBau_open()\fR returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error. .sp .LP Upon successful completion, \fBau_close()\fR returns \fB0\fR. If \fId\fR is an invalid or corrupted descriptor or if \fBaudit()\fR fails, \fBau_close()\fR returns \(mi1 without setting \fBerrno\fR. If \fBaudit()\fR fails, \fBerrno\fR is set to one of the error values described on the \fBaudit\fR(2) manual page. .sp .LP Upon successful completion, \fBau_write()\fR returns \fB0\fR. If \fId\fR is an invalid descriptor or \fIm\fR is an invalid token, or if \fBaudit()\fR fails, \fBau_write()\fR returns \(mi1 without setting \fBerrno\fR. If \fBaudit()\fR fails, \fBerrno\fR is set to one of the error values described on the \fBaudit\fR(2) manual page. .SH ERRORS .LP The \fBau_open()\fR function will fail if: .sp .ne 2 .na \fB\fBENOMEM\fR\fR .ad .RS 10n The physical limits of the system have been exceeded such that sufficient memory cannot be allocated. .RE .sp .ne 2 .na \fB\fBEAGAIN\fR\fR .ad .RS 10n There is currently insufficient memory available. The application can try again later. .RE .SH ATTRIBUTES .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Stable _ MT-Level MT-Safe .TE .SH SEE ALSO .LP \fBaudit\fR(2), \fBauditon\fR(2), \fBau_preselect\fR(3BSM), \fBau_to\fR(3BSM), \fBfree\fR(3C), \fBattributes\fR(5)