Describes list of possible IO events.
IOEvent | Describes list of possible IO events. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file IOEvent. |
Types | |
struct ioevent_t | Exports ioevent_t. |
union ioevent_id_t | Exports ioevent_id_t. |
Enumerations | |
ioevent_e | Defines list of IO events. |
ioevent_id_t | The id value of an event. |
struct fields | |
ptr | Allows to store the id value as pointer type. |
val32 | Allows to store the id value as 32 bit integer type. |
val64 | Allows to store the id value as 64 bit integer type. |
ioevent_t | Associates one or more ioevent_e with an ioevent_id_t. |
struct fields | |
ioevents | One or more ioevent_e values ored together in one event mask. |
eventid | Every event has an associated id. |
lifetime | |
ioevent_INIT_PTR | Static initializer. |
ioevent_INIT_VAL32 | Static initializer. |
ioevent_INIT_VAL64 | Static initializer. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2011 Jörg Seebohn
Header file IOEvent.
typedef struct ioevent_t ioevent_t
Exports ioevent_t.
typedef union ioevent_id_t ioevent_id_t
Exports ioevent_id_t.
Defines list of IO events. Every events is represented a single bit value and therefore a set of events can be stored as bit vector in an integer of at least 8 bit.
ioevent_READ | You can read from file descriptor. It is possible that this bit is set but reading returns 0 bytes read. This can happen on a connected network socket. In this case the peer has shutdown the connection for writing or the own side has shutdown the connection for reading. In both cases you should no longer wait for events of type ioevent_READ. In case of iopoll_t you should call updatefd_iopoll. |
ioevent_WRITE | You can write to a file descriptor. This bit can also be set even if you can not write cause of an error. So check first the ioevent_ERROR condition. |
ioevent_ERROR | An error condition is signaled on file descriptor. This signals that a network error occurred or that you can no longer write to a pipe cause the reading side has closed the connection. |
ioevent_CLOSE | The peer of a stream oriented connection (pipe, TCP/IP, ...) has closed the connection. If ioevent_READ is also set you should read the data before closing your side of the connection. |
union ioevent_id_t
The id value of an event. It is registered together with the corresponding event generating object. Every polled ioevent_t contains this id. With this id you can associate events with registered objects. Therefore it should be a unique value. The id can be stored as 3 different types. They use all the same memory address. So only one type at any point in time is supported.
struct fields | |
ptr | Allows to store the id value as pointer type. |
val32 | Allows to store the id value as 32 bit integer type. |
val64 | Allows to store the id value as 64 bit integer type. |
struct ioevent_t
Associates one or more ioevent_e with an ioevent_id_t. This value is used to twofold. During registering ioevents contains the list of event for which the io object is registered. The eventid should be set to the unique object id to be able to associate events with corresponding io objects. During polling ioevents contains the list of occurred events and eventid contains the value which was set during registering.
struct fields | |
ioevents | One or more ioevent_e values ored together in one event mask. |
eventid | Every event has an associated id. |
lifetime | |
ioevent_INIT_PTR | Static initializer. |
ioevent_INIT_VAL32 | Static initializer. |
ioevent_INIT_VAL64 | Static initializer. |
uint32_t ioevents
One or more ioevent_e values ored together in one event mask.
ioevent_id_t eventid
Every event has an associated id. It is set by the caller which registers an object, i.e. a sys_iochannel_t, with an associated ioevent_id_t.
Exports ioevent_t.
typedef struct ioevent_t ioevent_t
Associates one or more ioevent_e with an ioevent_id_t.
struct ioevent_t
Exports ioevent_id_t.
typedef union ioevent_id_t ioevent_id_t
The id value of an event.
union ioevent_id_t
Allows to store the id value as pointer type.
void * ptr
Allows to store the id value as 32 bit integer type.
uint32_t val32
Allows to store the id value as 64 bit integer type.
uint64_t val64
One or more ioevent_e values ored together in one event mask.
uint32_t ioevents
Every event has an associated id.
ioevent_id_t eventid
Static initializer.
#define ioevent_INIT_PTR( ioevents, eventid ) { ioevents, { .ptr = eventid } }
Static initializer.
#define ioevent_INIT_VAL32( ioevents, eventid ) { ioevents, { .val32 = eventid } }
Static initializer.
#define ioevent_INIT_VAL64( ioevents, eventid ) { ioevents, { .val64 = eventid } }
Event manager which stores sys_iochannel_t and returns associated ioevent_t.
struct iopoll_t
Updates event mask/value of sys_iochannel_t registered at Linux epoll object.
int updatefd_iopoll( iopoll_t * iopoll, sys_iochannel_t fd, const struct ioevent_t * updated_event )
Choose Posix file descriptor type.
#define sys_iochannel_t int