Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

drv_priv(9F)

Name

drv_priv - determine driver privilege

Synopsis

#include <sys/types.h>
#include <sys/cred.h>
#include <sys/ddi.h>

int drv_priv(cred_t *cr);

Interface Level

Architecture independent level 1 (DDI/DKI).

Parameters

cr

Pointer to the user credential structure.

Description

The drv_priv() function provides a general interface to the system privilege policy. It determines whether the credentials supplied by the user credential structure pointed to by cr identify a process that has the {PRIV_SYS_DEVICES} privilege asserted in its effective set. This function should be used only when file access modes, special minor device numbers, and the device policy (see privileges(7), add_drv(8)) are insufficient to provide protection for the requested driver function. It is intended to replace all calls to suser() and any explicit checks for effective user ID = 0 in driver code.

Return Values

This routine returns 0 if it succeeds, EPERM if it fails.

Context

The drv_priv() function can be called from user, interrupt, or kernel context.

See Also

privileges(7), add_drv(8), update_drv(8)

Writing Device Drivers in Oracle Solaris 11.4