Files
AnyPS5/core/libs/prx/libkernel/File
JJenkxandClaude Opus 5.5 6157b85375 fix(libkernel): fail a select with EBADF when its pipe closes during the wait on Windows
On Windows, closing a pipe while another thread waited for it in select
terminated the process. The close releases the host handle before the C
runtime descriptor, so in between:

- the readiness query of the pipe failed on the dead handle and threw
  'querying pipe descriptor ... failed';
- after that, DescriptorIsOpen still saw the descriptor mapped, select
  looked it up again, found no known kind and threw 'is neither a
  socket, a pipe, ...'.

QueryPipe now reports a descriptor whose handle is no longer a pipe as
not a pipe instead of throwing, DescriptorIsOpen on Windows also checks
that the mapped handle is still valid, and select answers EBADF for such
a descriptor before throwing for an unknown kind, as FreeBSD 11.4's
kern_select does for a descriptor closed during the wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 19:19:53 -04:00
..