MAC_PREPARE(3)
π NAME π
mac_prepare, mac_prepare_type, mac_prepare_file_label, mac_prepare_ifnet_label, mac_prepare_process_label β allocate appropriate storage for mac_t
okay so bestie, this is the MAC_PREPARE(3) page, and it's literally the βget your mac_t storage situation cute and initializedβ manual. No cap. π
β¨ SYNOPSIS β¨
#include <sys/mac.h>
int
mac_prepare(mac_t *mac, const char *elements);
int
mac_prepare_type(mac_t *mac, const char *name);
int
mac_prepare_file_label(mac_t *mac);
int
mac_prepare_ifnet_label(mac_t *mac);
int
mac_prepare_process_label(mac_t *mac);
π DESCRIPTION π
The mac_prepare family of functions allocates the appropriate amount of storage and initializes *mac for use by mac_get(3). When the resulting label is passed into the mac_get(3) functions, the kernel will attempt to fill in the label elements specified when the label was prepared. π«Ά
Elements are specified in a nul-terminated string, using commas to delimit fields. Element names may be prefixed with the ? character to indicate that a failure by the kernel to retrieve that element should not be considered fatal.
TL;DR: that ? prefix is the βdon't panic if this one element failsβ vibe. π
The mac_prepare() function accepts a list of policy names as a parameter, and allocates the storage to fit those label elements accordingly. The remaining functions in the family make use of system defaults defined in mac.conf(5) instead of an explicit elements argument, deriving the default from the specified object type. π¦
mac_prepare_type() allocates the storage to fit an object label of the type specified by the name argument. The mac_prepare_file_label(), mac_prepare_ifnet_label(), and mac_prepare_process_label() functions are equivalent to invocations of mac_prepare_type() with arguments of "file", "ifnet", and "process" respectively. Slay. β¨
π₯ RETURN VALUES π₯
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error. That's the whole plot. π
π¦ SEE ALSO π¦
Go peek at mac(3), mac_free(3), mac_get(3), mac_is_present(3), mac_set(3), mac(4), mac.conf(5), and maclabel(7) β that's the whole friend group. π«Ά
π 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. Support for generic object types first appeared in FreeBSD 5.2. Iconic behavior, honestly. π
mwah π β this page's source/version is Debian, and the date on it is September 21, 2023. Bye bestie! ππΈ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2002, 2003 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