I an not 100% sure I correctly understand what you are asking, so
correct me (or just ignore me) if I have totally missed the point here.
You have said you have a lightweight socket implementation for Linux and
managed to add a simple polling function into the module. If am
guessing that you mean that you have a Linux kernel loadable module, and
that you have implemented either the "poll" method in struct
file_operations, or more likely the "poll" method in the struct
proto_ops. If either is the case, then you are probably done. Why?
Because inside the Linux kernel the "poll" method is the fundamental
building block for the poll(), select() and epoll(). Thus, there should
be no need to care which mechanism use used by the OPAL event system.
However, I am concerned by "it sleeps for whatever amount of time is
entered in user space". If you have implemented the "poll" method for
either struct file_operations or struct proto_ops, then you should not
be sleeping. Sleeping is the responsibility of generic kernel code that
invokes your poll method. You can find a tutorial on writing a poll
method at http://www.xml.com/ldd/chapter/book/ch05.html and you may find
others on the web as well. That tutorial is for struct
file_operations. However, for struct proto_ops the logic is pretty much
the same, but you get your struct socket as an additional argument.
Timothy Hayes wrote:
> Hi everyone,
> I'm currently writing my own BTL component that utilises a lightweight
> Linux socket module. It wouldn't have nearly as much functionality as
> a TCP/IP socket but it does the job and I managed to add a simple
> polling function into the module, it sleeps for whatever amount of
> time is entered in user space then checks various things (if any
> messages have come in) and returns the mask. It's simple and probably
> not the best, but it works for the moment. :-)
> I'm curious as to how I can can get this into the OPAL event system. I
> see it's based on libevent and after reading through the documentation
> I can see what it does but now how to make it work in my circumstance.
> It says it supports select(2) and poll(2) but when calling event_set()
> the only parameter I seem to be able to set is EV_READ or EV_WRITE,
> there's nothing further to indicate I want to poll the file descriptor
> (as opposed to calling select on it). Maybe I'm missing something
> without realising, but should my socket module be implementing some
> function to reveal what ways it can be queried for the presence of
> information? If not, maybe somebody has an idea of how I can make it
> work with the OPAL event system.
> Any advice or information would be greatly appreciated.
> Kind regards
> Tim Hayes
> devel mailing list
Paul H. Hargrove PHHargrove_at_[hidden]
Future Technologies Group Tel: +1-510-495-2352
HPC Research Department Fax: +1-510-486-6900
Lawrence Berkeley National Laboratory