The main function for setting privileges is setppriv(), which has the following syntax:
int setppriv(priv_op_t op, priv_ptype_t which, \ const priv_set_t *set);
op represents the privilege operation that is to be performed. The op parameter has one of three possible values:
PRIV_ON – Adds the privileges that are specified by the set variable to the set type that is specified by which
PRIV_OFF – Removes the privileges that are specified by the set variable from the set type that is specified by which
PRIV_SET – Uses the privileges that are specified by the set variable to replace privileges in the set type that is specified by which
which specifies the type of privilege set to be changed, as follows:
PRIV_PERMITTED
PRIV_EFFECTIVE
PRIV_INHERITABLE
PRIV_LIMIT
set specifies the privileges to be used in the change operation.
In addition, a convenience function is provided: priv_set().