How does libev know when socket is ready to be read?

A G utopian201 at
Fri Nov 9 12:26:12 CET 2012

How does libev get notification that a socket (ev_io) is ready to be read, is it through a signal from the kernel?
I have a tcp/ip stack operating in userspace and is based on raw sockets in linux. I have a test program written and when I have the watcher attached to the raw sockets, it invokes my callback to read from the raw socket.

However when I have the watcher attached to my tcp/ip stack in userspace, when it is ready to be read from, the callback doesn't get invoked. I'm guessing this is because libev gets a notification from the kernel, a notification that never comes from my tcp/ip stack.

I would like to make it work with my userspace tcp stack, but don't know where to start learning. Which libev files should I start reading? There are quite a lot!

Also how do I find out which mechanism libev is using? eg epoll, select etc

More information about the libev mailing list