libkernel_sys: fpathconf on a kqueue or shm descriptor returns the UFS constants instead of EOPNOTSUPP #11291

Closed
opened 2026-10-26 00:25:10 +00:00 by oneandonlydean · 0 comments
oneandonlydean commented 2026-10-26 00:25:10 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-26T00:25:10Z.


fpathconf on a descriptor with no vnode only special-cases FIFOs and sockets, so a kqueue and a shm_open(SHM_ANON, ...) descriptor still get the UFS constants. I haven't run this myself; the numbers are from wachi35676's runs on Windows and WSL2 in https://github.com/boykopovar/AnyPS5/pull/10427#issuecomment-6405135062.

In those runs _PC_LINK_MAX / _PC_NAME_MAX / _PC_PIPE_BUF return 32767 / 255 / 512 for both descriptor kinds. FreeBSD 11.4 returns -1 with EOPNOTSUPP (kern_fpathconf, kern_descrip.c:1411-1429): after _PC_ASYNC_IO, which is answered for every descriptor and is 200112 on both sides, only descriptors with a vnode, pipes and sockets are answered.

The code is _fpathconf_nid_postfix in core/libs/prx/libkernel_sys/Export.cpp. This isn't caused by #10427; that PR just made the gap visible. A guest test next to the existing socket cases would cover it.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6031091002 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/11291). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-26T00:25:10Z. --- `fpathconf` on a descriptor with no vnode only special-cases FIFOs and sockets, so a kqueue and a `shm_open(SHM_ANON, ...)` descriptor still get the UFS constants. I haven't run this myself; the numbers are from wachi35676's runs on Windows and WSL2 in https://github.com/boykopovar/AnyPS5/pull/10427#issuecomment-6405135062. In those runs `_PC_LINK_MAX / _PC_NAME_MAX / _PC_PIPE_BUF` return 32767 / 255 / 512 for both descriptor kinds. FreeBSD 11.4 returns -1 with `EOPNOTSUPP` (`kern_fpathconf`, kern_descrip.c:1411-1429): after `_PC_ASYNC_IO`, which is answered for every descriptor and is 200112 on both sides, only descriptors with a vnode, pipes and sockets are answered. The code is `_fpathconf_nid_postfix` in `core/libs/prx/libkernel_sys/Export.cpp`. This isn't caused by #10427; that PR just made the gap visible. A guest test next to the existing socket cases would cover it.
Sign in to join this conversation.
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#11291
No description provided.