privileged(9r)privileged(9r)NAMEprivileged - General: Checks for proper privileges
SYNOPSIS
int privileged(
int privilege,
int error_code );
ARGUMENTS
Specifies the privilege to check against. This privilege must be one of
the constants defined in /usr/sys/include/sys/security.h. For example,
you would specify SEC_FILESYS for disk drivers that must manipulate
partition tables on disk drives. Specifies the value used to control
auditing. You can pass one of the system's error codes or one of the
following values: -1, 0, 1. An example of an error code is the con‐
stant EPERM.
DESCRIPTION
The privileged routine checks for an appropriate privilege when the
security feature is enabled. Use privileged with a privilege number
and with the error_code argument set to the constant EPERM to emulate
the traditional behavior of the suser routine. Set error_code to a
value of 0 (zero) if you want to check the privilege but not fail the
operation if the user does not have the proper privilege. A value of -1
turns off all auditing as well.
RETURN VALUES
The privileged routine returns the value 0 (zero) if the process does
not have privilege. It returns the value 1 if the process does have
privilege.
FILESSEE ALSO
Routines: suser(9r)privileged(9r)