MAC_TEXT(3)
okay so bestie, welcome to MAC_TEXT(3) from the Library Functions Manual β we're doing MAC label β text representation today, and yes it's giving conversion core. β¨
π NAME π
mac_from_text, mac_to_text β convert MAC label to/from text representation
π LIBRARY π
Standard C Library (libc, -lc) β periodt.
β¨ SYNOPSIS β¨
#include <sys/mac.h>
int
mac_from_text(mac_t *mac, const char *text);
int
mac_to_text(mac_t label, char **text);
π DESCRIPTION π
okay so mac_from_text() converts the text representation of a label into the internal policy label format (mac_t) and places it in *mac. and the way that *mac must later be freed with mac_free(3) is lowkey important β don't forget, bestie.
mac_to_text() allocates storage for *text, which will be set to the text representation of label and must later be freed with free(3). slay, but free it.
For the MAC label format, refer to maclabel(7). iykyk. π¦
π RETURN VALUES π
The mac_from_text() and mac_to_text() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. slay when it's 0, π when it's -1.
β οΈ COMPATIBILITY β οΈ
POSIX.1e does not define a format for text representations of MAC labels. no cap.
POSIX.1e requires that text strings allocated using mac_to_text() be freed using mac_free(3); in the FreeBSD implementation, they must be freed using free(3), as mac_free(3) is used only to free memory used for type mac_t. okay so that's the tea β β don't mix those up.
π ERRORS π
[ENOMEM]β Insufficient memory was available to allocate internal storage.
π SEE ALSO π
literally go read: free(3), mac(3), mac_get(3), mac_is_present(3), mac_prepare(3), mac_set(3), posix1e(3), mac(4), maclabel(7). the whole friend group π«Ά
π STANDARDS π
POSIX.1e is described in IEEE POSIX.1e draft 17. iconic.
π HISTORY π
Support for Mandatory Access Control was introduced in FreeBSD 5.0 as part of the TrustedBSD Project. main character energy from day one π
mwah π β this page is from Debian, dated October 26, 2025, and it's literally MAC_TEXT(3).
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2001 Networks Associates Technology, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms