fix(libkernel): poll files on standard descriptors as vnodes #10456
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10456"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by alnsx on 2026-10-24T01:29:59Z.
What
selectandpollapplied the standard-stream fallback before checking whether descriptors 0–2 referred to files. An empty file duplicated onto stdin therefore reported no readiness, even at EOF.Check for a vnode first, so redirected files use the same readiness rules as files at any other descriptor. Tests cover all three standard descriptors, read/write readiness, exclusion of priority events, EOF and stream restoration.
This follows the existing FreeBSD model:
selscanpolls the file object andvop_stdpollsupplies ordinary read/write readiness. This also applies to files inherited through host redirection. Console behavior remains unmeasured.Tested
Linux 7.2.6, GCC 13.3, Release; base
e13027a1f399062d663d095ab1db139b91de0887, SPIRV-Tools disabled.0119103fa9, head7eecb44157rebuilds all libraries/relinker and passes the same 8 focused tests (Linux, 2026-10-25). This includes the merged #9365 documentation corrections.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T05:02:09Z.
Review: COMMENTED
Checked against main
6c52b649e7and FreeBSD 11.4vop_stdpoll/selscan:File::IsVnodeonly accepts regular files, directories and archived files (S_ISREG/S_ISDIRon Linux,FILE_TYPE_DISKon Windows), so a pipe or terminal on 0-2 still takes the standard-stream fallback, and the vnode readiness matchesvop_stdpoll(no POLLPRI, no POLLHUP).IsVnodecan't tell a guestdup2from a host redirection. Launching with< fileon Linux now makes fd 0 always readable, and Dungeons (PPSA16064) selects on fd 0, so it would start reading host stdin. With> log.txt, fd 1 and 2 become readable too. Main's poll entry (docs/dev/debt/libkernel.md:213) still says 0-2 follow the console model "whatever the host attaches to them", which is no longer true for files. Could that line be updated together with the select one?/dev/random/randomdev_pollset-reporting rule and thekqueue_pollsentence. Could they be kept, with only the standard-descriptor part changed?select_nid_postfix, so it picks this up; #9945's NUL handles are character devices and keep the fallback (from reading only, not run on Windows).Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.