NAME
zpeek - Read data from ZLU without disturbing input
queue
SYNOPSIS
#include <zcom/zcomsys.h>
#include <zcom/zcomcall.h> /* if compiled with ANSI C (recommended) */
int32 zpeek (zap, mode, mhp, ibuf, len, rlen, rstat)
zaddr_type *zap;
uint32 mode;
zmhd_type *mhp;
char *ibuf;
int32 len;
int32 *rlen;
int32 *rstat;
DESCRIPTION
Routine zpeek fetches
the next message from the head of a program ZLU input queue. The
program has the option to wait (i.e. suspend) if there is no data
on the queue specified. The actual length of the data message is returned
in rlen.
zpeek is similar to zread(3X) except that it does not
remove the message after retrieving it. Multiple calls to zpeek
on the same ZLU will return the same message until zread(3X) is called, i.e. it can
only look at the first message on the input queue. In addition,
the automatic response mechanism is not triggered when fetching
a message by zpeek, i.e. no response
will be sent to the message sender until the message is removed from
the input queue with zread.
The zpeek routine has
identical parameters to the zread routine.
See the zread routine for a
description of the parameters.
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). |
RETURN VALUE
Routine zopen 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.
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
zread(3X), zluopen(3X)