![]() |
![]()
| ![]() |
![]()
NAME
SYNOPSIS
int
int
DESCRIPTIONThe Privilege PoliciesPrivileges are typically granted based on one of two base system policies: the superuser policy, which grants privilege based on the effective (or sometimes real) UID having a value of 0, and the jail(2) policy, which permits only certain privileges to be granted to processes in a jail. The set of available privileges may also be influenced by the TrustedBSD MAC Framework, described in mac(9). IMPLEMENTATION NOTESWhen adding a new privilege check to a code path, first check the
complete list of current privileges in sys/priv.h to
see if one already exists for the class of privilege required. Only if there
is not an exact match should a new privilege be added to the privilege list.
As privilege numbers becomes encoded in the kernel module ABI, privilege
constants must not be changed as any kernel modules depending on privileges
will then need to be recompiled. When adding a new privilege, be certain to
also determine whether it should be listed in
Certain catch-all privileges exist, such as
RETURN VALUESTypically, 0 will be returned for success, and
When designing new APIs, it is preferable to return explicit errors from a call if privilege is not granted rather than changing the semantics of the call but returning success. For example, the behavior exhibited by stat(2), in which the generation field is optionally zero'd out when there is insufficient privilege is highly undesirable, as it results in frequent privilege checks, and the caller is unable to tell if an access control failure occurred. SEE ALSOAUTHORSThe
|