fix(libkernel): report a regular file ready in poll #6962

Closed
DavidSamir wants to merge 3 commits from upstream-pr/6962 into main
DavidSamir commented 2026-10-16 21:22:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-16T21:22:44Z.


What

poll threw for an open descriptor that is neither a guest socket, a libSceNet socket nor a pipe, so a title that polls a file it has open stopped at the first call. VLC for PS5 (PPSA85300) polls a media file from its folder for POLLIN with a 20 ms timeout. On Windows main ends 2 to 5 s in, before any button is pressed:

terminate called after throwing an instance of 'std::runtime_error'
  what():  poll: descriptor 8 is neither a socket nor a pipe

Now a regular file (FILE_TYPE_DISK on Windows, S_ISREG on Linux) reports the POLLIN, POLLRDNORM and POLLOUT bits it asked for as ready at once, which is what FreeBSD's vop_nopoll returns for a vnode. An event of only POLLPRI or POLLRDBAND is never ready and waits out the timeout like any other poll. Devices, stdio and directories still throw, and the poll entry in docs/dev/debt/libkernel.md says so.

Related, not overlapping: #5999 does the same for select on Windows (Socket.cpp), #6070 and #5973 change pipes in this function.

Three commits: the change, its test, and the debt entry. There is no fourth step.

Tested

