1priv_getbyname(9F)       Kernel Functions for Drivers       priv_getbyname(9F)
2
3
4

NAME

6       priv_getbyname - map a privilege name to a number
7

SYNOPSIS

9       #include <sys/cred.h>
10
11
12
13       int priv_getbyname(const char  *priv, int flags);
14
15

INTERFACE LEVEL

17       Solaris DDI specific (Solaris DDI).
18

PARAMETERS

20       priv     name of the privilege
21
22
23       flags    flags, must be zero or PRIV_ALLOC
24
25

DESCRIPTION

27       The priv_getbyname() function maps a privilege name to a privilege num‐
28       ber for use with the priv_*() kernel interfaces.
29
30
31       If PRIV_ALLOC is passed as a flag parameter,  an  attempt  is  made  to
32       allocate  a  privilege  if  it  is not yet defined. The newly allocated
33       privilege number is returned.
34
35
36       Privilege names can be specified with an optional priv_  prefix,  which
37       is stripped.
38
39
40       Privilege  names are case insensitive but allocated privileges preserve
41       case.
42
43
44       Allocated privileges can be at most {PRIVNAME_MAX} characters long  and
45       can contain only alphanumeric characters and the underscore character.
46

RETURN VALUES

48       This  function  returns  the privilege number, which is greater than or
49       equal to 0, if it succeeds. It returns a negative error  number  if  an
50       error occurs.
51

ERRORS

53       EINVAL          This might be caused by any of the following
54
55                           o      The flags parameter is invalid.
56
57                           o      The specified privilege does not exist.
58
59                           o      The  priv parameter contains invalid charac‐
60                                  ters.
61
62
63       ENOMEM          There is no room to allocate another privilege.
64
65
66       ENAMETOOLONG    An attempt was made to allocate a  privilege  that  was
67                       longer than {PRIVNAME_MAX} characters.
68
69

CONTEXT

71       This functions can be called from user and kernel contexts.
72

ATTRIBUTES

74       See attributes(5) for a description of the following attributes:
75
76
77
78
79       ┌─────────────────────────────┬─────────────────────────────┐
80ATTRIBUTE TYPE         ATTRIBUTE VALUE        
81       ├─────────────────────────────┼─────────────────────────────┤
82       │Architecture                 │All                          │
83       ├─────────────────────────────┼─────────────────────────────┤
84       │Interface Stability          │Committed                    │
85       └─────────────────────────────┴─────────────────────────────┘
86

SEE ALSO

88       attributes(5), privileges(5)
89
90
91       Writing Device Drivers
92
93
94
95SunOS 5.11                        11 Mar 2004               priv_getbyname(9F)
Impressum