1ddi_cred(9F) Kernel Functions for Drivers ddi_cred(9F)
2
3
4
6 ddi_cred, crgetuid, crgetruid, crgetsuid, crgetgid, crgetrgid, crgets‐
7 gid, crgetzoneid, crgetgroups, crgetngroups - access and change parts
8 of the cred_t structure
9
11 #include <sys/cred.h>
12
13
14
15 uid_t crgetuid(const cred_t *cr);
16
17
18 uid_t crgetruid(const cred_t *cr);
19
20
21 uid_t crgetsuid(const cred_t *cr);
22
23
24 gid_t crgetgid(const cred_t *cr);
25
26
27 gid_t crgetrgid(const cred_t *cr);
28
29
30 gid_t crgetsgid(const cred_t *cr);
31
32
33 zoneid_t crgetzoneid(const cred_t *cr);
34
35
36 const gid_t *crgetgroups(const cred_t *cr);
37
38
39 int crgetngroups(const cred_t *cr);
40
41
42 int crsetresuid(cred_t *cr, uid_t ruid, uid_t euid, uid_t suid);
43
44
45 int crsetresgid(cred_t *cr, gid_t rgid, gid_t egid, gid_t sgid);
46
47
48 int crsetugid(cred_t *cr, uid_t uid, gid_t gid);
49
50
51 int crsetgroups(cred_t *cr, int ngroups, gid_t gids);
52
53
55 Solaris DDI specific (Solaris DDI).
56
58 cr pointer to the user credential structure
59
60
61 uid, ruid, euid, suid new user id, real, effective and saved user id
62
63
64 gid, rgid, egid, sgid new group id, real, effective and saved group
65 id
66
67
68 ngroups number of groups in the group array
69
70
71 gids pointer to array of new groups
72
73
75 The user credential is a shared, read-only, ref-counted data structure.
76 Its actual size and layout are subject to change. The functions
77 described in this page allow the programmer to retrieve fields from the
78 structure and to initialize newly allocated credential structures.
79
80
81 crgetuid(), crgetruid(), and crgetsuid() return, respectively, the
82 effective, real, and saved user id from the user credential pointed to
83 by cr.
84
85
86 crgetgid(), crgetrgid(), and crgetsgid() return, respectively, the
87 effective, real, and saved group id from the user credential pointed to
88 by cr.
89
90
91 crgetzoneid() returns the zone id from the user credential pointed to
92 by cr.
93
94
95 crgetgroups() returns the group list of the user credential pointed to
96 by cr.
97
98
99 crgetngroups() returns the number of groups in the user credential
100 pointed to by cr.
101
102
103 crsetresuid() sets the real, effective and saved user id. All but one
104 can be specified as -1, which causes the original value not to change.
105
106
107 crsetresgid() sets the real, effective and saved group id. All but one
108 can be specified as -1, which causes the original value not to change.
109
110
111 crsetugid() initializes the real, effective and saved user id all to
112 uid. It initializes the real, effective, and saved group id all to gid.
113
114
115 crsetgroups() sets the number of groups in the user credential to
116 ngroups and copies the groups from gids to the user credential. If
117 ngroups is 0, gids need not point to valid storage.
118
119
120 It is an error to call this any of the crset*() functions on a user
121 credential structure that was newly allocated.
122
124 The crget*() functions return the requested information.
125
126
127 The crset*id() functions return 0 on success and -1 if any of the spec‐
128 ified ids are invalid. The functions might cause a system panic if
129 called on a user credential structure that is referenced by other parts
130 of the system.
131
133 These functions can be called from user and kernel contexts.
134
136 See attributes(5) for a description of the following attributes:
137
138
139
140
141 ┌─────────────────────────────┬─────────────────────────────┐
142 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
143 ├─────────────────────────────┼─────────────────────────────┤
144 │Architecture │All │
145 ├─────────────────────────────┼─────────────────────────────┤
146 │Interface Stability │Committed │
147 └─────────────────────────────┴─────────────────────────────┘
148
150 attributes(5), privileges(5), drv_priv(9F)
151
152
153 Writing Device Drivers
154
155
156
157SunOS 5.11 6 Aug 2003 ddi_cred(9F)