Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

priv_getbyname(9f) [opensolaris man page]

priv_getbyname(9F)					   Kernel Functions for Drivers 					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 priv- ilege 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 charac- ter. 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 o The flags parameter is invalid. o The specified privilege does not exist. o 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 SunOS 5.11 11 Mar 2004 priv_getbyname(9F)

Check Out this Related Man Page

priv_policy(9F) 					   Kernel Functions for Drivers 					   priv_policy(9F)

NAME
priv_policy, priv_policy_only, priv_policy_choice - check, report, and audit privileges SYNOPSIS
#include <sys/cred.h> int priv_policy(const cred_t *cr, int priv, int err, const char *msg); int priv_policy_only(const cred_t *cr, int priv); int priv_policy_choice(const cred_t *cr, int priv); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
cr The credential to be checked. priv The integer value of the privilege to test. err The error code to return. msg String that is added to the privilege debugging message if one is generated. NULL if no additional information is needed. Because the function name is included in the output, NULL is usually the best value to pass as a parameter. DESCRIPTION
These functions aid in privilege checking and privilege debugging. priv_policy(), priv_policy_only(), and priv_policy_choice() all check whether priv is asserted in the effective set of the credential. The special value PRIV_ALL tests for all privileges. priv_policy() updates the ASU accounting flag and records the privilege used on success in the audit trail if the required privilege was not a basic privilege. priv_policy_only() checks whether a privilege is asserted and has no side effects. priv_policy_choice() behaves like priv_policy_only() but records the successfully used non-basic privileges in the audit trail. RETURN VALUES
On success, priv_policy() return 0. On failure it returns its parameter err. On success, priv_policy_choice() and priv_policy_only() return 1, on failure both return 0. ERRORS
EINVAL This might be caused by any of the following: o The flags parameter is invalid. o The specified privilege does not exist. o 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 or interrupt context. ATTRIBUTES
See attributes(5) for a description of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
acct(3HEAD), attributes(5), privileges(5) Writing Device Drivers SunOS 5.10 9 Dec 2002 priv_policy(9F)
Man Page