Установить, опросить или удалить обработчик уведомлений


#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 );


A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
A pointer to the io_notify_t structure that contains the message that the resource manager received.
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.
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:
normal data is available.
room for normal data.
out-of-band data is available.
priority data is available.
room for OOB data.
an error occurred on the device or stream.
the device has been disconnected.
the file descriptor is invalid.
Note that the following flags are considered equivalent:
Setting the _NOTIFY_COND_EXTEN flag affects the armed parameter. You typically set this value, based on the conditions in effect at the time of the call.
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.
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.




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:

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.
Similar to _NOTIFY_ACTION_POLL, with the additional characteristic of arming the event if none of the conditions is met.
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.

Возвращаемое значение:

Успешное завершение; the resource manager library should return a one-part IOV to the client.
A notification was already armed for this resource, and this library function enforces a restriction of one per resource.


ЗОСРВ «Нейтрино»

Точка остановки потока
Обработчик прерываний
Обработчик сигналов
В потоке

Тематические ссылки:

io_notify_t, iofunc_notify_t, iofunc_notify_remove(), iofunc_notify_trigger(), resmgr_context_t, _RESMGR_NPARTS(), struct sigevent

Предыдущий раздел: Описание API системной библиотеки