drv_priv(D3DK) —
.IX \f4drv_priv\fP(D3DK)
NAME
drv_priv − determine whether credentials are privileged
SYNOPSIS
int drv_priv(cred_t ∗crp);
ARGUMENTS
crpPointer to the user credential structure.
DESCRIPTION
The drv_priv function determines whether the credentials specified by the credential structure pointed to by crp identify a privileged process. This function should only be used when file access modes and special minor device numbers are insufficient to provide the necessary protection for the driver operation being performed. Calls to drv_priv should replace all calls to suser and any explicit checks for effective user ID equal to zero in driver code.
A credential structure pointer is passed into various driver entry point functions (open(D2DK), close(D2DK), read(D2DK), write(D2DK), and ioctl(D2DK)) and can also be obtained by calling drv_getparm(D3DK) from base level driver code.
RETURN VALUE
This routine returns 0 if the specified credentials identify a privileged process and EPERM otherwise.
LEVEL
Base or Interrupt.
NOTES
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function.
The only valid use for a credential structure pointer is as an argument to drv_priv. The contents of a credential structure are not defined by the DDI/DKI and a driver may not examine the contents of the structure directly.
DDI/DKI