NAME
zname - Find ZLU number from ZLU name
SYNOPSIS
#include <zcom/zcomsys.h>
#include <zcom/zcomcall.h> /* if compiled with ANSI C (recommended) */
int32 zname (zap, name)
zaddr_type *zap;
char *name;
DESCRIPTION
When a zopen call is
issued to allocate a program ZLU, the application assigns a symbolic
name to the ZLU. Routine zname is
used to find the program ZLU number associated with a symbolic name.
This allows an application to easily find the program ZLUs of other
ZCOM applications running on the ZCOM subsystem. If the symbolic
name is not associated with a program ZLU (i.e., is not found in
the node specified), the returned ZLU (zaddr_type.zlu)
is set to zero.
You must set the zap.node field prior to passing the zap parameter
to this routine. This will indicate on which node the application
we're looking for is located. A value of 0 indicates the
local node.
You must call zinit in
your program before you can invoke zname successfully.
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 (Return param) | ZCOM address. |
name | ZLU symbolic name to search for. The
name may be a maximum of 7 characters
long, and must be left-justified and null-terminated. Comparison
is case sensitive. |
RETURN VALUE
Routine zname 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;
char name[8];
zsinfo_type sip;
/* zinit() must be called in your program before zname() can be called. */
if (ierr = zinit(&sip)) {
/* error return code */
return(ierr);
}
zaddr.node = 0; /* The local node. */
if (ierr = zname (&zaddr, name)) {
/* 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). |
SEE ALSO
zopen(3X), makezluname(3X)