SOCU:poll: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 101: | Line 101: | ||
|- | |- | ||
| 0x08 | | 0x08 | ||
| | | POLLERR | ||
| | | Out | ||
| | | Socket has an error condition. | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
| Line 114: | Line 114: | ||
| Out | | Out | ||
| Invalid socket handle. This is set if you use fd=-1, which is non-standard behavior. | | Invalid socket handle. This is set if you use fd=-1, which is non-standard behavior. | ||
|- | |- | ||
| ??? | | ??? | ||
Revision as of 22:39, 8 December 2014
Request
| Index Word | Description |
|---|---|
| 0 | Header code [0x00140084] |
| 1 | nfds_t nfds |
| 2 | int timeout |
| 3 | Value 0x20 (processID header) |
| 4 | ProcessID set by the ARM11 kernel. |
| 5 | (insize<<14) | 0x2802 |
| 6 | Pointer to input pollfd struct array |
The following is located 0x100-bytes after the beginning of the above command buffer:
| Index Word | Description |
|---|---|
| 0 | (outsize<<14) | 2 |
| 1 | Pointer to output pollfd struct array |
Response
| Index Word | Description |
|---|---|
| 0 | Header code |
| 1 | Result code |
| 2 | POSIX return value |
pollfd struct
| 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.
| 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 | POLLERR | Out | Socket has an error condition. |
| 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. |
| ??? | POLLHUP | Out | Socket has been disconnected. |