HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

p
priv_getbynum(3) priv_getbynum(3)
NAME
priv_getbynum() - convert privilege name to privilege ID
SYNOPSIS
#include <sys/privileges.h>
#include <sys/types.h>
const char *priv_getbynum(priv_t
priv_id);
Parameters
priv_id The internal (numeric) representation of a privilege to be converted to the external (string)
representation.
DESCRIPTION
priv_getbynum()
converts the internal privilege representation of the privilege ID to the external
string representation.
RETURN VALUE
priv_getbynum() returns the following values:
pointer Successful completion. A non-null pointer to the privilege name is returned. The returned
string is a pointer to shared data, and must not be modified or freed.
NULL pointer
Function failed.
errno is set to indicate the error.
ERRORS
If priv_getbynum() fails,
errno is set to one of the following values:
[EINVAL] Invalid privilege ID.
EXAMPLES
#include <sys/privileges.h>
#include <sys/types.h>
main()
{
priv_t privid;
char *privname = "SYSNFS";
privid = priv_getbynum(privname);
if (privid == -1) {
printf("\nError getting privilege ID\n");
} else {
printf("\nPrivilege ID : %d\n",privid);
}
}
SEE ALSO
priv_getbyname(3), priv_set_to_str(3), priv_str_to_set(3), privileges(5).
HP-UX 11i Version 2: December 2007 Update − 1 − Hewlett-Packard Company 167