AU_BSM_TO_ERRNO(3)
π AU_BSM_TO_ERRNO(3) β bestie edition π
okay so this one lives in the Library Functions Manual, specifically the Basic Security Module Library aka libbsm, and you link it with -lbsm. that's the vibe check for today β¨
πΈ NAME πΈ
au_bsm_to_errno, au_errno_to_bsm, au_strerror β the three little besties that convert between BSM and local error numbers π¦
π LIBRARY π
Basic Security Module Library (libbsm, -lbsm) π
β¨ 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 π
so these interfaces exist to convert between two whole error-number spaces: the local one (errno(2)) and the BSM one you'll find chillin' in BSM return tokens. two worlds, one bridge, iconic π
au_bsm_to_errno()β takes a BSM error value,bsm_error, and converts it into anerrno(2)that gets stored in the integer pointed to byerrorpif it works out. π«Ά
heads up bestie: this call fails if the BSM error can't be mapped into a local error number, which can totes happen if the return token was generated on a different operating system. literally not our fault π
au_errno_to_bsm()β takes a localerrno(2)value and hands back the BSM error number for it. this call cannot fail π instead it returns a BSM error number that tells a later decoder "yeah, this error could not be encoded." graceful, honestly πau_strerror()β converts a BSM error value into a string. usually it converts to a local error number first and then uses the localstrerror(3), but it will also work for errors that aren't locally defined. flexible queen π
π₯ RETURN VALUES π₯
- on success,
au_bsm_to_errno()returns0plus a converted error value β¨ - on failure, it returns
-1but does not seterrno(2). not me dropping the ball on the errno, i know π - on success,
au_strerror()returns a pointer to an error string π - on failure, it returns
NULL. that's it. that's the whole mood π
π SEE ALSO π
au_to_return(3), au_to_return32(3), au_to_return64(3), libbsm(3) β go read those too, iykyk π
π¦ HISTORY π¦
au_bsm_to_errno() and au_errno_to_bsm() were introduced in OpenBSM 1.1. throwback era ngl β
π AUTHORS π
these functions were implemented by Robert Watson under contract to Apple Inc. π
also: the Basic Security Module (BSM) interface to audit records and the audit event stream format were defined by Sun Microsystems. legends, fr fr βοΈ
π BUGS π
au_strerror cannot provide localized strings for errors that aren't available in the local operating system. soz π that's just how it is.
π§ sign-off π§
this cutie came from Debian and the page is dated December 8, 2008 β vintage, honestly π bye bestie, go audit something πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2008 Apple Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms