SOCU:poll: Difference between revisions

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: Update poll events. The 3DS doesn't use the same event flags as the Wii
 
(3 intermediate revisions by 2 users not shown)
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 55: Line 55:
| 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. These flags don't exactly match the Wii flags, even though the sockets sysmodule uses the same codebase.
{| class="wikitable" border="1"
|-
! Value
! Name
! Description
|-
| 0x01
| POLLIN
| Data can be read.
|-
| 0x02
| POLLPRI
| Urgent data can be read.
|-
| 0x08
| POLLWRNORM
| Normal data can be written.
|-
| 0x10
| POLLWRBAND
| Priority data can be written.
|-
| 0x20
| POLLNVAL
| Invalid socket handle.
|-
| POLLWRNORM
| POLLOUT
| Data can be written.
|}
Flag 0x4 isn't ever assigned in the code. Flags 0x40 and 0x80 are also not used, even though they are assgined in the input events by default along with 0x20. This is likely because that code section was inherited from the Wii, where these flags are used for poll errors.
Contrary to the Wii sockets, the 3DS doesn't have POLLERR or POLLHUP, so poll shouldn't be relied on when checking for socket errors.