NAME
priv_getbynum() — convert privilege ID to privilege name
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 <stdio.h>
#include <sys/privileges.h>
#include <sys/types.h>
main()
{
priv_t priv_id=PRIV_SYSNFS;
const char *priv_name;
priv_name = priv_getbynum(priv_id);
if (priv_name == NULL) {
printf("Error getting privilege name\n");
} else {
/* priv_name is constant static data
may not be modified or freed */
printf("Privilege Name : %s\n",priv_name);
}
}