libmctProgrammer’s Manual

mct_event_attach(3)

Name

mct_event_attach — Attach to MCT event broadcasts

Synopsis

#include <mct/event.h>

int mct_event_attach(struct mct *mct, int blocking);

int mct_event_detach(struct mct *mct);

Description

The mct_event_attach() function requests that mctd broadcast events to the given mct handle. This binds an internal socket in the PF_LOCAL domain.

Events are broadcast by mctd to all instances of libmct for which mct_event_attach() is currently active. These are communicated over an internal IPC mechanism, and may be retrieved by an arbitrary number of calls to mct_event_read.

The blocking boolean parameter specifies whether calls to mct_event_read() will block pending event arrival. See mct_event_read.

The mct_event_detach() requests that mctd no longer broadcast events to the given mct handle, and destroys the corresponding socket allocated for IPC.

Return Value

The mct_event_attach() and mct_event_detach() functions return 0 on success. On failure these function return -1 and errno is set accordingly.

Errors

The mct_event_attach() and mct_event_detach() functions may fail for any of the reasons the socket API may produce.

In addition, mct_event_attach() and mct_event_detach() may fail for any of the reasons documented by mct_ipc.

In addition, mct_event_attach() may fail for the following reasons:

EISCONN

A call was made to mct_event_attach() without a corresponding call to mct_event_detach().

In addition, mct_event_detach() may fail for the following reasons:

ENOTCONN

A call was made to mct_event_detach() without a corresponding call to mct_event_attach().

Files

bp/mcte-XXXXXX AF_LOCAL abstract space

An internal address assigned by libmct as part of the IPC protocol. This is in the abstract namespace. The XXXXXX is substituted for randomly-generated identifiers by mktemp.

See Also

mct, mct_ipc, mct_event_read, mktemp.