Windows 11 Pro build 26300, Intel i7-11700F, NVIDIA GeForce RTX 3070, WinLibs GCC 15.2, Release, branch merged on main c842491865 (it is based on it).

  • VLC (PPSA85300, catalog release 0.4), relinked with --windows-fixed-base 0x400000 (#4013) and --windows, with a 10 s, 991,017-byte clip of Big Buck Bunny (a Creative Commons film, from test-videos.co.uk) in the app's media folder, app0/media/:
    • main: 7 of 7 runs stop after 2 to 5 s with poll: descriptor 8 is neither a socket nor a pipe (descriptor 8 or 9). A probe on a scratch build showed descriptor 8 is ...\app0\media\bbb360.mp4, file type FILE_TYPE_DISK, events POLLIN, timeout 20 ms.
    • With this change: 6 of 6 runs go to their time limit (one of 120 s, five of 60 s) with no stop. In the 120 s run VLC's own log shows player: open /app0/media/bbb360.mp4 at 0 ms, player: VLC offers I420 640x386, player: pictures 640x386 8-bit, then the pause and play of the scripted button presses.
  • New test, TestRegularFile in guest_poll: one file for each ready bit, all three together, POLLPRI | POLLRDBAND only (not ready, waits the 50 ms), a set with a socket, the file and an invalid descriptor (one ready, no wait), and the file after close (POLLNVAL). Windows: passes 5 of 5 with the change. Against main's Udp.cpp it aborts (0xC0000409).
  • Linux, WSL2 Ubuntu 24.04, GCC 13.3, the repository's default configure, this branch merged on main c842491865: guest_poll and guest_select pass 3 of 3. With Udp.cpp as on main and the new test, guest_poll aborts with poll: descriptor 6 is neither a socket nor a pipe; restored, both pass.
  • Windows, related tests: 35 of 35 pass (guest_poll, guest_select, guest_select_wait, guest_kqueue, guest_equeue_events, the guest_socket_* family, guest_sce_net, guest_net_ctl, guest_http*, guest_ssl*, guest_sendfile).
  • tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py --branch: one conflict, #5973 in docs/dev/debt/libkernel.md (it adds the line next to the poll entry; whichever merges second takes a trivial rebase). It could not compare #5021, #6044, #6222 and #6828 because they conflict with main themselves; read by hand, #6222 and #6828 edit other functions of Udp.cpp (WaitAny, Ready, GuestSockets::Poll) and #6044 reorganises the tests.
  • Not tested: macOS, a directory or device descriptor (they still throw), and VLC playing the clip to its end.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA85300 (VLC), no discussion number
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4894427942 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6962). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-16T21:22:44Z. --- ### What `poll` threw for an open descriptor that is neither a guest socket, a libSceNet socket nor a pipe, so a title that polls a file it has open stopped at the first call. VLC for PS5 (PPSA85300) polls a media file from its folder for `POLLIN` with a 20 ms timeout. On Windows `main` ends 2 to 5 s in, before any button is pressed: ``` terminate called after throwing an instance of 'std::runtime_error' what(): poll: descriptor 8 is neither a socket nor a pipe ``` Now a regular file (`FILE_TYPE_DISK` on Windows, `S_ISREG` on Linux) reports the `POLLIN`, `POLLRDNORM` and `POLLOUT` bits it asked for as ready at once, which is what FreeBSD's `vop_nopoll` returns for a vnode. An event of only `POLLPRI` or `POLLRDBAND` is never ready and waits out the timeout like any other poll. Devices, stdio and directories still throw, and the poll entry in `docs/dev/debt/libkernel.md` says so. Related, not overlapping: #5999 does the same for `select` on Windows (`Socket.cpp`), #6070 and #5973 change pipes in this function. Three commits: the change, its test, and the debt entry. There is no fourth step. ### Tested Windows 11 Pro build 26300, Intel i7-11700F, NVIDIA GeForce RTX 3070, WinLibs GCC 15.2, Release, branch merged on `main` c842491865 (it is based on it). - **VLC (PPSA85300, catalog release 0.4)**, relinked with `--windows-fixed-base 0x400000` (#4013) and `--windows`, with a 10 s, 991,017-byte clip of Big Buck Bunny (a Creative Commons film, from test-videos.co.uk) in the app's media folder, `app0/media/`: - `main`: 7 of 7 runs stop after 2 to 5 s with `poll: descriptor 8 is neither a socket nor a pipe` (descriptor 8 or 9). A probe on a scratch build showed descriptor 8 is `...\app0\media\bbb360.mp4`, file type `FILE_TYPE_DISK`, events `POLLIN`, timeout 20 ms. - With this change: 6 of 6 runs go to their time limit (one of 120 s, five of 60 s) with no stop. In the 120 s run VLC's own log shows `player: open /app0/media/bbb360.mp4 at 0 ms`, `player: VLC offers I420 640x386`, `player: pictures 640x386 8-bit`, then the pause and play of the scripted button presses. - **New test**, `TestRegularFile` in `guest_poll`: one file for each ready bit, all three together, `POLLPRI | POLLRDBAND` only (not ready, waits the 50 ms), a set with a socket, the file and an invalid descriptor (one ready, no wait), and the file after `close` (`POLLNVAL`). Windows: passes 5 of 5 with the change. Against `main`'s `Udp.cpp` it aborts (`0xC0000409`). - **Linux**, WSL2 Ubuntu 24.04, GCC 13.3, the repository's default configure, this branch merged on `main` c842491865: `guest_poll` and `guest_select` pass 3 of 3. With `Udp.cpp` as on `main` and the new test, `guest_poll` aborts with `poll: descriptor 6 is neither a socket nor a pipe`; restored, both pass. - **Windows, related tests:** 35 of 35 pass (`guest_poll`, `guest_select`, `guest_select_wait`, `guest_kqueue`, `guest_equeue_events`, the `guest_socket_*` family, `guest_sce_net`, `guest_net_ctl`, `guest_http*`, `guest_ssl*`, `guest_sendfile`). - `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py --branch`: one conflict, #5973 in `docs/dev/debt/libkernel.md` (it adds the line next to the poll entry; whichever merges second takes a trivial rebase). It could not compare #5021, #6044, #6222 and #6828 because they conflict with `main` themselves; read by hand, #6222 and #6828 edit other functions of `Udp.cpp` (`WaitAny`, `Ready`, `GuestSockets::Poll`) and #6044 reorganises the tests. - Not tested: macOS, a directory or device descriptor (they still throw), and VLC playing the clip to its end. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA85300 (VLC), no discussion number - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-16 21:33:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T21:33:57Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4630 docs/dev/debt/libkernel.md
PR 5021 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 5918 docs/dev/debt/libkernel.md
PR 5992 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 5993 docs/dev/debt/libkernel.md
PR 5999 docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestPoll.cpp
PR 6091 docs/dev/debt/libkernel.md
PR 6149 docs/dev/debt/libkernel.md
PR 6201 docs/dev/debt/libkernel.md
PR 6222 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 6228 docs/dev/debt/libkernel.md
PR 6343 docs/dev/debt/libkernel.md
PR 6420 docs/dev/debt/libkernel.md
PR 6437 docs/dev/debt/libkernel.md
PR 6443 docs/dev/debt/libkernel.md
PR 6446 docs/dev/debt/libkernel.md
PR 6469 docs/dev/debt/libkernel.md
PR 6487 docs/dev/debt/libkernel.md
PR 6510 docs/dev/debt/libkernel.md
PR 6519 docs/dev/debt/libkernel.md
PR 6534 docs/dev/debt/libkernel.md
PR 6542 docs/dev/debt/libkernel.md
PR 6658 docs/dev/debt/libkernel.md
PR 6663 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 6825 docs/dev/debt/libkernel.md
PR 6826 docs/dev/debt/libkernel.md
PR 6830 docs/dev/debt/libkernel.md
PR 6833 docs/dev/debt/libkernel.md
PR 6884 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 6893 docs/dev/debt/libkernel.md
PR 6908 docs/dev/debt/libkernel.md
PR 6915 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 6977 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7039 docs/dev/debt/libkernel.md
PR 7049 docs/dev/debt/libkernel.md
PR 7070 docs/dev/debt/libkernel.md
PR 7075 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7088 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7090 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7129 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7135 docs/dev/debt/libkernel.md
PR 7140 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/Socket/src/Udp.cpp
core/libs/tests/GuestPoll.cpp
PR 7273 docs/dev/debt/libkernel.md
PR 7299 docs/dev/debt/libkernel.md
PR 7332 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7403 docs/dev/debt/libkernel.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6225128356 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6962#issuecomment-6225128356). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T21:33:57Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 4630](https://www.github.com/boykopovar/AnyPS5/pull/4630) | `docs/dev/debt/libkernel.md` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 5918](https://www.github.com/boykopovar/AnyPS5/pull/5918) | `docs/dev/debt/libkernel.md` | | [PR 5992](https://www.github.com/boykopovar/AnyPS5/pull/5992) | `core/libs/prx/libkernel/Socket/src/Udp.cpp` | | [PR 5993](https://www.github.com/boykopovar/AnyPS5/pull/5993) | `docs/dev/debt/libkernel.md` | | [PR 5999](https://www.github.com/boykopovar/AnyPS5/pull/5999) | `docs/dev/debt/libkernel.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestPoll.cpp` | | [PR 6091](https://www.github.com/boykopovar/AnyPS5/pull/6091) | `docs/dev/debt/libkernel.md` | | [PR 6149](https://www.github.com/boykopovar/AnyPS5/pull/6149) | `docs/dev/debt/libkernel.md` | | [PR 6201](https://www.github.com/boykopovar/AnyPS5/pull/6201) | `docs/dev/debt/libkernel.md` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6228](https://www.github.com/boykopovar/AnyPS5/pull/6228) | `docs/dev/debt/libkernel.md` | | [PR 6343](https://www.github.com/boykopovar/AnyPS5/pull/6343) | `docs/dev/debt/libkernel.md` | | [PR 6420](https://www.github.com/boykopovar/AnyPS5/pull/6420) | `docs/dev/debt/libkernel.md` | | [PR 6437](https://www.github.com/boykopovar/AnyPS5/pull/6437) | `docs/dev/debt/libkernel.md` | | [PR 6443](https://www.github.com/boykopovar/AnyPS5/pull/6443) | `docs/dev/debt/libkernel.md` | | [PR 6446](https://www.github.com/boykopovar/AnyPS5/pull/6446) | `docs/dev/debt/libkernel.md` | | [PR 6469](https://www.github.com/boykopovar/AnyPS5/pull/6469) | `docs/dev/debt/libkernel.md` | | [PR 6487](https://www.github.com/boykopovar/AnyPS5/pull/6487) | `docs/dev/debt/libkernel.md` | | [PR 6510](https://www.github.com/boykopovar/AnyPS5/pull/6510) | `docs/dev/debt/libkernel.md` | | [PR 6519](https://www.github.com/boykopovar/AnyPS5/pull/6519) | `docs/dev/debt/libkernel.md` | | [PR 6534](https://www.github.com/boykopovar/AnyPS5/pull/6534) | `docs/dev/debt/libkernel.md` | | [PR 6542](https://www.github.com/boykopovar/AnyPS5/pull/6542) | `docs/dev/debt/libkernel.md` | | [PR 6658](https://www.github.com/boykopovar/AnyPS5/pull/6658) | `docs/dev/debt/libkernel.md` | | [PR 6663](https://www.github.com/boykopovar/AnyPS5/pull/6663) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6825](https://www.github.com/boykopovar/AnyPS5/pull/6825) | `docs/dev/debt/libkernel.md` | | [PR 6826](https://www.github.com/boykopovar/AnyPS5/pull/6826) | `docs/dev/debt/libkernel.md` | | [PR 6830](https://www.github.com/boykopovar/AnyPS5/pull/6830) | `docs/dev/debt/libkernel.md` | | [PR 6833](https://www.github.com/boykopovar/AnyPS5/pull/6833) | `docs/dev/debt/libkernel.md` | | [PR 6884](https://www.github.com/boykopovar/AnyPS5/pull/6884) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6893](https://www.github.com/boykopovar/AnyPS5/pull/6893) | `docs/dev/debt/libkernel.md` | | [PR 6908](https://www.github.com/boykopovar/AnyPS5/pull/6908) | `docs/dev/debt/libkernel.md` | | [PR 6915](https://www.github.com/boykopovar/AnyPS5/pull/6915) | `docs/dev/debt/libkernel.md` | | [PR 6936](https://www.github.com/boykopovar/AnyPS5/pull/6936) | `docs/dev/debt/libkernel.md` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7039](https://www.github.com/boykopovar/AnyPS5/pull/7039) | `docs/dev/debt/libkernel.md` | | [PR 7049](https://www.github.com/boykopovar/AnyPS5/pull/7049) | `docs/dev/debt/libkernel.md` | | [PR 7070](https://www.github.com/boykopovar/AnyPS5/pull/7070) | `docs/dev/debt/libkernel.md` | | [PR 7075](https://www.github.com/boykopovar/AnyPS5/pull/7075) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7088](https://www.github.com/boykopovar/AnyPS5/pull/7088) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7090](https://www.github.com/boykopovar/AnyPS5/pull/7090) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7105](https://www.github.com/boykopovar/AnyPS5/pull/7105) | `docs/dev/debt/libkernel.md` | | [PR 7121](https://www.github.com/boykopovar/AnyPS5/pull/7121) | `docs/dev/debt/libkernel.md` | | [PR 7129](https://www.github.com/boykopovar/AnyPS5/pull/7129) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7135](https://www.github.com/boykopovar/AnyPS5/pull/7135) | `docs/dev/debt/libkernel.md` | | [PR 7140](https://www.github.com/boykopovar/AnyPS5/pull/7140) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7149](https://www.github.com/boykopovar/AnyPS5/pull/7149) | `docs/dev/debt/libkernel.md` | | [PR 7192](https://www.github.com/boykopovar/AnyPS5/pull/7192) | `docs/dev/debt/libkernel.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`core/libs/tests/GuestPoll.cpp` | | [PR 7273](https://www.github.com/boykopovar/AnyPS5/pull/7273) | `docs/dev/debt/libkernel.md` | | [PR 7299](https://www.github.com/boykopovar/AnyPS5/pull/7299) | `docs/dev/debt/libkernel.md` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libkernel/Socket/src/Udp.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 7403](https://www.github.com/boykopovar/AnyPS5/pull/7403) | `docs/dev/debt/libkernel.md` |
Dextroid17 commented 2026-10-17 00:35:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-17T00:35:10Z.


