---
name: "au_get_state"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/au_get_state"
---

# au\_get\_state(3)

audit event notification

## NAME

**au\_get\_state**, **au\_notify\_initialize**, **au\_notify\_terminate** – audit event notification

## LIBRARY

library “libbsm”

## SYNOPSIS

**#include \<bsm/libbsm.h\>**

*int*\

**au\_get\_state**(*void*);

*uint32\_t*\

**au\_notify\_initialize**(*void*);

*int*\

**au\_notify\_terminate**(*void*);

## DESCRIPTION

The **au\_notify** audit notification API tracks audit state in a form permitting efficient update, avoiding frequent system calls to check the kernel audit state. It is implemented only for Darwin/Mac OS X.

The **au\_get\_state**() function provides a lightweight way to check whether or not auditing is enabled. If a client wants to use this function to determine whether an entire series of audit calls should be made -- as in the common case of a caller building a set of tokens, then writing them -- it should cache the audit status in a local variable. This function always returns the current state of auditing. If audit notification has not already been initialized by calling **au\_notify\_initialize**() it will be automatically initialized on the first call of this function.

The **au\_notify\_initialize**() function initializes audit notification.

The **au\_notify\_terminate**() function cancels audit notification and frees the resources associated with it. Responsible code that no longer needs to use **au\_get\_state**() should call this function.

## RETURN VALUES

If no error occurred the **au\_get\_state**() function returns AUC\_NOAUDIT if auditing is disabled or suspended, and AUC\_AUDITING if auditing is enabled and active. Otherwise, the function can return any of the errno values defined for [setaudit(2)](/setaudit/2.md), or AU\_UNIMPL if audit does not appear to be supported by the system.

The **au\_notify\_initialize**() function returns 0 on success, AU\_UNIMPL if audit does not appear to be supported by the system, or one of the status codes defined in ⟨notify.h⟩ on Mac OS X to indicate the error.

The **au\_notify\_terminate**() function returns 0 on success, or -1 on failure.

## SEE ALSO

[libbsm(3)](/libbsm/3.md), [notify(3)](/notify/3.md) (Mac OS X)

## HISTORY

The OpenBSM implementation was created by McAfee Research, the security division of McAfee Inc., under contract to Apple Computer, Inc., in 2004. It was subsequently adopted by the TrustedBSD Project as the foundation for the OpenBSM distribution.

## AUTHORS

This software was created by Apple Computer, Inc.

The Basic Security Module (BSM) interface to audit records and audit event stream format were defined by Sun Microsystems.
