setroles Subroutine

Purpose

Set the role IDs of the current process.

Library

Standard C Library (libc.a)

Syntax

#include <unistd.h>
#include <sys/types.h>
#include <sys/cred.h>
 
int setroles(roles, nroles)
rid_t *roles;
int nroles;

Description

The setroles subroutine sets the supplementary role ID of the process. The number of roles that the setroles subroutine can set is no greater than the value specified by the MAX_ROLES constant in the cred structure of a process. The MAX_ROLES constant is defined in the sys/cred.h header file.

Parameters

Item Description
roles Points to the array of role IDs to be established.
nroles Indicates the number of entries in the roles parameter.

Return Values

Item Description
0 The subroutine ran successfully.
-1 An error occurred. The errno global variable is set to indicate the error.

Error Codes

The setroles subroutine fails if any of the following are 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 either less than 0 or greater than the MAX_ROLES value.
EPERM The calling process does not have the PV_DAC_RID privilege in its effective privilege set.