|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "common/stdint.h"Go to the source code of this file.
Macros | |
| #define | POLLIN 0x001 |
| readiness of open files, for poll and select. | |
| #define | POLLPRI 0x002 |
| #define | POLLOUT 0x004 |
| #define | POLLERR 0x008 |
| #define | POLLHUP 0x010 |
| #define | POLLNVAL 0x020 |
Functions | |
| void | poll_init (void) |
| set up the poll queue. | |
| void | poll_notify (void) |
| wake every process in poll: some file's readiness may have changed. | |
| uint32_t | poll_snapshot (void) |
| read the notify counter. | |
| void | poll_wait (uint64_t deadline, uint32_t seen) |
| sleep until poll_notify, a signal or the deadline tick, unless a notify came after poll_snapshot returned seen. | |
| #define POLLIN 0x001 |
readiness of open files, for poll and select.
each kind of file reports its readiness through file_ops_t::poll. a process in poll sleeps on one shared queue; whatever can change some file's readiness (pipe reads, writes and closes, a key press) calls poll_notify, and every poller checks its files again.
| #define POLLPRI 0x002 |
| #define POLLOUT 0x004 |
| #define POLLERR 0x008 |
| #define POLLHUP 0x010 |
| #define POLLNVAL 0x020 |
| void poll_init | ( | void | ) |
set up the poll queue.
call once at boot, before the first poll.
| void poll_notify | ( | void | ) |
wake every process in poll: some file's readiness may have changed.
safe to call from an interrupt handler.
| uint32_t poll_snapshot | ( | void | ) |
read the notify counter.
call it before the readiness check, and give the value to poll_wait: a notify between the check and the sleep then stops the sleep.