9330 stack overflow when creating a deeply nested dataset
[unleashed.git] / usr / src / man / man3c / priv_addset.3c
blob665216fbf57bd8dcf47452f9f98aedc9ac462ddc
1 '\" te
2 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH PRIV_ADDSET 3C "Sep 08, 2015"
7 .SH NAME
8 priv_addset, priv_allocset, priv_copyset, priv_delset, priv_emptyset,
9 priv_basicset, priv_fillset, priv_freeset, priv_intersect, priv_inverse,
10 priv_isemptyset, priv_isequalset, priv_isfullset, priv_ismember,
11 priv_issubset, priv_union \-
12 privilege set manipulation functions
13 .SH SYNOPSIS
14 .LP
15 .nf
16 #include <priv.h>
18 \fBint\fR \fBpriv_addset\fR(\fBpriv_set_t *\fR\fIsp\fR, \fBconst char *\fR\fIpriv\fR);
19 .fi
21 .LP
22 .nf
23 \fBpriv_set_t *\fR\fBpriv_allocset\fR(\fBvoid\fR);
24 .fi
26 .LP
27 .nf
28 \fBvoid\fR \fBpriv_copyset\fR(\fBconst priv_set_t *\fR\fIsrc\fR, \fBpriv_set_t *\fR\fIdst\fR);
29 .fi
31 .LP
32 .nf
33 \fBint\fR \fBpriv_delset\fR(\fBpriv_set_t *\fR\fIsp\fR, \fBconst char *\fR\fIpriv\fR);
34 .fi
36 .LP
37 .nf
38 \fBvoid\fR \fBpriv_emptyset\fR(\fBpriv_set_t *\fR\fIsp\fR);
39 .fi
41 .LP
42 .nf
43 \fBvoid\fR \fBpriv_basicset\fR(\fBpriv_set_t *\fR\fIsp\fR);
44 .fi
46 .LP
47 .nf
48 \fBvoid\fR \fBpriv_fillset\fR(\fBpriv_set_t *\fR\fIsp\fR);
49 .fi
51 .LP
52 .nf
53 \fBvoid\fR \fBpriv_freeset\fR(\fBpriv_set_t *\fR\fIsp\fR);
54 .fi
56 .LP
57 .nf
58 \fBvoid\fR \fBpriv_intersect\fR(\fBconst priv_set_t *\fR\fIsrc\fR, \fBpriv_set_t *\fR\fIdst\fR);
59 .fi
61 .LP
62 .nf
63 \fBvoid\fR \fBpriv_inverse\fR(\fBpriv_set_t *\fR\fIsp\fR);
64 .fi
66 .LP
67 .nf
68 \fBboolean_t\fR \fBpriv_isemptyset\fR(\fBconst priv_set_t *\fR\fIsp\fR);
69 .fi
71 .LP
72 .nf
73 \fBboolean_t\fR \fBpriv_isequalset\fR(\fBconst priv_set_t *\fR\fIsrc\fR, \fBconst priv_set_t *\fR\fIdst\fR);
74 .fi
76 .LP
77 .nf
78 \fBboolean_t\fR \fBpriv_isfullset\fR(\fBconst priv_set_t *\fR\fIsp\fR);
79 .fi
81 .LP
82 .nf
83 \fBboolean_t\fR \fBpriv_ismember\fR(\fBconst priv_set_t *\fR\fIsp\fR, \fBconst char *\fR\fIpriv\fR);
84 .fi
86 .LP
87 .nf
88 \fBboolean_t\fR \fBpriv_issubset\fR(\fBconst priv_set_t *\fR\fIsrc\fR, \fBconst priv_set_t *\fR\fIdst\fR);
89 .fi
91 .LP
92 .nf
93 \fBvoid\fR \fBpriv_union\fR(\fBconst priv_set_t *\fR\fIsrc\fR, \fBpriv_set_t *\fR\fIdst\fR);
94 .fi
96 .SH DESCRIPTION
97 .LP
98 The \fIsp\fR, \fIsrc\fR, and \fIdst\fR arguments point to privilege sets. The
99 \fIpriv\fR argument points to a named privilege.
102 The \fBpriv_addset()\fR function adds the named privilege \fIpriv\fR to
103 \fIsp\fR.
106 The \fBpriv_allocset()\fR function allocates sufficient memory to contain a
107 privilege set. The value of the returned privilege set is indeterminate. The
108 function returns \fINULL\fR and sets \fBerrno\fR when it fails to allocate
109 memory.
112 The \fBpriv_copyset()\fR function copies the set \fIsrc\fR to \fIdst\fR.
115 The \fBpriv_delset()\fR function removes the named privilege \fIpriv\fR from
116 \fIsp\fR.
119 The \fBpriv_emptyset()\fR function clears all privileges from \fIsp\fR.
122 The \fBpriv_basicset()\fR function copies the basic privilege set to \fIsp\fR.
125 The \fBpriv_fillset()\fR function asserts all privileges in \fIsp\fR, including
126 the privileges not currently defined in the system.
129 The \fBpriv_freeset()\fR function frees the storage allocated by
130 \fBpriv_allocset()\fR.
133 The \fBpriv_intersect()\fR function intersects \fIsrc\fR with \fIdst\fR and
134 places the results in \fIdst\fR.
137 The \fBpriv_inverse()\fR function inverts the privilege set given as argument
138 in place.
141 The \fBpriv_isemptyset()\fR function checks whether the argument is an empty
142 set.
145 The \fBpriv_isequalset()\fR function checks whether the privilege set \fIsrc\fR
146 is equal to \fIdst\fR.
149 The \fBpriv_isfullset()\fR function checks whether the argument is a full set.
150 A full set is a set with all bits set, regardless of whether the privilege is
151 currently defined in the system.
154 The \fBpriv_ismember()\fR function checks whether the named privilege
155 \fIpriv\fR is a member of \fIsp\fR.
158 The \fBpriv_issubset()\fR function checks whether \fIsrc\fR is a subset of
159 \fIdst\fR.
162 The \fBpriv_union()\fR function takes the union of \fIsrc\fR and \fIdst\fR and
163 places the result in \fIdst\fR.
164 .SH RETURN VALUES
166 Upon successful completion, \fBpriv_allocset()\fR returns a pointer to an
167 opaque data structure. It returns \fINULL\fR if memory allocation fails and
168 sets \fBerrno\fR to indicate the error.
171 Upon successful completion, \fBpriv_isemptyset()\fR, \fBpriv_isfullset()\fR,
172 \fBpriv_isequalset()\fR, \fBpriv_issubset()\fR, and \fBpriv_ismember()\fR
173 return \fBB_TRUE\fR. Otherwise, they return \fBB_FALSE\fR.
176 Upon successful completion, \fBpriv_delset()\fR and \fBpriv_addset()\fR return
177 0. Otherwise, they return -1 and set \fBerrno\fR to indicate the error.
178 .SH ERRORS
180 The \fBpriv_allocset()\fR function will fail if:
182 .ne 2
184 \fB\fBENOMEM\fR\fR
186 .RS 10n
187 The physical limits of the system are exceeded by the memory allocation needed
188 to hold a privilege set.
192 .ne 2
194 \fB\fBEAGAIN\fR\fR
196 .RS 10n
197 There is insufficient memory for allocation to hold a privilege set. The
198 application can try again later.
203 The \fBpriv_delset()\fR and \fBpriv_addset()\fR functions will fail if:
205 .ne 2
207 \fB\fBEINVAL\fR\fR
209 .RS 10n
210 The privilege argument is not a valid privilege name.
213 .SH ATTRIBUTES
215 See \fBattributes\fR(5) for descriptions of the following attributes:
220 box;
221 c | c
222 l | l .
223 ATTRIBUTE TYPE  ATTRIBUTE VALUE
225 Interface Stability     Evolving
227 MT-Level        MT-Safe
230 .SH SEE ALSO
232 \fBsetppriv\fR(2), \fBmalloc\fR(3C), \fBpriv_str_to_set\fR(3C),
233 \fBattributes\fR(5), \fBprivileges\fR(5)
234 .SH NOTES
236 The functions that compare sets operate on all bits of the set, regardless of
237 whether the specific privileges are currently defined in the system.