ra_detach Subroutine
Purpose
Detaches a work component from a resource.
Library
Standard C library (libc.a)
Syntax
#include <sys/rset.h>
int ra_detach(rstype1, rsid1, rstype2, rsid2, flags)
rstype_t rstype1, rstype2;
rsid_t rsid1, rsid2;
unsigned int flags;
Description
The ra_detach subroutine detaches a work
component specified by the rstype1 and rsid1 parameters
from the resource specified by the rstype2 and rsid2 parameters.
Parameters
| 
rstype1 | 
Specifies the type of work component to be
detached from the resource specified by rstype2/rsid2. The rstype1 parameter
must be one of the following defined in rset.h.
- R_PROCESS
 
- Existing process
 
- R_THREAD
 
- Existing kernel thread
 
- R_FILDES
 
- File identified by an open file descriptor
 
- R_SHM
 
- Shared memory segment identified by the shared memory ID
 
- R_SUBRANGE
 
- Attachment to a memory range within a work component
 
  | 
| 
rsid1 | 
Specifies the work component associated with
the rstype1 parameter. The rsid1 parameter must
be one of the following:
- Process ID (for rstype1 of R_PROCESS)
 
- Set the rsid_t at_pid field to the desired process ID.
 
- Kernel thread ID (for rstype1 of R_THREAD)
 
- Set the rsid_t.at_tid field to the desired kernel thread ID.
 
- Open file descriptor (for rstype1 of R_FILDES)
 
- Set the rsid_t at_fd field to the desired file descriptor.
 
- Shared memory segment (for rstype of R_SHM)
 
- Set the rsid_t at_shmid field to the desired shared memory ID.
 
- Pointer to a subrange_t struct (for rstype of R_SUBRANGE)
 
- Set the rsid_t at_subbrange field to the address of a subrange_t
struct. Set the subrange_t struct su_offset, su_length, su_rstype,
and su_rsid fields. The other fields in the subrange_t struct are
ignored.
Set the subrange_t su_rstype field to R_PROCMEM and su_rsid.at_pid
field to RS_MYSELF to detach from a memory range in the user process.
Set the subrange_t su_offset field to the starting address of the
range in the process. Set the subrange_t su_length field to the length
of the range in the process. 
Note: 
The subrange_t su_offset
and su_length fields must be a multiple of 4 KB. For optimum performance,
the fields must be the multiple of the page size backing the memory
range. The page size used to back a memory range can be obtained using
the vmgetinfo subroutine specifying the VM_PAGE_INFO
command parameter. 
 
  | 
| 
rstype2 | 
Specifies the type of the resource
to be detached to the work component. The rstype2 parameter
must be one of the following defined in rset.h.
- R_RSET
 
- Resource set attachment
 
- R_SRADID
 
- SRADID attachment
 
  | 
| 
rsid2 | 
Specifies the resource associated
with the rstype2 parameter. The rsid2 parameter
is ignored for R_RSET and R_SRADID rstype2 resource types. | 
| 
flags | 
All flags bits are reserved for future use
and must be specified as 0. | 
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 an error.
Error Codes
| EINVAL | 
One of the following occurred:
- The flags parameter contains an invalid
value.
 
- The rstype1 or rstype2 parameter
contains an invalid type identifier.
   | 
| ESRCH | 
A work component specified by the rstype1 and rsid1 parameters
does not exist. | 
| ENOTSUP | 
One of the following occurred:
- An attempt to detach an SRADID (Scheduler Resource Allocation
Domain Identifier) is made and ENHANCED_AFFINITY is disabled.
 
- An attempt to detach an SRADID to a file is made.
 
- An R_SUBRANGE request with su_rstype R_PROCMEM is made and the
su_rsid.at_pid field is not RS_MYSELF.
   | 
| EPERM | 
One of the following occurred:
- rstype2 specified R_RSET and calling process has neither
root authority nor CAP_NUMA_ATTACH attachment privilege.
 
- rstype2 specified R_RSET and calling process has neither
root authority nor the same effective user ID as the process identified
by the rstype1 and rsid1 parameters.
   | 
Related Information
ra_attach Subroutine, ra_attachrset Subroutine, ra_detachrset Subroutine, and ra_getrset Subroutine.
[ Top of Page | Previous Page | Next Page | Index | Feedback ]