You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/13 21:01:15 UTC
[PR] fs/vfs: Report POLLERR in the read and write sets of select(). [nuttx]
casaroli opened a new pull request, #20648:
URL: https://github.com/apache/nuttx/pull/20648
## Summary
`select()` put a descriptor with `POLLERR` only in `exceptfds`. A caller that asked only for `readfds` or `writefds`, which is the usual case, did not see the error: `select()` returned 0, also with no timeout, where 0 means that the timeout expired.
POSIX says that a descriptor is ready for reading (or writing) when the call would not block, "whether or not the function would transfer data successfully", so also when it would return an error. Linux reports `POLLERR` in the read and write sets.
This PR reports `POLLERR` in `readfds` and `writefds`. `poll()` reports `POLLHUP` and `POLLERR` also when they were not asked for, so the PR sets only the bits of the sets that the caller asked for: before, a descriptor in `writefds` only could also appear in `readfds` on `POLLHUP`. `exceptfds` does not change.
## Impact
`select()` callers that ask for `readfds` or `writefds` now see a descriptor with an error as ready, and the following `read()` or `write()` returns the error. `exceptfds` is as before.
## Testing
`qemu-armv8a:nsh` (flat) with `CONFIG_PIPES=y` and the default `CONFIG_DEV_PIPE_NPOLLWAITERS=4`. A test program starts 6 threads that call `select()` with no timeout on the read end of one pipe, then writes 6 bytes. The pipe has 4 poll slots, so threads 5 and 6 get `POLLERR`:
| | master | this PR |
|---|---|---|
| `select()` calls with no timeout that returned 0 | 2 of 6 | 0 of 6 |
With this PR the two threads see the descriptor in `readfds`, and their `read()` waits for the data. `ostest` exits with status 0 on both. Build: `qemu-armv8a:knsh` and `lm3s6965-ek:qemu-flat`, no warnings. `tools/checkpatch.sh -c -u -m -g` passes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fs/vfs: Report POLLERR in the read and write sets of select(). [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #20648:
URL: https://github.com/apache/nuttx/pull/20648
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fs/vfs: Report POLLERR in the read and write sets of select(). [nuttx]
Posted by "casaroli (via GitHub)" <gi...@apache.org>.
casaroli closed pull request #20648: fs/vfs: Report POLLERR in the read and write sets of select().
URL: https://github.com/apache/nuttx/pull/20648
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fs/vfs: Report POLLERR in the read and write sets of select(). [nuttx]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20648:
URL: https://github.com/apache/nuttx/pull/20648#issuecomment-6160128901
<!-- membrowse-pr-comment -->
## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report
*No memory changes detected for:*
- [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
- [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
- [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
- [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
- [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
- [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=bb4d8691759e59aaab6f9fb604a29cf3e6d3705a)
- [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
- [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
- [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=137492290cfc5d33496a47acc4152f4012a67bcf&base=665043ccb2d5892deb4b433e98e901d8b541017c)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org