Attaches to a user buffer for cross-memory operations.
#include <sys/types.h> #include <sys/errno.h> #include <sys/xmem.h>
int xmattach (addr, count, dp, segflag) char *addr; int count; struct xmem *dp; int segflag;
|addr||Specifies the address of the user buffer to be accessed in a cross-memory operation.|
|count||Indicates the size of the user buffer to be accessed in a cross-memory operation.|
|dp||Specifies a cross-memory descriptor. The dp->aspace_id variable must be set to a value of XMEM_INVAL.|
|segflag||Specifies a segment flag. This flag is used to determine the address space of the memory that the cross-memory descriptor applies to. The valid values for this flag can be found in the /usr/include/xmem.h file.|
The xmattach kernel service prepares the user buffer so that a device driver can access it without executing under the process that requested the I/O operation. A device top-half routine calls the xmattach kernel service. The xmattach kernel service allows a kernel process or device bottom-half routine to access the user buffer with the xmemin or xmemout kernel services. The device driver must use the xmdetach kernel service to inform the kernel when it has finished accessing the user buffer.
The kernel remembers which segments are attached for cross-memory operations. Resources associated with these segments cannot be freed until all cross-memory descriptors have been detached. "Cross Memory Kernel Services" in Memory Kernel Services in in AIX Kernel Extensions and Device Support Programming Concepts describes how the cross-memory kernel services use cross-memory descriptors.
Note: When the xmattach kernel service remaps user memory containing the cross-memory buffer, the effects are machine-dependent. Also, cross-memory descriptors are not inherited by a child process.
The xmattach kernel service can be called from the process environment only.
|XMEM_SUCC||Indicates a successful operation.|
|XMEM_FAIL||Indicates one of the following errors:
The xmattach64 kernel service is part of Base Operating System (BOS) Runtime.
The uphysio kernel service, xmdetach kernel service, xmattach64 kernel service, xmemin kernel service, and xmemout kernel service.
Cross Memory Kernel Services, and Memory Kernel Services.