1 PRIV_ADDSET(3C) Standard C Library Functions PRIV_ADDSET(3C) 2 3 4 5 NAME 6 priv_addset, priv_allocset, priv_copyset, priv_delset, priv_emptyset, 7 priv_basicset, priv_defaultset, priv_fillset, priv_freeset, 8 priv_intersect, priv_inverse, priv_isemptyset, priv_isequalset, 9 priv_isfullset, priv_ismember, priv_issubset, priv_union - privilege 10 set manipulation functions 11 12 SYNOPSIS 13 #include <priv.h> 14 15 int priv_addset(priv_set_t *sp, const char *priv); 16 17 18 priv_set_t *priv_allocset(void); 19 20 21 void priv_copyset(const priv_set_t *src, priv_set_t *dst); 22 23 24 int priv_delset(priv_set_t *sp, const char *priv); 25 26 27 void priv_emptyset(priv_set_t *sp); 28 29 30 void priv_basicset(priv_set_t *sp); 31 32 33 void priv_defaultset(priv_set_t *sp); 34 35 36 void priv_fillset(priv_set_t *sp); 37 38 39 void priv_freeset(priv_set_t *sp); 40 41 42 void priv_intersect(const priv_set_t *src, priv_set_t *dst); 43 44 45 void priv_inverse(priv_set_t *sp); 46 47 48 boolean_t priv_isemptyset(const priv_set_t *sp); 49 50 51 boolean_t priv_isequalset(const priv_set_t *src, const priv_set_t *dst); 52 53 54 boolean_t priv_isfullset(const priv_set_t *sp); 55 56 57 boolean_t priv_ismember(const priv_set_t *sp, const char *priv); 58 59 60 boolean_t priv_issubset(const priv_set_t *src, const priv_set_t *dst); 61 62 63 void priv_union(const priv_set_t *src, priv_set_t *dst); 64 65 66 DESCRIPTION 67 The sp, src, and dst arguments point to privilege sets. The priv 68 argument points to a named privilege. 69 70 71 The priv_addset() function adds the named privilege priv to sp. 72 73 74 The priv_allocset() function allocates sufficient memory to contain a 75 privilege set. The value of the returned privilege set is 76 indeterminate. The function returns NULL and sets errno when it fails 77 to allocate memory. 78 79 80 The priv_copyset() function copies the set src to dst. 81 82 83 The priv_delset() function removes the named privilege priv from sp. 84 85 86 The priv_emptyset() function clears all privileges from sp. 87 88 89 The priv_basicset() function copies the basic privilege set to sp. 90 91 92 The priv_defaultset() function copies the default privilege set to sp. 93 94 95 The priv_fillset() function asserts all privileges in sp, including the 96 privileges not currently defined in the system. 97 98 99 The priv_freeset() function frees the storage allocated by 100 priv_allocset(). 101 102 103 The priv_intersect() function intersects src with dst and places the 104 results in dst. 105 106 107 The priv_inverse() function inverts the privilege set given as argument 108 in place. 109 110 111 The priv_isemptyset() function checks whether the argument is an empty 112 set. 113 114 115 The priv_isequalset() function checks whether the privilege set src is 116 equal to dst. 117 118 119 The priv_isfullset() function checks whether the argument is a full 120 set. A full set is a set with all bits set, regardless of whether the 121 privilege is currently defined in the system. 122 123 124 The priv_ismember() function checks whether the named privilege priv is 125 a member of sp. 126 127 128 The priv_issubset() function checks whether src is a subset of dst. 129 130 131 The priv_union() function takes the union of src and dst and places the 132 result in dst. 133 134 RETURN VALUES 135 Upon successful completion, priv_allocset() returns a pointer to an 136 opaque data structure. It returns NULL if memory allocation fails and 137 sets errno to indicate the error. 138 139 140 Upon successful completion, priv_isemptyset(), priv_isfullset(), 141 priv_isequalset(), priv_issubset(), and priv_ismember() return B_TRUE. 142 Otherwise, they return B_FALSE. 143 144 145 Upon successful completion, priv_delset() and priv_addset() return 0. 146 Otherwise, they return -1 and set errno to indicate the error. 147 148 ERRORS 149 The priv_allocset() function will fail if: 150 151 ENOMEM 152 The physical limits of the system are exceeded by the memory 153 allocation needed to hold a privilege set. 154 155 156 EAGAIN 157 There is insufficient memory for allocation to hold a 158 privilege set. The application can try again later. 159 160 161 162 The priv_delset() and priv_addset() functions will fail if: 163 164 EINVAL 165 The privilege argument is not a valid privilege name. 166 167 168 ATTRIBUTES 169 See attributes(5) for descriptions of the following attributes: 170 171 172 173 174 +--------------------+-----------------+ 175 | ATTRIBUTE TYPE | ATTRIBUTE VALUE | 176 +--------------------+-----------------+ 177 |Interface Stability | Evolving | 178 +--------------------+-----------------+ 179 |MT-Level | MT-Safe | 180 +--------------------+-----------------+ 181 182 SEE ALSO 183 setppriv(2), malloc(3C), priv_str_to_set(3C), attributes(5), 184 privileges(5) 185 186 NOTES 187 The functions that compare sets operate on all bits of the set, 188 regardless of whether the specific privileges are currently defined in 189 the system. 190 191 192 193 September 8, 2015 PRIV_ADDSET(3C)