libkernel: sceKernelFcntl is a stub while fcntl handles sockets; fix branch ready #3048

Closed
opened 2026-10-10 21:10:27 +00:00 by screamm · 1 comment
screamm commented 2026-10-10 21:10:27 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T21:10:27Z.


sceKernelFcntl (libkernel, Open.cpp) is a stub that calls NotImplemented_nid_no_patch, while the POSIX fcntl export already handles guest sockets (F_GETFL, F_SETFL with O_NONBLOCK) in Udp.cpp. A title that reaches the SDK's sceKernelFcntl therefore stops with the not-implemented error even for the socket cases fcntl supports.

Fix branch ready: screamm:feat/libkernel-scekernelfcntl (f0c64970, one commit on main 56fb1b3b). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.

  • sceKernelFcntl(int fd, int cmd, ...) delegates socket descriptors to the fcntl export and returns its guest errno as SCE_KERNEL_ERROR_*, the form the other sceKernel file exports use (sceKernelOpen, sceKernelMkdir). A closed or out-of-range descriptor returns SCE_KERNEL_ERROR_EBADF.
  • File descriptors throw (sceKernelFcntl: file descriptors are not implemented): their open flags are not tracked, so F_GETFL/F_SETFL cannot be answered truthfully. Recorded in TechnicalDebt together with the unsupported F_DUPFD/F_GETFD/F_SETFD.
  • New guest_kernel_fcntl covers the socket flag round trip, ENOTSUP for an unsupported flag, EINVAL for an unknown command, EBADF for closed, negative and never-opened descriptors, and the file-descriptor exception.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_kernel_fcntl 3/3 (--repeat until-fail:3); ctest -j8 -E "^agc_|video_out" 389/389; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5795305441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3048). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T21:10:27Z. --- `sceKernelFcntl` (libkernel, [Open.cpp](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libkernel/File/src/Open.cpp)) is a stub that calls `NotImplemented_nid_no_patch`, while the POSIX `fcntl` export already handles guest sockets (`F_GETFL`, `F_SETFL` with `O_NONBLOCK`) in [Udp.cpp](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libkernel/Socket/src/Udp.cpp). A title that reaches the SDK's `sceKernelFcntl` therefore stops with the not-implemented error even for the socket cases `fcntl` supports. **Fix branch ready:** [`screamm:feat/libkernel-scekernelfcntl`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-scekernelfcntl) (`f0c64970`, one commit on `main` `56fb1b3b`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. - `sceKernelFcntl(int fd, int cmd, ...)` delegates socket descriptors to the `fcntl` export and returns its guest errno as `SCE_KERNEL_ERROR_*`, the form the other `sceKernel` file exports use (`sceKernelOpen`, `sceKernelMkdir`). A closed or out-of-range descriptor returns `SCE_KERNEL_ERROR_EBADF`. - File descriptors throw (`sceKernelFcntl: file descriptors are not implemented`): their open flags are not tracked, so `F_GETFL`/`F_SETFL` cannot be answered truthfully. Recorded in TechnicalDebt together with the unsupported `F_DUPFD`/`F_GETFD`/`F_SETFD`. - New `guest_kernel_fcntl` covers the socket flag round trip, `ENOTSUP` for an unsupported flag, `EINVAL` for an unknown command, `EBADF` for closed, negative and never-opened descriptors, and the file-descriptor exception. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_kernel_fcntl` 3/3 (`--repeat until-fail:3`); `ctest -j8 -E "^agc_|video_out"` 389/389; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. Written with Claude Code assistance.
oneandonlydean commented 2026-10-11 01:08:46 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T01:08:46Z.


Fixed by #3078.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104055839 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3048#issuecomment-6104055839). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T01:08:46Z. --- Fixed by #3078.
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#3048
No description provided.