Line 24: |
Line 24: |
| |- | | |- |
| | 6 | | | 6 |
− | | Input fds struct ptr | + | | Pointer to input pollfd struct array |
| |} | | |} |
| | | |
Line 37: |
Line 37: |
| |- | | |- |
| | 1 | | | 1 |
− | | Output fds struct ptr | + | | Pointer to output pollfd struct array |
| |} | | |} |
| | | |
Line 54: |
Line 54: |
| | 2 | | | 2 |
| | POSIX return value | | | POSIX return value |
| + | |} |
| + | |
| + | =pollfd struct= |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! Type |
| + | ! Name |
| + | ! Description |
| + | |- |
| + | | u32 |
| + | | fd |
| + | | Socket handle |
| + | |- |
| + | | u32 |
| + | | events |
| + | | Events to poll for (input) |
| + | |- |
| + | | u32 |
| + | | revents |
| + | | Events received (output) |
| + | |} |
| + | |
| + | =Events= |
| + | Events are a bitwise set of these flags. |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! Value |
| + | ! Name |
| + | ! Input/Output |
| + | ! Description |
| + | |- |
| + | | 0x01 |
| + | | POLLIN |
| + | | Both |
| + | | Can recv() data from socket without blocking. For listen sockets, this means you can accept() a connection without blocking. |
| + | |- |
| + | | 0x02 |
| + | | POLLPRI |
| + | | Both |
| + | | There is OOB data ready to recv(). Appears that recv()'ing without OOB flag still reads OOB data? |
| + | |- |
| + | | 0x04 |
| + | | ??? |
| + | | ??? |
| + | | Have never seen this flag. Could possibly be POLLHUP (need to test). |
| + | |- |
| + | | 0x08 |
| + | | ??? |
| + | | ??? |
| + | | This flag is almost always set when requested. |
| + | |- |
| + | | 0x10 |
| + | | POLLOUT |
| + | | Both |
| + | | Can send() data to socket without blocking. For a non-blocking connect(), this means the connection has completed (need to test). |
| + | |- |
| + | | 0x20 |
| + | | POLLNVAL |
| + | | Out |
| + | | Invalid socket handle. This is set if you use fd=-1, which is non-standard behavior. |
| + | |- |
| + | | ??? |
| + | | POLLERR |
| + | | Out |
| + | | Socket error. |
| + | |- |
| + | | ??? |
| + | | POLLHUP |
| + | | Out |
| + | | Socket has been disconnected. |
| |} | | |} |