1
0
Files
2022-09-29 17:59:04 +03:00

65 lines
1.8 KiB
Plaintext

'\"macro stdmacro
.if n .pH g3C.mac_from_text
.nr X
.if \nX=0 .ds x} MAC_FROM_TEXT 3C "POSIX MAC Support" "\&"
.if \nX=1 .ds x} MAC_FROM_TEXT 3C "POSIX MAC Support"
.if \nX=2 .ds x} MAC_FROM_TEXT 3C "" "\&"
.if \nX=3 .ds x} MAC_FROM_TEXT "" "" "\&"
.TH \*(x}
.SH NAME
mac_from_text, mac_to_text, mac_to_text_long \- convert a POSIX MAC string from/to mac_t
.SH SYNOPSIS
.B #include <sys/mac.h>
.PP
.B mac_t mac_from_text(const char *argp);
.br
.B char * mac_to_text(mac_t macp, size_t *len_p);
.br
.B char * mac_to_text_long(mac_t macp, size_t *len_p);
.SH DESCRIPTION
These routines convert MAC labels
from/to a \f2mac_t\fP, the structure representing an object's MAC attributes
in the POSIX P1003.1e specifications.
.SH RETURN VALUES
\f2mac_from_text\fP returns a \f2mac_t\fP, a pointer to an allocated \f2struct mac_label\fP
or a NULL pointer in the case of a failure.
The \f2mac_t\fP should be freed when no longer needed by calling
.IR mac_free (3c).
.PP
\f2mac_to_text\fP returns a pointer to a null terminated
character string allocated by the routine which is
a short form representation of the MAC label, or a NULL pointer if an error
occurred. This string should be freed when no longer needed by calling
.IR mac_free (3c).
If the \f2len_p\fP argument is not NULL, then the length of the string
is returned in \f2ssize_t\fP pointed to by \f2len_p\fP.
.PP
\f2mac_to_text_long\fP is identical to \f2mac_to_text\fP, except that a
long form representation of the MAC label is returned.
.SH ERRORS
.I mac_from_text:
.TP 16
EINVAL
input text is invalid
.TP 16
ENOMEM
could not allocate space for new label
.PP
.I mac_to_text:
.TP 16
EINVAL
input label is invalid
.TP 16
ENOMEM
could not allocate space for the return string
.PP
.I mac_to_text_long:
.TP 16
EINVAL
input label is invalid
.TP 16
ENOMEM
could not allocate space for the return string
.SH "SEE ALSO"
mac_equal(3C)