remove csh(1)
[unleashed.git] / share / man / man3c / priv_set.3c
blob97b1729ed8564cf782e21cf031afa1e7c09ab6d6
1 '\" te
2 .\" Copyright (c) 2003, 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_SET 3C "Sep 25, 2003"
7 .SH NAME
8 priv_set, priv_ineffect \- change privilege sets and check whether privileges
9 are set
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <priv.h>
15 \fBint\fR \fBpriv_set\fR(\fBpriv_op_t\fR \fIop\fR, \fBpriv_ptype_t\fR  \fIwhich\fR...);
16 .fi
18 .LP
19 .nf
20 \fBboolean_t\fR \fBpriv_ineffect\fR(\fBconst char *\fR\fIpriv\fR);
21 .fi
23 .SH DESCRIPTION
24 .sp
25 .LP
26 The \fBpriv_set()\fR function is a convenient wrapper for the \fBsetppriv\fR(2)
27 function. It takes three or more arguments. The operation argument, \fIop\fR,
28 can be one of \fBPRIV_OFF\fR, \fBPRIV_ON\fR or \fBPRIV_SET\fR. The \fIwhich\fR
29 argument is the name of the privilege set to change. The third argument is a
30 list of zero or more privilege names terminated with a null pointer. If
31 \fIwhich\fR is the special pseudo set \fBPRIV_ALLSETS\fR, the operation should
32 be applied to all privilege sets.
33 .sp
34 .LP
35 The specified privileges are converted to a binary privilege set and
36 \fBsetppriv()\fR is called with the same \fIop\fR and \fIwhich\fR arguments.
37 When called with \fBPRIV_ALLSETS\fR as the value for the \fIwhich\fR argument,
38 \fBsetppriv()\fR is called for each set in turn, aborting on the first failed
39 call.
40 .sp
41 .LP
42 The \fBpriv_ineffect()\fR function is a conventient wrapper for the
43 \fBgetppriv\fR(2) function. The \fIpriv\fR argument specifies the name of the
44 privilege for which this function checks its presence in the effective set.
45 .SH RETURN VALUES
46 .sp
47 .LP
48 Upon successful completion, \fBpriv_set()\fR return 0. Otherwise, -1  is
49 returned and \fBerrno\fR is set to indicate the error.
50 .sp
51 .LP
52 If \fIpriv\fR is a valid privilege that is a member of the effective set,
53 \fBpriv_ineffect()\fR returns \fBB_TRUE\fR. Otherwise, it returns \fBB_FALSE\fR
54 and sets \fBerrno\fR to incicate the error.
55 .SH ERRORS
56 .sp
57 .LP
58 The \fBpriv_set()\fR function will fail if:
59 .sp
60 .ne 2
61 .na
62 \fB\fBEINVAL\fR\fR
63 .ad
64 .RS 10n
65 The value of \fIop\fR or \fIwhich\fR is out of range.
66 .RE
68 .sp
69 .ne 2
70 .na
71 \fB\fBENOMEM\fR\fR
72 .ad
73 .RS 10n
74 Insufficient memory was allocated.
75 .RE
77 .sp
78 .ne 2
79 .na
80 \fB\fBEPERM\fR\fR
81 .ad
82 .RS 10n
83 The application attempted to add privileges to \fBPRIV_LIMIT\fR or
84 \fBPRIV_PERMITTED\fR, or the application attempted to add privileges to
85 \fBPRIV_INHERITABLE\fR or \fBPRIV_EFFECTIVE\fR that were not in
86 \fBPRIV_PERMITTED\fR.
87 .RE
89 .sp
90 .LP
91 The \fBpriv_ineffect()\fR function will fail if:
92 .sp
93 .ne 2
94 .na
95 \fB\fBEINVAL\fR\fR
96 .ad
97 .RS 10n
98 The privilege specified by \fIpriv\fR is invalid.
99 .RE
102 .ne 2
104 \fB\fBENOMEM\fR\fR
106 .RS 10n
107 Insufficient memory was allocated.
110 .SH ATTRIBUTES
113 See \fBattributes\fR(5) for descriptions of the following attributes:
118 box;
119 c | c
120 l | l .
121 ATTRIBUTE TYPE  ATTRIBUTE VALUE
123 Interface Stability     Evolving
125 MT-Level        MT-Safe
128 .SH SEE ALSO
131 \fBsetppriv\fR(2), \fBpriv_str_to_set\fR(3C), \fBattributes\fR(5),
132 \fBprivileges\fR(5)