xref: /illumos-gate/usr/src/man/man2/audit.2 (revision dd72704bd9e794056c558153663c739e2012d721)
te
Copyright (c) 2008, 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]
AUDIT 2 "Mar 6, 2017"
NAME
audit - write a record to the audit log
SYNOPSIS

cc [ flag ... ] file ... -lbsm  -lsocket   -lnsl  [ library... ]
#include <sys/param.h>
#include <bsm/libbsm.h>

int audit(caddr_t record, int length);
DESCRIPTION

The audit() function queues a record for writing to the system audit log. The data pointed to by record is queued for the log after a minimal consistency check, with the length parameter specifying the size of the record in bytes. The data should be a well-formed audit record as described by audit.log(5).

The kernel validates the record header token type and length, and sets the time stamp value before writing the record to the audit log. The kernel does not do any preselection for user-level generated events. If the audit policy is set to include sequence or trailer tokens, the kernel will append them to the record.

RETURN VALUES

Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.

ERRORS

The audit() function will fail if: E2BIG

The record length is greater than the maximum allowed record length.

EFAULT

The record argument points outside the process's allocated address space.

EINVAL

The header token in the record is invalid.

ENOTSUP

Audit is not defined for this system.

EPERM

The {PRIV_PROC_AUDIT} privilege is not asserted in the effective set of the calling process.

USAGE

Only privileged processes can successfully execute this call.

ATTRIBUTES

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Committed
MT-Level MT-Safe
SEE ALSO

auditon (2), getaudit (2), audit.log (5), attributes (7), privileges (7), audit (8), auditd (8), svcadm (8)

NOTES

The functionality described in this man page is available only if the audit daemon auditd(8) has not been disabled by audit(8) or svcadm(8).