Native Linux run of this head (the description's Linux run was inside WSL2).

Setup: head 5ddebca1b (merge-base with main c84249186), BUILD_TESTING=ON, Ninja, CachyOS (kernel 7.2.9), i9-11900K, GCC 16.2.1. Tests ran under env -i with only HOME and PATH set. Each arm ran ctest -R '^guest_(poll|select)$' 3 times.

  • Head: 2 of 2 pass in each of the 3 runs.
  • Revert arm: with Udp.cpp as on c84249186 and the PR's test kept, guest_poll fails 3 of 3 with poll: descriptor 9 is neither a socket nor a pipe. guest_select passes.
  • Merged with main at e751dd205: clean merge, 2 of 2 pass in each of the 3 runs. tools/check_conventions.py passes. main has since moved to f3263dfbf; it does not touch this PR's files and the PR still merges cleanly.
  • Extra probe (a few lines added to GuestPoll.cpp locally, not part of the PR, one run): a regular file opened read-only and polled for POLLOUT returns 1 with revents 0x4. By reading, that matches FreeBSD: vn_poll and vop_stdpoll do not check the open mode. A directory descriptor still throws neither a socket nor a pipe, as the updated debt entry says.

Optional, on the debt entry's citation. In FreeBSD 11.4, vop_nopoll is the default (vfs_default.c), while UFS sets .vop_poll = vop_stdpoll. By reading, for the bits this PR accepts, both return events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) (vop_stdpoll, poll_no_poll). That is the same set as GuestPollReadable | GuestPollWritable (0x45, since POLLWRNORM is POLLOUT). POLLPRI and POLLRDBAND give 0 because they are in POLLSTANDARD. The behaviour does not change either way. The console's filesystem is not known to be UFS, so naming vop_nopoll is also defensible.

Not checked: Windows (IsDiskFile through GetFileType), macOS, PS5 hardware, and VLC itself.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6227407354 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6962#issuecomment-6227407354). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-17T00:35:10Z. --- Native Linux run of this head (the description's Linux run was inside WSL2). **Setup:** head `5ddebca1b` (merge-base with `main` `c84249186`), `BUILD_TESTING=ON`, Ninja, CachyOS (kernel 7.2.9), i9-11900K, GCC 16.2.1. Tests ran under `env -i` with only `HOME` and `PATH` set. Each arm ran `ctest -R '^guest_(poll|select)$'` 3 times. - **Head:** 2 of 2 pass in each of the 3 runs. - **Revert arm:** with `Udp.cpp` as on `c84249186` and the PR's test kept, `guest_poll` fails 3 of 3 with `poll: descriptor 9 is neither a socket nor a pipe`. `guest_select` passes. - **Merged with `main` at `e751dd205`:** clean merge, 2 of 2 pass in each of the 3 runs. `tools/check_conventions.py` passes. `main` has since moved to `f3263dfbf`; it does not touch this PR's files and the PR still merges cleanly. - **Extra probe** (a few lines added to `GuestPoll.cpp` locally, not part of the PR, one run): a regular file opened read-only and polled for `POLLOUT` returns 1 with `revents` 0x4. By reading, that matches FreeBSD: `vn_poll` and `vop_stdpoll` do not check the open mode. A directory descriptor still throws `neither a socket nor a pipe`, as the updated debt entry says. Optional, on the debt entry's citation. In FreeBSD 11.4, `vop_nopoll` is the default ([`vfs_default.c`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/kern/vfs_default.c#L127)), while UFS sets [`.vop_poll = vop_stdpoll`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/ufs/ufs/ufs_vnops.c#L2724). By reading, for the bits this PR accepts, both return `events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)` ([`vop_stdpoll`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/kern/vfs_default.c#L562-L574), [`poll_no_poll`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/kern/sys_generic.c#L857-L871)). That is the same set as `GuestPollReadable | GuestPollWritable` (0x45, since `POLLWRNORM` is `POLLOUT`). `POLLPRI` and `POLLRDBAND` give 0 because they are in `POLLSTANDARD`. The behaviour does not change either way. The console's filesystem is not known to be UFS, so naming `vop_nopoll` is also defensible. Not checked: Windows (`IsDiskFile` through `GetFileType`), macOS, PS5 hardware, and VLC itself. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine. AI-assisted: yes
karimibrahim07 commented 2026-10-17 03:52:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-17T03:52:29Z.

Review: COMMENTED


Windows check of head 5ddebca1b merged onto main e3a8e4430 (clean merge). Windows 11 Pro (26300), Ryzen 5 3600, WinLibs GCC 15.2.0 r7, Ninja Release.

  • guest_poll with the new TestRegularFile, plus guest_select*, guest_kqueue, guest_socket*, guest_tcp and guest_udp: 27 of 27 pass, --repeat until-fail:3.
  • Negative control: with main's Udp.cpp and the new test kept, guest_poll aborts with poll: descriptor 4 is neither a socket nor a pipe (0xc0000409), the VLC message.

Code: IsDiskFile can't catch guest sockets. On Windows a socket number holds a NUL handle (FILE_TYPE_CHAR), and on Linux it is a duplicate of the host socket (S_ISSOCK). So a socket can't be reported as always ready. Returning only the POLLIN | POLLRDNORM | POLLOUT bits that were asked for matches FreeBSD's vop_nopoll (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM); POLLWRNORM is POLLOUT there). The test covers the cases that matter: no wait when the file is ready, a full wait when only POLLPRI/POLLRDBAND is asked, a mixed set, and POLLNVAL after close.

Overlap: #5973 conflicts with this PR only in docs/dev/debt/libkernel.md. It adds a kevent on a pipe line right after the poll entry that this PR rewrites. The resolution is to keep both lines: this PR's poll text, then #5973's new line.

Not checked: VLC itself (I don't have it here). The behaviour it needs is what TestRegularFile exercises.

AI-assisted: yes. I ran the build, the tests and the negative control above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5555933766 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6962#pullrequestreview-5555933766). Originally posted by [karimibrahim07](https://github.com/karimibrahim07) on 2026-10-17T03:52:29Z. **Review:** COMMENTED --- Windows check of head `5ddebca1b` merged onto `main` `e3a8e4430` (clean merge). Windows 11 Pro (26300), Ryzen 5 3600, WinLibs GCC 15.2.0 r7, Ninja Release. - `guest_poll` with the new `TestRegularFile`, plus `guest_select*`, `guest_kqueue`, `guest_socket*`, `guest_tcp` and `guest_udp`: 27 of 27 pass, `--repeat until-fail:3`. - Negative control: with `main`'s `Udp.cpp` and the new test kept, `guest_poll` aborts with `poll: descriptor 4 is neither a socket nor a pipe` (`0xc0000409`), the VLC message. **Code:** `IsDiskFile` can't catch guest sockets. On Windows a socket number holds a `NUL` handle (`FILE_TYPE_CHAR`), and on Linux it is a duplicate of the host socket (`S_ISSOCK`). So a socket can't be reported as always ready. Returning only the `POLLIN | POLLRDNORM | POLLOUT` bits that were asked for matches FreeBSD's `vop_nopoll` (`events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)`; `POLLWRNORM` is `POLLOUT` there). The test covers the cases that matter: no wait when the file is ready, a full wait when only `POLLPRI`/`POLLRDBAND` is asked, a mixed set, and `POLLNVAL` after `close`. **Overlap:** #5973 conflicts with this PR only in `docs/dev/debt/libkernel.md`. It adds a `kevent on a pipe` line right after the `poll` entry that this PR rewrites. The resolution is to keep both lines: this PR's `poll` text, then #5973's new line. Not checked: VLC itself (I don't have it here). The behaviour it needs is what `TestRegularFile` exercises. AI-assisted: yes. I ran the build, the tests and the negative control above.
blawesom commented 2026-10-17 08:35:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T08:35:12Z.


Rebase handoff — rebased onto current main (authorship unchanged). One conflict in docs/dev/debt/libkernel.md: the poll debt entry now carries your regular-file semantics, with main's newer kevent-pipe entry kept after it.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1335/1336 — the only failure is the known main regression (agc_driver_tessellation segfault, #4727), not this PR

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6962
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 7fe77f717.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231805394 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6962#issuecomment-6231805394). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T08:35:12Z. --- **Rebase handoff** — rebased onto current `main` (authorship unchanged). One conflict in `docs/dev/debt/libkernel.md`: the poll debt entry now carries your regular-file semantics, with `main`'s newer kevent-pipe entry kept after it. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 1335/1336** — the only failure is the known `main` regression (`agc_driver_tessellation` segfault, #4727), not this PR **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/6962 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `7fe77f717`.
DavidSamir commented 2026-10-18 06:05:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-18T06:05:45Z.


Closing this as superseded by #7139 (merged 2026-10-18, AlexOfTheForest). On main 66e71b63d1, poll_nid_postfix answers any vnode through File::IsVnode with POLLIN, POLLRDNORM and POLLOUT, and never with POLLPRI, POLLRDBAND or POLLWRBAND. That is this PR's rule, and it also covers directories, /dev/random and descriptors 0 to 2. PollsFilesAndDirectories in GuestPoll.cpp checks the same cases as this PR's TestRegularFile: a file is ready at once, a band-only request waits out the timeout, and a socket and a file can be mixed in one call. Merging main here now conflicts in both the test and the debt entry, and resolving it would only drop this PR's code.

Thanks to @Dextroid17 and @karimibrahim07 for the Linux and Windows runs, and to @blawesom for the rebase.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6246384219 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6962#issuecomment-6246384219). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-18T06:05:45Z. --- Closing this as superseded by #7139 (merged 2026-10-18, AlexOfTheForest). On `main` 66e71b63d1, `poll_nid_postfix` answers any vnode through `File::IsVnode` with `POLLIN`, `POLLRDNORM` and `POLLOUT`, and never with `POLLPRI`, `POLLRDBAND` or `POLLWRBAND`. That is this PR's rule, and it also covers directories, `/dev/random` and descriptors 0 to 2. `PollsFilesAndDirectories` in `GuestPoll.cpp` checks the same cases as this PR's `TestRegularFile`: a file is ready at once, a band-only request waits out the timeout, and a socket and a file can be mixed in one call. Merging `main` here now conflicts in both the test and the debt entry, and resolving it would only drop this PR's code. Thanks to @Dextroid17 and @karimibrahim07 for the Linux and Windows runs, and to @blawesom for the rebase. AI-assisted: yes

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6962
No description provided.