ra_attachrset Subroutine
Purpose
Attaches a work component to a resource set.
Library
Standard C library (libc.a)
Syntax
#include <sys/rset.h>
int ra_attachrset (rstype, rsid, rset, flags)
rstype_t rstype;
rsid_t rsid;
rsethandle_t rset;
unsigned int flags;
Description
The ra_attachrset subroutine attaches a work component specified by the rstype and rsid parameters to a resource set specified by the rset parameter.
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 attachment applies to the current process or the current kernel thread, respectively.
- The resource set must contain processors that are available in the system.
- 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.
- The target process must not contain any threads that have bindprocessor bindings to a processor.
- The resource set must be contained in (be a subset of ) the target process' partition resource set.
- The resource set must be a superset of all the threads' rset in the target process.
- For R_FILDES rstype, the calling process must specify an open file descriptor, and it must have write access to the file, or the calling process' effective userid must be equal to the file owner's userid.
- For R_SHM rstype, the calling process' effective userid must be equal to the shared segment's owner.
- The resource set must contain processors that are available in the system.
- 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.
- The target thread must not have bindprocessor bindings to a processor.
- The resource set must be contained in (be a subset of ) the target thread's process effective and partition resource set.
If any of these conditions are not met, the attachment will fail.
Once a process is attached to a resource set, the threads in the process will only run on processors contained in the resource set. Once a kernel thread is attached to a resource set, the threads will only run on processors contained in the resource set.
Dynamic Processor Deallocation and DLPAR may invalidate the processor attachment that is being specified. A program must become DLPAR Aware to resolve this problem.
- All offline processors are ignored.
- If all the hardware threads (processors) of a physical processor (when running in simultaneous multithreading mode, there will be more than one active hardware thread per physical processor) are not included in the specified resource set, the other processors of the processor are ignored when constructing the ST resource set.
- Only one processor (hardware thread) resource per physical processor is included in the ST resource set.
Parameters
Item | Description |
---|---|
rstype | Specifies the type of work component to be attached
to the resource set specified by the rset parameter. The rstype parameter
must be the following value, defined in rset.h:
|
rsid | Identifies the work component to be attached
to the resource set specified by the rset parameter. The rsid parameter
must be the following:
|
rset | Specifies which work component (specified by the rstype and rsid parameters) to attach to the resource set. |
flags | Specifies either the memory allocation or the
scheduling policy for the work component being attached. The flags parameter
must be the following:
If the rstype parameter value is set to R_SUBRANGE, the memory allocation policy is specified in the subrange_t su_policy field rather than in the flags parameter. The R_ATTACH_STRSET value is only applicable if the rstype parameter value is set to R_PROCESS. The R_ATTACH_STRSET value indicates that the process is to be scheduled with a single-threaded policy (only on one hardware thread per physical processor). |
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 ra_attachrset subroutine is unsuccessful if one or more of the following are true:
Item | Description |
---|---|
EINVAL | One of the following is true:
|
ENODEV | The resource set specified by the rset parameter does not contain any available processors, or the R_ATTACH_STRSET flags parameter is specified and the constructed ST resource set does not have any available processors. |
ESRCH | The process or kernel thread identified by the rstype and rsid parameters does not exist. |
EPERM | One of the following is true:
|