Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Problem Assignin a File Descriptor to posix:basic_stream_descriptor
From: Nick Jones (nick.jones_at_[hidden])
Date: 2010-03-18 00:19:26


On Wed, 2010-03-17 at 14:42 -0700, Nader Salehi wrote:

> I traced down the epoll_reactor::register_descriptor() where the
> function fails to add the descriptor to the poll list.
>
> Any idea what I am doing wrong? I would appreciate any comment.
>

Filesystem fds do not support epoll, as they lack the poll function
internally in the linux kernel. otoh, select does supports filesystem
fds.

If you do an strace of your sample program, you will see that the call
to epoll_ctl fails with the error number EPERM. Yes, the value chosen
is quite unfortunate, I always thought it would have been better to
return ENOTSUP or EOPNOTSUPP... anyhow, that means that epoll is
rejecting the fd you supplied, in this case because it was a filesystem
fd and in Linux, this type of fd lacks a poll function pointer in its
file_operations structure. I remember looking through the epoll sources
in an older version of the kernel, and finding that this was the only
reason that EPERM is returned as an error.

You may have to find another method of managing IO from and to the file,
perhaps you can use another standard or asio provided stream type?

Thanks

  Nick


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net