Writing Device Drivers

Device Access

These interfaces verify the credentials of application threads making system calls into drivers. They are sometimes used in the open(9E) entry point to restrict access to a device, though this is usually achieved with the permissions on the special files in the file system.

int drv_priv(cred_t *credp);
drv_priv(9F) returns zero if the credential structure pointed to by credp is that of a privileged thread. It returns EPERM otherwise. Use drv_priv(9F) only in place of calls to the obsolete suser() function and when making explicit checks of a calling thread's UID.

cred_t *ddi_get_cred (void);
ddi_get_cred(9F) returns a pointer to the user credential structure of the the caller.