NAME
zclos - Delete program input ZLU
SYNOPSIS
#include <zcom/zcomsys.h>
#include <zcom/zcomcall.h> /* if compiled with ANSI C (recommended) */
int32 zclos (zap)
zaddr_type *zap;
DESCRIPTION
Routine zclos closes
the program ZLU set up by the zopen call
and returns the ZLU back to the system for reuse. This call should
normally always occur before a program terminates. If the program
ZLU is not closed, then the ZCOM subsystem will continue to hold
all of the resources associated with the ZLU and may add messages
to the input queue. This feature allows a program to open a ZLU
on another program's behalf, or to be killed and rerun
without losing any queued messages. It is the programmer's
responsibility to ensure that all unnecessary program ZLUs are closed
before the program terminates.
If zclos is called to
close a program's primary ZLU, the program will no longer
have a primary ZLU. Usually, a program should open another ZLU as
the primary ZLU because some APIs may return an error if the primary
ZLU does not exist (e.g. zsend(3X)).
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 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 returned to the system. |
RETURN VALUE
Routine zclos 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;
if (ierr = zclos (&zaddr)) {
/* 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)