Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man9f / priv_getbyname.9f
blobb817b0d7f300e680cb5d3f7c281a7a6412a9f866
1 '\" te
2 .\"  Copyright (c) 2004, 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_GETBYNAME 9F "Mar 11, 2004"
7 .SH NAME
8 priv_getbyname \- map a privilege name to a number
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/cred.h>
16 \fBint\fR \fBpriv_getbyname\fR(\fBconst char  *\fR\fIpriv\fR, \fBint\fR \fIflags\fR);
17 .fi
19 .SH INTERFACE LEVEL
20 .sp
21 .LP
22 Solaris DDI specific (Solaris DDI).
23 .SH PARAMETERS
24 .sp
25 .ne 2
26 .na
27 \fB\fIpriv\fR\fR
28 .ad
29 .RS 9n
30 name of the privilege
31 .RE
33 .sp
34 .ne 2
35 .na
36 \fB\fIflags\fR\fR
37 .ad
38 .RS 9n
39 flags, must be zero or \fBPRIV_ALLOC\fR
40 .RE
42 .SH DESCRIPTION
43 .sp
44 .LP
45 The \fBpriv_getbyname()\fR function maps a privilege name to a privilege number
46 for use with the \fBpriv_*()\fR kernel interfaces.
47 .sp
48 .LP
49 If \fBPRIV_ALLOC\fR is passed as a flag parameter, an attempt is made to
50 allocate a privilege if it is not yet defined. The newly allocated privilege
51 number is returned.
52 .sp
53 .LP
54 Privilege names can be specified with an optional \fBpriv_\fR prefix, which is
55 stripped.
56 .sp
57 .LP
58 Privilege names are case insensitive but allocated privileges preserve case.
59 .sp
60 .LP
61 Allocated privileges can be at most \fB{PRIVNAME_MAX}\fR characters long and
62 can contain only alphanumeric characters and the underscore character.
63 .SH RETURN VALUES
64 .sp
65 .LP
66 This function returns the privilege number, which is greater than or equal to
67 0, if it succeeds. It returns a negative error number if an error occurs.
68 .SH ERRORS
69 .sp
70 .ne 2
71 .na
72 \fB\fBEINVAL\fR\fR
73 .ad
74 .RS 16n
75 This might be caused by any of the following
76 .RS +4
77 .TP
78 .ie t \(bu
79 .el o
80 The \fIflags\fR parameter is invalid.
81 .RE
82 .RS +4
83 .TP
84 .ie t \(bu
85 .el o
86 The specified privilege does not exist.
87 .RE
88 .RS +4
89 .TP
90 .ie t \(bu
91 .el o
92 The \fIpriv\fR parameter contains invalid characters.
93 .RE
94 .RE
96 .sp
97 .ne 2
98 .na
99 \fB\fBENOMEM\fR\fR
101 .RS 16n
102 There is no room to allocate another privilege.
106 .ne 2
108 \fB\fBENAMETOOLONG\fR\fR
110 .RS 16n
111 An attempt was made to allocate a privilege that was longer than
112 \fB{PRIVNAME_MAX}\fR characters.
115 .SH CONTEXT
118 This functions can be called from user and kernel contexts.
119 .SH ATTRIBUTES
122 See \fBattributes\fR(5) for a description of the following attributes:
127 box;
128 c | c
129 l | l .
130 ATTRIBUTE TYPE  ATTRIBUTE VALUE
132 Architecture    All
134 Interface Stability     Committed
137 .SH SEE ALSO
140 \fBattributes\fR(5), \fBprivileges\fR(5)
143 \fIWriting Device Drivers\fR