ZCOM C I/F Library Routines

ZOPEN (3X)

 

ZOPEN (3X)

NAME

zopen – Create ZLU program input queue

SYNOPSIS

#include

<zcom/zcomsys.h>

#include

<zcom/zcomcall.h> /* if compiled with ANSI C (recommended) */

int32 zopen (zap, pflag, name, limit)

zaddr_type *zap;

uint32pflag;

char*name;

uint32limit;

DESCRIPTION Routine zopen allocates a free ZLU as a program input queue. This must be done before a program may receive any messages from terminals or other programs. The calling program’s PID is put into the zowner field of the zlu_type structure.

If a calling program (or thread) terminates without doing a zclos(3X) of a ZLU, that ZLU and its resources will remain allocated in the ZCOM system. When the program (or thread) is restarted later on, that ZLU can be re-opened (using the same name parameter) without losing its queue contents. The program (or thread) can re-use the ZLU and resume its processing from where it left off. To flush the contents of a re-opened ZLU, use the zqmve(3X) routine after the ZLU is opened.

If it is not desirable to re-use an existing ZLU, the ZCOM_ZOPEN_NEW bit of pflag can be set. In this case, if the ZLU name already exists, the ZLU is not re-opened and error ZENAME (-11) is returned.

A ZLU can be defined either as a primary or an auxiliary ZLU. Auxiliary ZLUs are used, for example, when a program is receiving messages from multiple sources, so that the messages can be read in a different order from which they were received. All programs must have a primary ZLU defined, because all status messages are returned to the primary ZLU.

In addition, a program’s primary ZLU is used as the source ZLU for messages sent by that program (unless overridden by a different ZLU specified in the message header). Refer to the zsend(3X) routine for details.

270

Chapter 4