rs_setnameattr Subroutine

Purpose

Sets the access control information of a resource set definition in the system resource set registry.

Library

Standard C library (libc.a)

Syntax

#include <sys/rset.h>
int rs_setnameattr (namespace, rsname, command, attr)
char *namespace, *rsname;
unsigned int command;
rs_attributes_t * attr;

Description

The rs_setnameattr subroutine sets (depending on the command value) one or more of the owner, group, or access control information of the system registry resource set definition specified by the namespace and rsname parameters.

The owner ID and/or group ID and/or access control information of the rsname parameter must be supplied in the structure pointed to by the attr parameter.

Note:
  1. In order to be able to set the attributes of a name, the calling process must have root authority or the attachment privilege and an effective user ID equal to that of the rsname parameter's owner.
  2. Root authority is required to change the resource set definition owner ID, or to set its group ID outside of the caller's list of groups.

Parameters

Item Description
namespace Points to a null terminated string corresponding to the name space within which rsname should be found.
rsname Points to a null terminated string corresponding to the name the information should be retrieved for.
command Specifies which attributes should be changed. This parameter is constructed by logically ORing one or more of the following values, defined in rset.h:
  • RS_OWNER: Set owner as specified in the owner field of attr.
  • RS_GROUP: Set group as specified in the group field of attr.
  • RS_PERM: Set access control information as specified in the mode field of attr.
attr Points to an rs_attributes_t structure containing the owner, group and mode fields, which will possibly be used by the subroutine for setting attributes. The mode field is used to store the access permissions, and is constructed by logically ORing one or more of the following values, defined in rset.h:
  • RS_IRUSR: Gives read rights to the name's owner
  • RS_IWUSR: Gives write rights to the name's owner
  • RS_IRGRP: Gives read rights to users of the same group as the name's owner
  • RS_IWGRP: Gives write rights to users of the same group as the name's owner
  • RS_IROTH: Gives read rights to the others
  • RS_IWOTH: Gives write rights to the others

Return Values

If successful, a value of 0 is returned. If unsuccessful, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The rs_setnameattr subroutine is unsuccessful if one or more of the following are true:

Item Description
EINVAL One of the following is true:
  • rsname is a null pointer.
  • namespace is a null pointer.
  • rsname or namespace point to an invalid name. Name length is 0 or greater than the RSET_NAME_SIZE constant (defined in rset.h), or name contains invalid characters.
  • command identifies an invalid command value.
  • command includes RS_PERM and the mode field of attr identifies an invalid access rights value.
  • attr is a null pointer.
EPERM One of the following is true:
  • The calling process has neither CAP_NUMA_ATTACH attachment privilege nor root authority.
  • command includes RS_OWNER and the owner field of attr is different from the caller's user ID and the caller does not have root authority.
  • command includes RS_GROUP, the group field of attr is outside of the caller's list of groups, and caller does not have root authority.
  • The namespace parameter starts with sys. This name space is reserved for system use.
ENOENT rsname could not be found in the name space identified by namespace.
ENOSPC Out of file-space blocks.
EFAULT Invalid address; exceptions outside errno range.
ENOSYS The rs_setnameattr subroutine is not supported by the system.