PRIV_ADDSET(3C) Standard C Library Functions PRIV_ADDSET(3C)

NAME

priv_addset, priv_allocset, priv_copyset, priv_delset, priv_emptyset, priv_basicset, priv_defaultset, priv_fillset, priv_freeset, priv_intersect, priv_inverse, priv_isemptyset, priv_isequalset, priv_isfullset, priv_ismember, priv_issubset, priv_union - privilege set manipulation functions

SYNOPSIS


#include <priv.h>

int priv_addset(priv_set_t *sp, const char *priv);
 

priv_set_t *priv_allocset(void);
 

void priv_copyset(const priv_set_t *src, priv_set_t *dst);
 

int priv_delset(priv_set_t *sp, const char *priv);
 

void priv_emptyset(priv_set_t *sp);
 

void priv_basicset(priv_set_t *sp);
 

void priv_defaultset(priv_set_t *sp);
 

void priv_fillset(priv_set_t *sp);
 

void priv_freeset(priv_set_t *sp);
 

void priv_intersect(const priv_set_t *src, priv_set_t *dst);
 

void priv_inverse(priv_set_t *sp);
 

boolean_t priv_isemptyset(const priv_set_t *sp);
 

boolean_t priv_isequalset(const priv_set_t *src, const priv_set_t *dst);
 

boolean_t priv_isfullset(const priv_set_t *sp);
 

boolean_t priv_ismember(const priv_set_t *sp, const char *priv);
 

boolean_t priv_issubset(const priv_set_t *src, const priv_set_t *dst);
 

void priv_union(const priv_set_t *src, priv_set_t *dst);
 

DESCRIPTION

The sp, src, and dst arguments point to privilege sets. The priv argument points to a named privilege.
 
The priv_addset() function adds the named privilege priv to sp.
 
The priv_allocset() function allocates sufficient memory to contain a privilege set. The value of the returned privilege set is indeterminate. The function returns NULL and sets errno when it fails to allocate memory.
 
The priv_copyset() function copies the set src to dst.
 
The priv_delset() function removes the named privilege priv from sp.
 
The priv_emptyset() function clears all privileges from sp.
 
The priv_basicset() function copies the basic privilege set to sp.
 
The priv_defaultset() function copies the default privilege set to sp.
 
The priv_fillset() function asserts all privileges in sp, including the privileges not currently defined in the system.
 
The priv_freeset() function frees the storage allocated by priv_allocset().
 
The priv_intersect() function intersects src with dst and places the results in dst.
 
The priv_inverse() function inverts the privilege set given as argument in place.
 
The priv_isemptyset() function checks whether the argument is an empty set.
 
The priv_isequalset() function checks whether the privilege set src is equal to dst.
 
The priv_isfullset() function checks whether the argument is a full set. A full set is a set with all bits set, regardless of whether the privilege is currently defined in the system.
 
The priv_ismember() function checks whether the named privilege priv is a member of sp.
 
The priv_issubset() function checks whether src is a subset of dst.
 
The priv_union() function takes the union of src and dst and places the result in dst.

RETURN VALUES

Upon successful completion, priv_allocset() returns a pointer to an opaque data structure. It returns NULL if memory allocation fails and sets errno to indicate the error.
 
Upon successful completion, priv_isemptyset(), priv_isfullset(), priv_isequalset(), priv_issubset(), and priv_ismember() return B_TRUE. Otherwise, they return B_FALSE.
 
Upon successful completion, priv_delset() and priv_addset() return 0. Otherwise, they return -1 and set errno to indicate the error.

ERRORS

The priv_allocset() function will fail if:
 
ENOMEM
The physical limits of the system are exceeded by the memory allocation needed to hold a privilege set.
 
 
EAGAIN
There is insufficient memory for allocation to hold a privilege set. The application can try again later.
 
 
The priv_delset() and priv_addset() functions will fail if:
 
EINVAL
The privilege argument is not a valid privilege name.
 

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:
 
 
 
ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
 

SEE ALSO

setppriv(2), malloc(3C), priv_str_to_set(3C), attributes(5), privileges(5)

NOTES

The functions that compare sets operate on all bits of the set, regardless of whether the specific privileges are currently defined in the system.
September 8, 2015