[Libevent-users] files and libevent
Nick Mathewson
nickm at freehaven.net
Sat Jun 14 14:03:20 EDT 2008
On Thu, Jun 12, 2008 at 07:59:45AM -0700, Teunis Peters wrote:
> I've not found any code to work with - but is there any reason that
> libevent would not work with standard files?
>
> I keep getting permission denied
>
> more or less:
>
> fd = open(filename, O_RDONLY)
> event_set(&ev, EV_READ | EV_PERSIST, rd_callback, rd_data);
> event_add(&ev, NULL)
> -> EPERM
>
> Or does libevent only work with network connections?
Libevent uses underlying nonblocking IO mechanisms the platform gives
it. Some of these work well with non-socket file descriptors; some
don't. By default, libevent uses the fastest (best-scaling) backend
that it knows about for your platform, even if that backend doesn't
support all fds.
In the current svn trunk (which will eventually become libevent 2.0),
there's a feature to let you specify that you want a backend that
works with file descriptors, even if it doesn't scale well.
yrs,
--
Nick
More information about the Libevent-users
mailing list