audit(2) [opensolaris man page]
audit(2) System Calls audit(2) 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 mini- mal 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(4). 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 Solaris 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(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
bsmconv(1M), audit(1M), auditd(1M), svcadm(1M), auditon(2), getaudit(2), audit.log(4), attributes(5), privileges(5) NOTES
The functionality described in this man page is available only if the Solaris Auditing has been enabled and the audit daemon auditd(1M) has not been disabled by audit(1M) or svcadm(1M). See bsmconv(1M) for more information. SunOS 5.11 16 Apr 2008 audit(2)
Check Out this Related Man Page
au_open(3BSM) Security and Auditing Library Functions au_open(3BSM) NAME
au_open, au_close, au_write - construct and write audit records SYNOPSIS
cc [ flag... ] file... -lbsm -lsocket -lnsl [ library... ] #include <bsm/libbsm.h> int au_close(int d, int keep, short event); int au_open(void); int au_write(int d, token_t *m); DESCRIPTION
The au_open() function returns an audit record descriptor to which audit tokens can be written using au_write(). The audit record descrip- tor is an integer value that identifies a storage area where audit records are accumulated. The au_close() function terminates the life of an audit record d of type event started by au_open(). If the keep parameter is AU_TO_NO_WRITE, the data contained therein is discarded. If the keep parameter is AU_TO_WRITE, the additional parameters are used to create a header token. Depending on the audit policy information obtained by auditon(2), additional tokens such as sequence and trailer tokens can be added to the record. The au_close() function then writes the record to the audit trail by calling audit(2). Any memory used is freed by calling free(3C). The au_write() function adds the audit token pointed to by m to the audit record identified by the descriptor d. After this call is made the audit token is no longer available to the caller. RETURN VALUES
Upon successful completion, au_open() returns an audit record descriptor. If a descriptor could not be allocated, au_open() returns -1 and sets errno to indicate the error. Upon successful completion, au_close() returns 0. If d is an invalid or corrupted descriptor or if audit() fails, au_close() returns -1 without setting errno. If audit() fails, errno is set to one of the error values described on the audit(2) manual page. Upon successful completion, au_write() returns 0. If d is an invalid descriptor or m is an invalid token, or if audit() fails, au_write() returns -1 without setting errno. If audit() fails, errno is set to one of the error values described on the audit(2) manual page. ERRORS
The au_open() function will fail if: ENOMEM The physical limits of the system have been exceeded such that sufficient memory cannot be allocated. EAGAIN There is currently insufficient memory available. The application can try again later. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
bsmconv(1M), audit(2), auditon(2), au_preselect(3BSM), au_to(3BSM), free(3C), attributes(5) NOTES
The functionality described on this manual page is available only if the Solaris Auditing has been enabled. See bsmconv(1M) for more information. SunOS 5.11 31 Mar 2005 au_open(3BSM)