IOEvent

Describes list of possible IO events.

Summary
IOEventDescribes list of possible IO events.
CopyrightThis program is free software.
Files
C-kern/api/io/ioevent.hHeader file IOEvent.
Types
struct ioevent_tExports ioevent_t.
union ioevent_id_tExports ioevent_id_t.
Enumerations
ioevent_eDefines list of IO events.
ioevent_id_tThe id value of an event.
struct fields
ptrAllows to store the id value as pointer type.
val32Allows to store the id value as 32 bit integer type.
val64Allows to store the id value as 64 bit integer type.
ioevent_tAssociates one or more ioevent_e with an ioevent_id_t.
struct fields
ioeventsOne or more ioevent_e values ored together in one event mask.
eventidEvery event has an associated id.
lifetime
ioevent_INIT_PTRStatic initializer.
ioevent_INIT_VAL32Static initializer.
ioevent_INIT_VAL64Static initializer.

Copyright

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.

Author

© 2011 Jörg Seebohn

Files

C-kern/api/io/ioevent.h

Header file IOEvent.

Types

struct ioevent_t

typedef struct ioevent_t ioevent_t

Exports ioevent_t.

union ioevent_id_t

typedef union ioevent_id_t ioevent_id_t

Exports ioevent_id_t.

Enumerations

ioevent_e

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_READYou 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_WRITEYou 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_ERRORAn 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_CLOSEThe 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.

ioevent_id_t

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.

Summary
struct fields
ptrAllows to store the id value as pointer type.
val32Allows to store the id value as 32 bit integer type.
val64Allows to store the id value as 64 bit integer type.

struct fields

ptr

void * ptr

Allows to store the id value as pointer type.

val32

uint32_t val32

Allows to store the id value as 32 bit integer type.

val64

uint64_t val64

Allows to store the id value as 64 bit integer type.

ioevent_t

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.

Summary
struct fields
ioeventsOne or more ioevent_e values ored together in one event mask.
eventidEvery event has an associated id.
lifetime
ioevent_INIT_PTRStatic initializer.
ioevent_INIT_VAL32Static initializer.
ioevent_INIT_VAL64Static initializer.

struct fields

ioevents

uint32_t ioevents

One or more ioevent_e values ored together in one event mask.

eventid

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.

lifetime

ioevent_INIT_PTR

#define ioevent_INIT_PTR(ioevents,
eventid) { ioevents, { .ptr = eventid } }

Static initializer.

ioevent_INIT_VAL32

#define ioevent_INIT_VAL32(ioevents,
eventid) { ioevents, { .val32 = eventid } }

Static initializer.

ioevent_INIT_VAL64

#define ioevent_INIT_VAL64(ioevents,
eventid) { ioevents, { .val64 = eventid } }

Static initializer.

Describes list of possible IO events.
typedef struct ioevent_t ioevent_t
Exports ioevent_t.
struct ioevent_t
Associates one or more ioevent_e with an ioevent_id_t.
typedef union ioevent_id_t ioevent_id_t
Exports ioevent_id_t.
union ioevent_id_t
The id value of an event.
void * ptr
Allows to store the id value as pointer type.
uint32_t val32
Allows to store the id value as 32 bit integer type.
uint64_t val64
Allows to store the id value as 64 bit integer type.
Defines list of IO events.
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.
#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 } }
Static initializer.
struct iopoll_t
Event manager which stores sys_iochannel_t and returns associated ioevent_t.
int updatefd_iopoll(iopoll_t *iopoll,
sys_iochannel_t fd,
const struct ioevent_t *updated_event)
Updates event mask/value of sys_iochannel_t registered at Linux epoll object.
An error condition is signaled on file descriptor.
You can read from file descriptor.
#define sys_iochannel_t int
Choose Posix file descriptor type.
Close