Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_notify.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_notify.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_notify.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_notify.html on line 8

iofunc_notify()

Install, poll, or remove a notification handler

Synopsis:

#include <sys/iofunc.h>

int iofunc_notify( resmgr_context_t *ctp,
                   io_notify_t *msg,
                   iofunc_notify_t *nop,
                   int trig,
                   const int *notifycounts,
                   int *armed );

Arguments:

ctp
A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
msg
A pointer to the io_notify_t structure that contains the message that the resource manager received; see below.
nop
An array of iofunc_notify_t structures that represent the events supported by the calling resource manager. Traditionally this array contained three members which represent, in order, the input, output, and out-of-band notification lists. Since the addition of extended events (see below), three is now the minimum size of this array. The actual size must support indexing by the conditions being triggered up to _NOTIFY_MAXCOND.

Generally, this structure is maintained by the resource manager within an extended attributes structure.

trig
A bitmask indicating which sources are currently satisfied, and could cause a trigger to occur. This bitmask may be indicated via two sets of flags. Traditionally, the value was any combination of _NOTIFY_COND_INPUT, _NOTIFY_COND_OUTPUT and _NOTIFY_COND_OBAND, but you can set _NOTIFY_COND_EXTEN so that you can specify the following extended events:

Note that the following flags are considered equivalent:

_NOTIFY_COND_INPUT  == _NOTIFY_CONDE_RDNORM
_NOTIFY_COND_OUTPUT == _NOTIFY_CONDE_WRNORM
_NOTIFY_COND_OBAND  == _NOTIFY_CONDE_RDBAND

Setting the _NOTIFY_COND_EXTEN flag affects the armed parameter, as described below.

You typically set this value, based on the conditions in effect at the time of the call.

notifycounts
NULL, or an array of integers representing the number of elements that must be present in the queue of each event represented by the nop array in order for the event to be triggered. Both this array and the nop array should contain the same number of elements. Note that if any condition is met, nothing is armed. Only if none of the conditions are met, does the event get armed in accordance with the notifycounts parameter. If this parameter is NULL, a value of 1 is assumed for all counts.
armed
NULL, or a pointer to a location where the function can store a 1 to indicate that a notification entry is armed, or a 0 otherwise.

If you set the _NOTIFY_COND_EXTEN bit in the trig argument, and armed isn't NULL, then when you call iofunc_notify(), armed must contain the number of elements in the nop and notifycounts arrays (provided notifycounts isn't NULL). Otherwise, the function assumes there are three elements in the nop and notifycounts arrays.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The POSIX layer helper function iofunc_notify() is used by a resource manager to implement notification.

This routine examines the message that the resource manager received (passed in the msg argument), and determines what action the client code is attempting to perform:

_NOTIFY_ACTION_POLL
Return a one-part IOV with the flags field set to indicate which conditions (input, output, or out-of-band) are available. The caller should return (_RESMGR_NPARTS(1)) to the resource manager library, which returns a one-part message to the client.
_NOTIFY_ACTION_POLLARM
Similar to _NOTIFY_ACTION_POLL, with the additional characteristic of arming the event if none of the conditions is met.
_NOTIFY_ACTION_TRANARM
For each of the sources specified, create a notification entry and store the client's struct sigevent event structure in it. Note that only one transition arm is allowed at a time per device. If the client specifies an event of SIGEV_NONE, the action is to disarm. When the event is triggered, the notification is automatically disarmed.

io_notify_t structure

The io_notify_t structure holds the _IO_NOTIFY message received by the resource manager:

struct _io_notify {
    uint16_t                    type;
    uint16_t                    combine_len;
    int32_t                     action;
    int32_t                     flags;
    struct sigevent             event;
};

struct _io_notify_reply {
    uint32_t                    zero;
    uint32_t                    flags;
};

typedef union {
    struct _io_notify           i;
    struct _io_notify_reply     o;
} io_notify_t;

The I/O message structures are unions of an input message (coming to the resource manager) and an output or reply message (going back to the client).

The i member is a structure of type _io_notify that contains the following members:

type
_IO_NOTIFY.
combine_len
If the message is a combine message, _IO_COMBINE_FLAG is set in this member. For more information, see Combine Messages chapter of Writing a Resource Manager.
action
_NOTIFY_ACTION_POLL, _NOTIFY_ACTION_POLLARM, or _NOTIFY_ACTION_TRANARM, as described above.
flags
One of the following:
event
A pointer to a sigevent structure that defines the event that the resource manager is to deliver once a condition is met.

The o member is a structure of type _io_notify_reply that contains the following members:

flags
Which of the conditions were triggered; see the flags for _io_notify, above.

iofunc_notify_t structure

The iofunc_notify_t structure is defined in <sys/iofunc.h> as follows:

typedef struct _iofunc_notify {
    int                         cnt;
    struct _iofunc_notify_event *list;
} iofunc_notify_t;

The members of the iofunc_notify_t structure include:

cnt
The smallest cnt member in the list; see below.
list
A pointer to a linked list of iofunc_notify_event_t structures that represent (in order), the input, output, and out-of-band notification lists.

The iofunc_notify_event_t structure is defined as:

typedef struct _iofunc_notify_event {
    struct _iofunc_notify_event *next;
    int                         rcvid;
    int                         scoid;
    int                         cnt;
    struct sigevent             event;
} iofunc_notify_event_t;

The members of the iofunc_notify_event_t structure include:

next
A pointer to the next element in the list.
rcvid
The receive ID of the client to notify.
scoid
The server connection ID.
cnt
The number of bytes available. Some clients, such as io-char, may want a sufficiently large amount of data to be available before they access it.
event
A pointer to a sigevent structure that defines the event that the resource manager is to deliver once a condition is met.

The sys/iofunc.h file also defines the following macros that work with the arrays of iofunc_notify_t structures:

#define IOFUNC_NOTIFY_DISARM(__nop, __index) ...
Disarm the list specified by __index in __nop.
#define IOFUNC_NOTIFY_INIT(__nop) ...
Initialize the three lists in __nop.

Returns:

-1
Success; the resource manager library should return a one-part IOV to the client.
EBUSY
A notification was already armed for this resource, and this library function enforces a restriction of one per resource.

Examples:

See Writing a Resource Manager.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

iofunc_notify_remove(), iofunc_notify_trigger(), _RESMGR_NPARTS(), sigevent

Handling ionotify() and select() in the Handling Other Messages chapter of Writing a Resource Manager

Resource Managers chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_notify.html on line 491

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/i/iofunc_notify.html on line 491