SOCU:poll: Difference between revisions
Jump to navigation
Jump to search
Created page with "=Request= {| class="wikitable" border="1" |- ! Index Word ! Description |- | 0 | Header code [0x00140084] |- | 1 | nfds_t nfds |- | 2 | int timeout |- | 3 | Value 0x20 (process..." |
→Events: Fix values for flags and add new flags |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 24: | Line 24: | ||
|- | |- | ||
| 6 | | 6 | ||
| | | Pointer to input pollfd struct array | ||
|} | |} | ||
| Line 37: | Line 37: | ||
|- | |- | ||
| 1 | | 1 | ||
| | | 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 | |||
! Description | |||
|- | |||
| 0x01 | |||
| POLLRDNORM | |||
| Normal data can be read. | |||
|- | |||
| 0x02 | |||
| POLLRDBAND | |||
| Priority Band Data can be read. | |||
|- | |||
| 0x04 | |||
| POLLPRI | |||
| Urgent data can be read. | |||
|- | |||
| 0x08 | |||
| POLLWRNORM | |||
| Normal data can be written. | |||
|- | |||
| 0x10 | |||
| POLLWRBAND | |||
| Priority data can be written. | |||
|- | |||
| 0x20 | |||
| POLLERR | |||
| Socket has an error condition. | |||
|- | |||
| 0x40 | |||
| POLLHUP | |||
| Socket has been disconnected. | |||
|- | |||
| 0x80 | |||
| POLLNVAL | |||
| Invalid socket handle. This is set if you use fd=-1, which is non-standard behavior. | |||
|- | |||
| POLLRDNORM <nowiki>|</nowiki> POLLRDBAND | |||
| POLLIN | |||
| Data can be read. | |||
|- | |||
| POLLWRNORM | |||
| POLLOUT | |||
| Data can be written. | |||
|} | |} | ||
Revision as of 13:05, 24 November 2019
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 | Description |
|---|---|---|
| 0x01 | POLLRDNORM | Normal data can be read. |
| 0x02 | POLLRDBAND | Priority Band Data can be read. |
| 0x04 | POLLPRI | Urgent data can be read. |
| 0x08 | POLLWRNORM | Normal data can be written. |
| 0x10 | POLLWRBAND | Priority data can be written. |
| 0x20 | POLLERR | Socket has an error condition. |
| 0x40 | POLLHUP | Socket has been disconnected. |
| 0x80 | POLLNVAL | Invalid socket handle. This is set if you use fd=-1, which is non-standard behavior. |
| POLLRDNORM | POLLRDBAND | POLLIN | Data can be read. |
| POLLWRNORM | POLLOUT | Data can be written. |