kra_detachrset Subroutine

Purpose

Detaches a work component from a resource set.

Syntax

#include <sys/rset.h>
int kra_detachrset (rstype, rsid, flags)
rstype_t rstype;
rsid_t rsid;
unsigned int flags;

Description

The kra_detachrset subroutine detaches a work component specified by rstype and rsid from a resource set.

The work component is an existing process identified by the process ID or an existing kernel thread identified by the kernel thread ID (tid). A process ID or thread ID value of RS_MYSELF indicates the detach command applies to the current process or the current kernel thread, respectively.

The following conditions must be met to detach a process or kernel thread from a resource set:
  • The calling process must either have root authority or have CAP_NUMA_ATTACH capability.
  • The calling process must either have root authority or the same effective userid as the target process.

If these conditions are not met, the operation will fail.

Once a process is detached from a resource set, the threads in the process can run on all available processors contained in the process' partition resource set. Once a kernel thread is detached from a resource set, that thread can run on all available processors contained in its process effective or partition resource set.

Parameters

Item Description
rstype Specifies the type of work component to be detached from to the resource set specified by rset. This parameter must be the following value, defined in rset.h:
  • R_PROCESS: existing process
  • R_THREAD: existing kernel thread
rsid Identifies the work component to be attached to the resource set specified by rset. This parameter must be the following:
  • Process ID (for rstype of R_PROCESS): set the rsid_t at_pid field to the desired process' process ID.
  • Kernel thread ID (for rstype of R_THREAD): set the rsid_t at_tid field to the desired kernel thread's thread ID.
flags For rstype of R_PROCESS, the R_DETACH_ALLTHRDS indicates that R_THREAD rsets are detached from all threads in a specified process. The process' effective rset is not detached in this case. Reserved for future use. Specify as 0.

Return Values

Upon successful completion, the kra_detachrset subroutine returns a 0. If unsuccessful, one or more of the following are true:
Item Description
EINVAL One of the following is true:
  • The flags parameter contains an invalid value.
  • The rstype contains an invalid type qualifier.
ESRCH The process or kernel thread identified by the rstype and rsid parameters does not exist.
EPERM One of the following is true:
  • The calling process has neither root authority nor CAP_NUMA_ATTACH attachment privilege.
  • The calling process has neither root authority nor the same effective user ID as the process identified by the rstype and rsid parameters.