AUDIT(2) System Calls AUDIT(2)

audit - write a record to the audit log

cc [ flag ... ] file ... -lbsm  -lsocket   -lnsl   [ library... ]
#include <sys/param.h>
#include <bsm/libbsm.h>
int audit(caddr_t record, int length);

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.

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

The audit() function will fail if:


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


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


The header token in the record is invalid.


Audit is not defined for this system.


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

Only privileged processes can successfully execute this call.

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

Interface Stability Committed
MT-Level MT-Safe

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

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).
March 6, 2017 OmniOS