---
name: "au_errno"
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_bsm_to_errno"
---

# au\_errno(3)

convert between BSM and local error numbers

Part of [au\_bsm\_to\_errno(3)](/au_bsm_to_errno/3.md).

## NAME

**au\_bsm\_to\_errno**, **au\_errno\_to\_bsm**, **au\_strerror** – convert between BSM and local error numbers

## LIBRARY

library “libbsm”

## SYNOPSIS

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

*int*\

**au\_bsm\_to\_errno**(*u\_char bsm\_error*, *int \*errorp*);

*u\_char*\

**au\_errno\_to\_bsm**(*int error*);

*const* *char* *\**\

**au\_strerror**(*int bsm\_error*);

## DESCRIPTION

These interfaces may be used to convert between the local ( [errno(2)](/errno/2.md)) and BSM error number spaces found in BSM return tokens.

The **au\_bsm\_to\_errno**() function accepts a BSM error value, *bsm\_error*, and converts it to an [errno(2)](/errno/2.md) that will be stored in the integer pointed to by *errorp* if successful. This call will fail if the BSM error cannot be mapped into a local error number, which may occur if the return token was generated on another operating system.

The **au\_errno\_to\_bsm**() function accepts a local [errno(2)](/errno/2.md) value, and returns the BSM error number for it. This call cannot fail, and instead returns a BSM error number indicating to a later decoder that the error could not be encoded.

The **au\_strerror**() function converts a BSM error value to a string, generally by converting first to a local error number and using the local [strerror(3)](/strerror/3.md) function, but will also work for errors that are not locally defined.

## RETURN VALUES

On success, **au\_bsm\_to\_errno**() returns 0 and a converted error value; on failure, it returns -1 but does not set [errno(2)](/errno/2.md).

On success, **au\_strerror**() returns a pointer to an error string; on failure it will return NULL.

## SEE ALSO

[au\_to\_return(3)](/au_to_return/3.md), [au\_to\_return32(3)](/au_to_return32/3.md), [au\_to\_return64(3)](/au_to_return64/3.md), [libbsm(3)](/libbsm/3.md)

## HISTORY

**au\_bsm\_to\_errno**() and **au\_errno\_to\_bsm**() were introduced in OpenBSM 1.1.

## AUTHORS

These functions were implemented by Robert Watson under contract to Apple Inc.

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

## BUGS

**au\_strerror** is unable to provide localized strings for errors not available in the local operating system.
