Gets the role ID of the current process.
Security Library (libc.a)
The getroles subroutine gets the supplementary role ID of the process specified by the pid parameter. The list is stored in the array pointed to by the roles parameter. The nroles parameter indicates the number of entries that can be stored in this array. The getroles subroutine never returns more than the number of entries specified by the MAX_ROLES constant. (The MAX_ROLES constant is defined in the <sys/cred.h> header file.) If the value in the nroles parameter is 0, the getroles subroutine returns the number of roles in the given process.
Item | Description |
---|---|
Pid | Indicates the process for which the role IDs are requested. |
Roles | Points to the array in which the role IDs of the user's process is stored. |
nroles | Indicates the number of entries that can be stored in the array pointed to by the roles parameter. |
The getroles subroutine returns one of the following values:
Item | Description |
---|---|
0 | The subroutine completes successfully. |
-1 | An error has occurred. An errno global variable is set to indicate the error. |
The getroles subroutine fails if any of the following value is true:
Item | Description |
---|---|
EFAULT | The roles and nroles parameters specify an array that is partially or completely outside of the process' allocated address space. |
EINVAL | The value of the nroles parameter is smaller than that of the roles parameter in the current process. |
EPERM | The invoker does not have the PV_DAC_RID privilege in its effective privilege set when the Pid is not the same as the current process ID. |
ESRCH | No process has a process ID that equals to Pid. |