AU_BSM_TO_FCNTL_CMD(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… AU_BSM_TO_FCNTL_CMD(3) β€” like, the whole libbsm fcntl-command translator situation

okay so bestie, welcome to AU_BSM_TO_FCNTL_CMD(3), a page from the Library Functions Manual (section 3, the library-calls girlies ✨). This is the one about converting between BSM and local fcntl(2) command values. Two little functions, one very important job. Let's get into it πŸŽ€


🌸 NAME 🌸

au_bsm_to_fcntl_cmd, au_fcntl_cmd_to_bsm β€” they convert between BSM and local fcntl(2) command values. That's it, that's the whole vibe πŸ’«


πŸ“š LIBRARY πŸ“š

Basic Security Module Library (libbsm, -lbsm). Link her in and you're good to go 🫢


✨ SYNOPSIS ✨

#include <bsm/libbsm.h>

int
au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);

u_short
au_fcntl_cmd_to_bsm(int local_fcntl_cmd);

look at them. so small. so purposeful. main character energy fr πŸ˜­πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

These interfaces lowkey exist for one reason: converting between the local and BSM fcntl(2) command values. Two directions, two functions, no drama.

πŸ’œ au_bsm_to_fcntl_cmd() β€” BSM ➑️ local

She takes a BSM command value, bsm_fcntl_cmd, and converts it into a local command value (the kind you'd pass to fcntl(2)). If it works, that converted value gets stored in the integer pointed to by local_fcntl_cmdp. πŸŽ€

⚠️ Heads up: this call fails if the BSM command value can't be mapped into a local fcntl(2) command value. And like, that can genuinely happen β€” it may occur if the command token was generated on another operating system. so not her fault, it's a whole cross-OS situation πŸ’€

🌈 au_fcntl_cmd_to_bsm() β€” local ➑️ BSM

She takes a local fcntl(2) command value and hands you back the BSM fcntl(2) command value for it. And get this: this call cannot fail. iconic. πŸ‘‘

Instead of failing, she returns a BSM command value that tells a later decoder "hey bestie, this command value could not be encoded." no cap, that's the whole mechanism 🧚


πŸ”₯ RETURN VALUES πŸ”₯

  • On success, au_bsm_to_fcntl_cmd() returns 0 and a converted command value. slay βœ…
  • On failure, it returns -1 β€” but it does not set errno(2). so don't go checking errno for answers, she's not giving you any πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

fcntl(2), au_bsm_to_domain(3), au_bsm_to_socket_type(3), au_domain_to_bsm(3), au_socket_type_to_bsm(3), libbsm(3)

the whole friend group, honestly 🫢✨


⭐ HISTORY ⭐

au_bsm_to_domain() and au_domain_to_bsm() were introduced in OpenBSM 1.1.

(yes, that's literally what it says up in here β€” we're just reporting the facts, don't come for me πŸ˜­πŸ’€)


πŸ’– AUTHORS πŸ’–

These functions were implemented by Stacey Son under contract to Apple Inc. β€” go off, Stacey πŸ‘‘πŸ’…

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


and that's the page, bestie!! πŸŽ€ source/version: Debian, dated March 5, 2009 β€” yes she's an old queen and she's still serving πŸ’œβœ¨ see u in the next manpage, mwah πŸ¦‹

πŸ“¦ where this page comes from