man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2014
 
 

priv_getbyname(9F)

Name

priv_getbyname - map a privilege name to a number

Synopsis

#include <sys/cred.h>

int priv_getbyname(const char  *priv, int flags);

Interface Level

Solaris DDI specific (Solaris DDI).

Parameters

priv

name of the privilege

flags

flags, must be zero or PRIV_ALLOC

Description

The priv_getbyname() function maps a privilege name to a privilege number for use with the priv_*() kernel interfaces.

If PRIV_ALLOC is passed as a flag parameter, an attempt is made to allocate a privilege if it is not yet defined. The newly allocated privilege number is returned.

Privilege names can be specified with an optional priv_ prefix, which is stripped.

Privilege names are case insensitive but allocated privileges preserve case.

Allocated privileges can be at most {PRIVNAME_MAX} characters long and can contain only alphanumeric characters and the underscore character.

Return Values

This function returns the privilege number, which is greater than or equal to 0, if it succeeds. It returns a negative error number if an error occurs.

Errors

EINVAL

This might be caused by any of the following

  • The flags parameter is invalid.

  • The specified privilege does not exist.

  • The priv parameter contains invalid characters.

ENOMEM

There is no room to allocate another privilege.

ENAMETOOLONG

An attempt was made to allocate a privilege that was longer than {PRIVNAME_MAX} characters.

Context

This functions can be called from user and kernel contexts.

Attributes

See attributes(5) for a description of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Architecture
All
Interface Stability
Committed

See also

attributes(5), privileges(5)

Writing Device Drivers for Oracle Solaris 11.2