[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

REMAP_SETUP, REMAP_SETUP_WITH_LEN macros

Purpose

Initialize structures used by the REMAP macro to call the __remap subroutine.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/remap.h>
REMAP_SETUP(remap_num, remap_addr)
int remap_num;
void * remap_addr;
REMAP_SETUP_WITH_LEN(remap_num, remap_addr, length)
int remap_num;
void * remap_addr;
unsigned int length;

Description

The REMAP_SETUP macro initializes the structures used by the REMAP macro to call the __remap subroutine. This macro should be used in conjunction with the REMAP_DCL(), REMAP(), REMAPPED(), and REMAP_HANDLEx macros. The macro depends on the structures declared by REMAP_DCL.

Here is an example of the usage of REMAP_SETUP:


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.

Parameters

remap_num the sequential number (count starts at 0) indicating which remapping this is.
remap_addr the address of the start of the range to be remapped.
length the size of the address range to be remapped.

Return Values

Since REMAP_SETUP is a statement and not an expression, it has no return value.

Implementation Specifics

The REMAP_SETUP macro is defined in sys/remap.h.

Related Information

The REMAP macro, REMAP_DCL 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.


[ Previous | Next | Contents | Glossary | Home | Search ]