.TH drv_priv() "" "" "DDI/DKI Kernel Routine"
.PC "Check if a user has privileged credentials"
.B "#include <sys/types.h>"
.B "#include <sys/ddi.h>"
\fBint drv_priv(\fIcredentials\^\fB)\fR
\fBcred_t *\fIcredentials\^\fB;\fR
.PP
.B drv_priv()
checks whether
.I credentials
identifies a process that is owned by a privileged user.
Use this function only when file permissions and
special minor-device numbers cannot guard the driver sufficiently.
.PP
The kernel passes a pointer to a credential structure
to various entry-points into the driver (i.e.,
.BR open ,
.BR close ,
.BR read ,
and
.BR ioctl ).
You can also obtain it by calling
.B drv_getparm()
from base-level driver code.
.PP
If
.I credentials
shows that the process is owned by a privileged user,
.B drv_priv()
returns zero; otherwise it returns
.BR EPERM .
.SH "See Also"
.B
DDI/DKI kernel routines,
drv_getparm()
.R
.SH Notes
.B drv_priv()
has base or interrupt levels.
It does not sleep.
.PP
A driver can hold a
driver-defined basic lock, read/write lock, or sleep lock
across a call to this function.
