DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

drv_priv(D3)


drv_priv -- determine whether credentials are privileged

Synopsis

   int drv_priv(cred_t *crp);

Description

The drv_priv function determines whether the credentials specified by the credential structure pointed to by crp identify a privileged process.

Arguments


crp
Pointer to the user credential structure.

Return values

drv_prv( ) returns 0 if the specified credentials identify a privileged process and EPERM otherwise.

Usage

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 the open(D2), close(D2), read(D2), write(D2), and ioctl(D2) entry point routines and can also be obtained by calling the drv_getparm(D3) function.

Context and synchronization

User context.

Warnings

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 and a driver may not examine the contents of the structure directly.

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

SCO OpenServer ODDI compatibility

Use the suser(D3oddi) function to determine if the current user is the superuser in SCO OpenServer ODDI drivers. SCO OpenServer does not use a credential structure so some other recoding may be required around the use of this function.
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005