mac_text(3)

mac_text3

Convert mac label to/from text representation

Usage

#include <sys/mac.h>

int

mac_from_text(mac_t *mac, const char *text);

int

mac_to_text(mac_t label, char **text);

Library

Standard C Library (libc, -lc)

Overview

The mac_from_text() function converts the text representation of a label into the internal policy label format (mac_t) and places it in *mac, which must later be freed with mac_free(3).

The mac_to_text() function allocates storage for *text, which will be set to the text representation of label and must later be freed with free(3).

Refer to maclabel(7) for the MAC label format.

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.

Compatibility

POSIX.1e does not define a format for text representations of MAC labels.

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.

Errors

[ENOMEM]

Insufficient memory was available to allocate internal storage.

Releases

56 releases since FreeBSD 5.0-RELEASE; the text changed 40 times.

  1. 5.0
  2. 5.1
  3. 5.2–5.2.1
  4. 5.3–6.3
  5. 6.4
  6. 7.0
  7. 7.1
  8. 7.2
  9. 7.3
  10. 7.4
  11. 8.0
  12. 8.1
  13. 8.2
  14. 8.3
  15. 8.4
  16. 9.0
  17. 9.1
  18. 9.2
  19. 9.3
  20. 10.0
  21. 10.1
  22. 10.2
  23. 10.3
  24. 10.4
  25. 11.0
  26. 11.1
  27. 11.2
  28. 11.3
  29. 11.4
  30. 12.0
  31. 12.1
  32. 12.2
  33. 12.3
  34. 12.4
  35. 13.0–13.2
  36. 13.3–13.5
  37. 14.0
  38. 14.1–14.3
  39. 14.4–14.5
  40. 15.0
  41. 15.1–16.0

Standards

POSIX.1e is described in IEEE POSIX.1e draft 17.

History

Support for Mandatory Access Control was introduced in FreeBSD 5.0 as part of the TrustedBSD Project.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.