NAME
zmapr - Set up ZLU mapping configuration
SYNOPSIS
#include <zcom/zcomsys.h>
#include <zcom/zcomcall.h> /* if compiled with ANSI C (recommended) */
int32 zmapr (zap, mzap)
zaddr_type *zap;
zaddr_type *mzap;
DESCRIPTION
Routine zmapr is used
to set up an alternate mapping for a ZLU. After the zmapr routine has been successfully
called, all messages addressed to the source ZLU (*zap) will be redirected to the destination
ZLU (*mzap).
Both ZLUs must be an existing ZLU such as a:
| -
program ZLU returned from zopen, |
| - terminal ZLU pre-defined in the TTGEN configuration file, |
| - mapped ZLU used in previous zmapr calls. |
The libraries libzcom_c.a and libpthread.a must be linked
into the calling program by giving the options "-lzcom_c
-lpthread" to cc(1) or ld(1).
Threads Considerations
This routine may be called from a multi-threaded application
using the POSIX (1003.1c) kernel threads API package. This routine
has the following characteristics when called by a multi-threaded
application:
cancellation
point | Thread cancellation can occur when a
thread calls this routine. |
async-cancel
unsafe | The calling thread's cancelability
type must be PTHREAD_CANCEL_DEFERRED if cancellation is enabled. |
async-signal
unsafe | It cannot be called from a signal handler. |
fork unsafe | It cannot be called by a child process
after fork(2) but before exec(2). |
PARAMETERS
zap | ZCOM address to be mapped. |
mzap | ZCOM address to be mapped onto. |
NOTES
On a successful return from zmapr,
accessing the source ZLU is actually directed to the destination
ZLU. If the source ZLU was a program ZLU, all messages that were
queued on it will be flushed (i.e., returned to the free queue).
If it was a terminal ZLU, the linkage to the terminal is lost. Usually,
this is not desirable because the previously associated terminal is
unusable.
RETURN VALUE
Routine zmapr returns 0 if successful. Otherwise, a non-zero error code is returned. See /opt/acc/include/zcom/zcomsys.h for
the list of ZCOM error codes and their meanings.
EXAMPLE
#include <zcom/zcomsys.h>
#include <zcom/zcomcall.h>
int32 ierr;
zaddr_type zaddr;
zaddr_type maddr;
if (ierr = zmapr (&zaddr, &maddr)) {
/* error return code */
}
else {
/* good return code */
}
FILES
/opt/acc/include/zcom/zcomsys.h | ZCOM subsystem general include file, containing
data types, data structures, constants, error codes, masks, etc.
Note that this must be the first include file before any other ZCOM
include files. |
/opt/acc/include/zcom/zcomcall.h | ZCOM routine function prototypes (requires
ANSI C compilation). |