docs(libkernel): correct three stale socket statements #9365

Merged
thuanquang merged 1 commit from upstream-pr/9365 into main 2026-10-25 10:47:06 +00:00
thuanquang commented 2026-10-21 19:21:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T19:21:13Z.


What

Three statements in docs/dev/debt/libkernel.md no longer match main; each is replaced with what main does now, and nothing else in the entries changes.

  • [close] and [setsockopt]: "as select polls them; the other libkernel socket calls do not". On a libSceNet socket, fcntl and _fcntl now go to the status-control hook (core/libs/prx/libkernel/Socket/src/Udp.cpp:1061; registered at core/libs/prx/libSceNet/Export.cpp:928; 5dcf28d36c, #4924). That hook answers F_GETFL and F_SETFL and fails every other command with EINVAL (Export.cpp:915-917; pinned by core/libs/tests/GuestSceNet.cpp:883). poll now waits on the native socket that the native-lookup hook returns (Udp.cpp:1714; Export.cpp:939; 62d8eeae76, #4933). getsockopt, ioctl and the other socket calls still do not reach these sockets (Udp.cpp:1130, 1360). Now: "as select and poll poll them and fcntl answers F_GETFL and F_SETFL, failing other commands with EINVAL; the other libkernel socket calls do not".
  • [Socket descriptor numbers]: ", and libkernel close of a libSceNet socket releases the number but leaves the libSceNet socket open". close_nid_postfix calls the libSceNet closer first (core/libs/prx/libkernel/File/src/Stdio.cpp:728-731). That closer runs sceNetSocketClose (core/libs/prx/libSceNet/Export.cpp:866-873), which erases the socket, releases the number and shuts down the native socket (Export.cpp:1016-1032). This came from 12b18af550 (#4111), which merged before #4391 added the sentence. sceKernelClose checks only libkernel's own socket table and closes the placeholder (core/libs/prx/libkernel/File/src/Open.cpp:296-314), so the gap is still open there. Now: ", and libkernel sceKernelClose of a libSceNet socket releases the number but leaves the libSceNet socket open".
  • [select] (second entry): "a descriptor the socket poller reports as unknown that is below GuestSockets::FirstDescriptor is polled on the host". GuestSockets::FirstDescriptor no longer exists on main. e99816e8f3 (#4391) removed it along with both range checks in select. select_nid_postfix now moves every net entry the poller reports as unknown into the host group without a range check (core/libs/prx/libkernel/Socket/src/Socket.cpp:237-247). Now: "a descriptor the socket poller reports as unknown is polled on the host".

Tested

Docs only; nothing was built or run. Rebased onto main f23c4b38d6: the only conflict was main's rewording of the next entry ([sceKernelPread ...]), which is kept as on main. Every cited line in What was rechecked on f23c4b38d6, and the line numbers there are the current ones; the code behind the three statements is unchanged in substance (libkernel's ioctl still sends any descriptor that is not its own socket to the file path, Udp.cpp:1361). Earlier checks: on origin/main 1698d1ea6a I read the libSceNet hooks in libSceNet/Export.cpp (now 866-939, 1016-1032) and in libkernel's Udp.cpp (Lookup, fcntl, setsockopt, getsockopt, ioctl, connect, send, sendfile, poll); I also read select in Socket.cpp, close in Stdio.cpp, sceKernelClose in Open.cpp, the SO_ERROR path in SocketOptions.cpp, and the tests the bullets cite; I diffed the files changed since the verifiers' 99844c7eef and none of the changes affects these claims. Rechecked on main 6ef5a1c4c9: of the cited files only libSceNet's Export.cpp and GuestSceNet.cpp changed since 1896871ba7, and the cited code only moved (Export.cpp lines 680-860 had become 860-1040, unchanged; the fcntl check was at GuestSceNet.cpp:778). Each statement was found by a read-only sweep of the debt files and confirmed by two independent verifier passes and a final check on current main.

Overlap, merge order only: #9515, opened after this PR, adds getsockopt to the [close] and [setsockopt] sentence that the first bullet corrects, and #9578 carries the same edit through #9515's commits. As agreed with their author in this thread, this PR goes first: #9515 lists it under Depends on: and puts its edit on top when it rebases. No other open pull request edits these three sentences (checked against every open PR's diff of this file on 6ef5a1c4c9).

  • Rebased onto main 50757b01c6 for an adjacent-line conflict (#9099 reworded the pipes entry next to the edited one); the three edited entries are unchanged on main. Rechecked on 30be9b428b (the cited files are unchanged up to 50757b01c6) by two independent read-throughs per statement. The line numbers in What are from f23c4b38d6; current ones: fcntl's status-control hook Udp.cpp:1086, poll's native lookup Udp.cpp:1761, getsockopt Udp.cpp:1157, ioctl Udp.cpp:1401; in libSceNet Export.cpp the status-control hook at :934-:959 (F_GETFL :944, EINVAL :948-:951) registered at :961, the native lookup registered at :972, the closer CloseSocketForKernel at :899-:906 and sceNetSocketClose at :1049-:1076; the EINVAL pin GuestSceNet.cpp:912; sceKernelClose at Open.cpp:298-:317; close_nid_postfix Stdio.cpp:728-:731 and select's move loop Socket.cpp:237-:247 unchanged.
  • python tools/check_conventions.py --base origin/main with this title and body: 0 errors and 2 debt-length warnings, for entries that were already over 1000 characters: select (1447 characters before, 1086 after this change); Socket descriptor numbers (1098 characters before, 1107 after this change).
  • Not tested: behaviour on any machine; this changes text only.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4957095427 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9365). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-21T19:21:13Z. --- ### What Three statements in `docs/dev/debt/libkernel.md` no longer match `main`; each is replaced with what `main` does now, and nothing else in the entries changes. - **[close] and [setsockopt]**: "as `select` polls them; the other libkernel socket calls do not". On a libSceNet socket, `fcntl` and `_fcntl` now go to the status-control hook (core/libs/prx/libkernel/Socket/src/Udp.cpp:1061; registered at core/libs/prx/libSceNet/Export.cpp:928; 5dcf28d36c, #4924). That hook answers `F_GETFL` and `F_SETFL` and fails every other command with `EINVAL` (Export.cpp:915-917; pinned by core/libs/tests/GuestSceNet.cpp:883). `poll` now waits on the native socket that the native-lookup hook returns (Udp.cpp:1714; Export.cpp:939; 62d8eeae76, #4933). getsockopt, ioctl and the other socket calls still do not reach these sockets (Udp.cpp:1130, 1360). Now: "as `select` and `poll` poll them and `fcntl` answers `F_GETFL` and `F_SETFL`, failing other commands with `EINVAL`; the other libkernel socket calls do not". - **[Socket descriptor numbers]**: ", and libkernel `close` of a libSceNet socket releases the number but leaves the libSceNet socket open". `close_nid_postfix` calls the libSceNet closer first (core/libs/prx/libkernel/File/src/Stdio.cpp:728-731). That closer runs `sceNetSocketClose` (core/libs/prx/libSceNet/Export.cpp:866-873), which erases the socket, releases the number and shuts down the native socket (Export.cpp:1016-1032). This came from 12b18af550 (#4111), which merged before #4391 added the sentence. `sceKernelClose` checks only libkernel's own socket table and closes the placeholder (core/libs/prx/libkernel/File/src/Open.cpp:296-314), so the gap is still open there. Now: ", and libkernel `sceKernelClose` of a libSceNet socket releases the number but leaves the libSceNet socket open". - **[select]** (second entry): "a descriptor the socket poller reports as unknown that is below `GuestSockets::FirstDescriptor` is polled on the host". `GuestSockets::FirstDescriptor` no longer exists on main. e99816e8f3 (#4391) removed it along with both range checks in select. `select_nid_postfix` now moves every net entry the poller reports as unknown into the host group without a range check (core/libs/prx/libkernel/Socket/src/Socket.cpp:237-247). Now: "a descriptor the socket poller reports as unknown is polled on the host". ### Tested Docs only; nothing was built or run. Rebased onto `main` `f23c4b38d6`: the only conflict was `main`'s rewording of the next entry ([sceKernelPread ...]), which is kept as on `main`. Every cited line in What was rechecked on `f23c4b38d6`, and the line numbers there are the current ones; the code behind the three statements is unchanged in substance (libkernel's `ioctl` still sends any descriptor that is not its own socket to the file path, Udp.cpp:1361). Earlier checks: on origin/main 1698d1ea6a I read the libSceNet hooks in libSceNet/Export.cpp (now 866-939, 1016-1032) and in libkernel's Udp.cpp (Lookup, fcntl, setsockopt, getsockopt, ioctl, connect, send, sendfile, poll); I also read select in Socket.cpp, close in Stdio.cpp, sceKernelClose in Open.cpp, the SO_ERROR path in SocketOptions.cpp, and the tests the bullets cite; I diffed the files changed since the verifiers' 99844c7eef and none of the changes affects these claims. Rechecked on `main` 6ef5a1c4c9: of the cited files only libSceNet's Export.cpp and GuestSceNet.cpp changed since 1896871ba7, and the cited code only moved (Export.cpp lines 680-860 had become 860-1040, unchanged; the `fcntl` check was at GuestSceNet.cpp:778). Each statement was found by a read-only sweep of the debt files and confirmed by two independent verifier passes and a final check on current `main`. **Overlap, merge order only:** #9515, opened after this PR, adds `getsockopt` to the [close] and [setsockopt] sentence that the first bullet corrects, and #9578 carries the same edit through #9515's commits. As agreed with their author in this thread, this PR goes first: #9515 lists it under `Depends on:` and puts its edit on top when it rebases. No other open pull request edits these three sentences (checked against every open PR's diff of this file on 6ef5a1c4c9). - Rebased onto `main` `50757b01c6` for an adjacent-line conflict (#9099 reworded the pipes entry next to the edited one); the three edited entries are unchanged on `main`. Rechecked on `30be9b428b` (the cited files are unchanged up to `50757b01c6`) by two independent read-throughs per statement. The line numbers in What are from `f23c4b38d6`; current ones: fcntl's status-control hook `Udp.cpp:1086`, poll's native lookup `Udp.cpp:1761`, getsockopt `Udp.cpp:1157`, ioctl `Udp.cpp:1401`; in libSceNet `Export.cpp` the status-control hook at `:934`-`:959` (`F_GETFL` `:944`, `EINVAL` `:948`-`:951`) registered at `:961`, the native lookup registered at `:972`, the closer `CloseSocketForKernel` at `:899`-`:906` and `sceNetSocketClose` at `:1049`-`:1076`; the `EINVAL` pin `GuestSceNet.cpp:912`; `sceKernelClose` at `Open.cpp:298`-`:317`; `close_nid_postfix` `Stdio.cpp:728`-`:731` and select's move loop `Socket.cpp:237`-`:247` unchanged. - `python tools/check_conventions.py --base origin/main` with this title and body: 0 errors and 2 `debt-length` warnings, for entries that were already over 1000 characters: select (1447 characters before, 1086 after this change); Socket descriptor numbers (1098 characters before, 1107 after this change). - Not tested: behaviour on any machine; this changes text only. ### 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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-22 00:06:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T00:06:54Z.


A new open PR, #9515, now changes the same docs/dev/debt/libkernel.md socket-call sentence and also adds libkernel getsockopt support for libSceNet sockets. Your description currently says no open PR edits these sentences, and both PR checklists say Depends on: none. CONTRIBUTING.md asks overlap authors to agree on merge order and declare the dependency. Please coordinate with #9515’s author and update the description/checklist to reflect the agreed order.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329371832 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9365#issuecomment-6329371832). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T00:06:54Z. --- A new open PR, #9515, now changes the same `docs/dev/debt/libkernel.md` socket-call sentence and also adds libkernel `getsockopt` support for libSceNet sockets. Your description currently says no open PR edits these sentences, and both PR checklists say `Depends on: none`. `CONTRIBUTING.md` asks overlap authors to agree on merge order and declare the dependency. Please coordinate with #9515’s author and update the description/checklist to reflect the agreed order.
EagleBearerYS commented 2026-10-22 00:40:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T00:40:21Z.


@thuanquang a merge-order note: #9515 adds getsockopt to the close and setsockopt entry of docs/dev/debt/libkernel.md, the sentence your first bullet corrects. It opened after your check, so the description's "No open pull request edits these sentences" no longer holds for that entry. This one goes first: #9515 lists it under Depends on and puts its edit on top of yours when it rebases.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6329827686 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9365#issuecomment-6329827686). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-22T00:40:21Z. --- @thuanquang a merge-order note: #9515 adds `getsockopt` to the `close` and `setsockopt` entry of `docs/dev/debt/libkernel.md`, the sentence your first bullet corrects. It opened after your check, so the description's "No open pull request edits these sentences" no longer holds for that entry. This one goes first: #9515 lists it under Depends on and puts its edit on top of yours when it rebases.
thuanquang commented 2026-10-22 03:45:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-22T03:45:43Z.


@EagleBearerYS @MarcZX10 thanks. Agreed: this one goes first, and #9515 puts its getsockopt addition on top when it rebases. The description now names #9515, and #9578, which carries the same edit through #9515's commits, with that order. Its line numbers now match main 6ef5a1c4c9: libSceNet's Export.cpp moved by 180 lines, and the cited code is unchanged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332171998 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9365#issuecomment-6332171998). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-22T03:45:43Z. --- @EagleBearerYS @MarcZX10 thanks. Agreed: this one goes first, and #9515 puts its `getsockopt` addition on top when it rebases. The description now names #9515, and #9578, which carries the same edit through #9515's commits, with that order. Its line numbers now match `main` 6ef5a1c4c9: libSceNet's Export.cpp moved by 180 lines, and the cited code is unchanged.
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!9365
No description provided.