'\" 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 "31 Mar 2005" "SunOS 5.11" "Security and Auditing Library Functions" .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 .sp .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 .sp .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 .sp .LP The \fBau_open()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 10n .rt The physical limits of the system have been exceeded such that sufficient memory cannot be allocated. .RE .sp .ne 2 .mk .na \fB\fBEAGAIN\fR\fR .ad .RS 10n .rt There is currently insufficient memory available. The application can try again later. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityStable _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBbsmconv\fR(1M), \fBaudit\fR(2), \fBauditon\fR(2), \fBau_preselect\fR(3BSM), \fBau_to\fR(3BSM), \fBfree\fR(3C), \fBattributes\fR(5) .SH NOTES .sp .LP The functionality described on this manual page is available only if the Solaris Auditing has been enabled. See \fBbsmconv\fR(1M) for more information.