Declare structures used by the REMAP macro to call the __remap subroutine.
#include <sys/types.h> #include <sys/errno.h> #include <sys/remap.h>
REMAP_DCL(nremaps) int nremaps;
The REMAP_DCL macro declares the structures necessary to use the REMAP macro to call the __remap subroutine. This macro should be used in conjunction with the REMAP_SETUP, REMAP, REMAPPED, and REMAP_HANDLEx macros. The macro declares several structures and must therefore be used in the declaration section of the routine.
Here is an example of the usage of REMAP_DCL:
int
naccept (int s,
struct sockaddr * name,
int * anamelan)
{
REMAP_DCL (2);				<--2 addrs to remap
int rc;
REMAP_SETUP_WITH_LEN(0, name, *anamelan);	<--1st addr, explicit len
REMAP_SETUP (1, anamelen);			<--2nd addr, implied len
REMAP (3);		<-------+------------------3 parameters to pass
			V
			
rc = __naccept (REMAP_HANDLE3, s, REMAPPED(0), REMAPPED(1));
return rc;				       ^            ^		
}					       |	    |	
			1st remapped addr   2nd remapped addr
				
In the example shown, there are 2 addresses to be remapped (name and anamelen). REMAP_DCL(2) is used to declare the structures necessary for the remapping of 2 addresses. The first address range to be remapped (name) is defined to be of length *anamelen. Therefore REMAP_SETUP_WITH_LEN is called to set up the first remapping (remapping #0) so the length can be specified. The length of the 2nd range (remapping #1) is implied by the type (int), so REMAP_SETUP is used.
REMAP is then called, and nparms is 3 since there are a total of 3 parameters for the naccept system call. Finally, the 32-bit system call is called passing the remap_handle structure followed by the parameters, including the remapped addresses. The REMAP_HANDLE3 macro is used to pass the remap_handle structure appropriate for a system call with 3 parameters. The REMAPPED macros are used to pass remapped address #0 (name) and remapped address #1 (anamelen).
This service may only be called from a 64-bit user process.
| nremaps | the number of addresses to be remapped for this system call. | 
Since REMAP_DCL is a declaration statement, not an expression, there is no return value.
The REMAP_DCL macro is defined in sys/remap.h.
The REMAP macro, REMAP_SETUP macro, __remap subroutine, remap_64 kernel service, the as_remap64 kernel service, the as_unremap64 kernel service.
Memory Kernel Services and Understanding Virtual Memory Manager Interfaces in AIX Version 4 Kernel Extensions and Device Support Programming Concepts.