Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In epoll IOManager make it possible to wait on POLLPRI #61

Closed
njsmith opened this issue Feb 26, 2017 · 3 comments
Closed

In epoll IOManager make it possible to wait on POLLPRI #61

njsmith opened this issue Feb 26, 2017 · 3 comments

Comments

@njsmith
Copy link
Member

njsmith commented Feb 26, 2017

Useful for e.g. GPIO support: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

EPOLLWAKEUP might be interesting too, but is pretty exotic and a little more subtle (unlike our other events, removing an EPOLLWAKEUP from the set is actually semantically meaningful).

@njsmith
Copy link
Member Author

njsmith commented Jul 31, 2018

I'm not sure if this is actually useful – e.g. the GPIO documentation linked above says "THIS ABI IS DEPRECATED ... NEW USERSPACE CONSUMERS ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI." Going to close this until the use cases are clearer.

If we do find a reason to do this, I think it should be as a low-level Linux-specific API, similar to the low-level kqueue API (#578). There's just no consistency across systems about what counts as "priority" or "exceptional" data, or how it's handled – for example, kqueue doesn't even have a (portable) way to do POLLPRI, and then there was that time that Apple tried to add support for urgent-data...

@njsmith njsmith closed this as completed Jul 31, 2018
@smurfix
Copy link
Contributor

smurfix commented Jul 31, 2018

No problem, I've written trio-gpio which wraps libgpiod and does exactly that.

@njsmith
Copy link
Member Author

njsmith commented Oct 28, 2019

Noting for the record, since I was looking into OOB data handling for sockets, and might some day want to find this info again:

Using the BSD socket "OOB" APIs to handle TCP "urgent data" is a reasonably well-defined and portable thing. It's almost completely useless – literally the only use case I know if is to give telnet slightly better flow control when running over an unencrypted TCP connection – so I don't know that we should care. But if we did decide to care, then we would need a way to wait for "OOB" data. On Linux you can get notifications through EPOLLPRI, on Windows you can use AFD_POLL_RECEIVE_EXPEDITED, and on macOS you can use EVFILT_EXCEPT + NOTE_OOB. (This is a macOS extension though – on most BSDs there's no way to use kqueue to wait for OOB data at all. Which says something about how useless it is.)

We'd also need to think a bit about how to expose the concept: EPOLLPRI covers a few things besides OOB data (like the legacy GPIO use case that originally motivated this issue), while AFD_POLL_RECEIVE_EXPEDITED and EVFILT_EXCEPT+NOTE_OOB are very specific to OOB data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants