1drv_priv(9F) Kernel Functions for Drivers drv_priv(9F)
2
3
4
6 drv_priv - determine driver privilege
7
9 #include <sys/types.h>
10 #include <sys/cred.h>
11 #include <sys/ddi.h>
12
13
14
15 int drv_priv(cred_t *cr);
16
17
19 Architecture independent level 1 (DDI/DKI).
20
22 cr Pointer to the user credential structure.
23
24
26 The drv_priv() function provides a general interface to the system
27 privilege policy. It determines whether the credentials supplied by the
28 user credential structure pointed to by cr identify a process that has
29 the {PRIV_SYS_DEVICES} privilege asserted in its effective set. This
30 function should be used only when file access modes, special minor
31 device numbers, and the device policy (see privileges(5), add_drv(1M))
32 are insufficient to provide protection for the requested driver func‐
33 tion. It is intended to replace all calls to suser() and any explicit
34 checks for effective user ID = 0 in driver code.
35
37 This routine returns 0 if it succeeds, EPERM if it fails.
38
40 The drv_priv() function can be called from user, interrupt, or kernel
41 context.
42
44 add_drv(1M), update_drv(1M), privileges(5)
45
46
47 Writing Device Drivers
48
49
50
51SunOS 5.11 16 Jan 2006 drv_priv(9F)