ct_event_read(3CONTRAContract Management Library Functct_event_read(3CONTRACT)NAME
ct_event_read, ct_event_read_critical, ct_event_reset, ct_event_reli‐
able, ct_event_free, ct_event_get_flags, ct_event_get_ctid,
ct_event_get_evid, ct_event_get_type, ct_event_get_nevid,
ct_event_get_newct - common contract event functions
SYNOPSIS
cc [ flag... ] file... -D_LARGEFILE64_SOURCE -lcontract [ library... ]
#include <libcontract.h>
int ct_event_read(int fd, ct_evthdl_t *evthndlp);
int ct_event_read_critical(int fd, ct_evthdl_t *evthndlp);
int ct_event_reset(int fd);
int ct_event_reliable(int fd);
void ct_event_free(ct_evthdl_t evthndl);
ctid_t ct_event_get_ctid(ct_evthdl_t evthndl);
ctevid_t ct_event_get_evid(ct_evthdl_t evthndl);
uint_t ct_event_get_flags(ct_evthdl_t evthndl);
uint_t ct_event_get_type(ct_evthdl_t evthndl);
int ct_event_get_nevid(ct_evthdl_t evthndl, ctevid_t *evidp);
int ct_event_get_newct(ct_evthdl_t evthndl, ctid_t *ctidp);
DESCRIPTION
These functions operate on contract event endpoint file descriptors
obtained from the contract(4) file system and event object handles
returned by ct_event_read() and ct_event_read_critical().
The ct_event_read() function reads the next event from the queue refer‐
enced by the file descriptor fd and initializes the event object handle
pointed to by evthndlp. After a successful call to ct_event_read(), the
caller is responsible for calling ct_event_free() on this event object
handle when it has finished using it.
The ct_event_read_critical() function behaves like ct_event_read()
except that it reads the next critical event from the queue, skipping
any intermediate events.
The ct_event_reset() function resets the location of the listener to
the beginning of the queue. This function can be used to re-read
events, or read events that were sent before the event endpoint was
opened. Informative and acknowledged critical events, however, might
have been removed from the queue.
The ct_event_reliable() function indicates that no event published to
the specified event queue should be dropped by the system until the
specified listener has read the event. This function requires that the
caller have the {PRIV_CONTRACT_EVENT} privilege in its effective set.
The ct_event_free() function frees any storage associated with the
event object handle specified by evthndl.
The ct_event_get_ctid() function returns the ID of the contract that
sent the specified event.
The ct_event_get_evid() function returns the ID of the specified event.
The ct_event_get_flags() function returns the event flags for the spec‐
ified event. Valid event flags are:
CTE_INFO The event is an informative event.
CTE_ACK The event has been acknowledged (for critical and nego‐
tiation messages).
CTE_NEG The message represents an exit negotiation.
The ct_event_get_type() function reads the event type. The value is one
of the event types described in contract(4) or the contract type's man‐
ual page.
The ct_event_get_nevid() function reads the negotiation ID from an
CT_EV_NEGEND event.
The ct_event_get_newct() function obtains the ID of the contract cre‐
ated when the negotiation referenced by the CT_EV_NEGEND event suc‐
ceeded. If no contract was created, ctidp will be 0. If the operation
was cancelled, *ctidp will equal the ID of the existing contract.
RETURN VALUES
Upon successful completion, ct_event_read(), ct_event_read_critical(),
ct_event_reset(), ct_event_reliable(), ct_event_get_nevid(), and
ct_event_get_newct() return 0. Otherwise, they return a non-zero error
value.
The ct_event_get_flags(), ct_event_get_ctid(), ct_event_get_evid(), and
ct_event_get_type() functions return data as described in the DESCRIP‐
TION.
ERRORS
The ct_event_reliable() function will fail if:
EPERM The caller does not have {PRIV_CONTRACT_EVENT} in its
effective set.
The ct_event_read() and ct_event_read_critical() functions will fail
if:
EAGAIN The event endpoint was opened O_NONBLOCK and no appli‐
cable events were available to be read.
The The ct_event_get_nevid() and ct_event_get_newct() functions will
fail if:
EINVAL The evthndl argument is not a CT_EV_NEGEND event
object.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
┌─────────────────────────────┬─────────────────────────────┐
│ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
├─────────────────────────────┼─────────────────────────────┤
│Interface Stability │Evolving │
├─────────────────────────────┼─────────────────────────────┤
│MT-Level │Safe │
└─────────────────────────────┴─────────────────────────────┘
SEE ALSOlibcontract(3LIB), contract(4), attributes(5), lfcompile(5)SunOS 5.10 1 Apr 2004 ct_event_read(3CONTRACT)