EV_ERROR for ev_io events?

Marc Lehmann schmorp at schmorp.de
Tue Nov 25 11:05:21 CET 2008


On Mon, Nov 24, 2008 at 04:49:36PM -0800, Eric Brown <yogieric.list at gmail.com> wrote:
> I had been requesting EV_ERROR events on my io watchers -- mostly because
> that's what I used to do years ago when I had to manually create FD_SETs. Of
> course, I don't recall ever getting an ERROR event ever.

errors are errors, they are no events, and you can't request them.

> And, I noticed libev just added an assertion that EV_ERROR events weren't
> valid for io events (ev.c:2130).

Absolutely - libev will signal *errors* that way, there is no such thing as
an error event.

> I'm guessing this is not a bug in libev and some man page somewhere says
> ERROR events will never be generated on io events?

An error occurs, it is not an event: For example, the select function
could fail with an error of EBADF, which would cause libev to check every
submitted fd and tell the watcher.

Right now, EV_ERROR always means you have a bug in the program using libev.

Which is why requesting an error event makes no sense - it's kind of
askign for "please put a bug in the function calling ev_io_start".

> Out of curiosity, does the OS ever generate ERROR events for any type of
> selectable file descriptor? If so, when?

No, the OS api's (like select or poll) cannot even generate error "events".
They can flag an error, but there is no such thing as an "I/O" error when
askign for readyness notifications, as libev doesn't do any I/O.

Maybe you confuse "error" with the "except" fd set in select?

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list