Skip to content

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

Open
thuanquang wants to merge 1 commit into
boykopovar:mainfrom
thuanquang:docs/debt-sweep-kernel-sockets
Open

thuanquang wants to merge 1 commit into
boykopovar:mainfrom
thuanquang:docs/debt-sweep-kernel-sockets

Conversation

@thuanquang

@thuanquang thuanquang commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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; 5dcf28d, fix(libkernel): answer fcntl status flags on libSceNet sockets #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; 62d8eea, fix(libkernel): poll libSceNet sockets with the host wait #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 12b18af (fix(libkernel): close() and setsockopt() reach libSceNet sockets #4111), which merged before fix(libkernel): give guest sockets ordinary descriptor numbers below FD_SETSIZE #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. e99816e (fix(libkernel): give guest sockets ordinary descriptor numbers below FD_SETSIZE #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 1698d1e 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' 99844c7 and none of the changes affects these claims. Rechecked on main 6ef5a1c: of the cited files only libSceNet's Export.cpp and GuestSceNet.cpp changed since 1896871, 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 6ef5a1c).

  • 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

@thuanquang thuanquang changed the title docs(libkernel): correct five stale socket statements docs(libkernel): correct three stale socket statements Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8605 docs/dev/debt/libkernel.md L213-214
PR 9099 docs/dev/debt/libkernel.md L155-156

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4630 docs/dev/debt/libkernel.md
PR 5021 docs/dev/debt/libkernel.md
PR 6149 docs/dev/debt/libkernel.md
PR 6740 docs/dev/debt/libkernel.md
PR 6830 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 7049 docs/dev/debt/libkernel.md
PR 7088 docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7509 docs/dev/debt/libkernel.md
PR 7511 docs/dev/debt/libkernel.md
PR 7653 docs/dev/debt/libkernel.md
PR 8010 docs/dev/debt/libkernel.md
PR 8520 docs/dev/debt/libkernel.md
PR 8553 docs/dev/debt/libkernel.md
PR 9074 docs/dev/debt/libkernel.md
PR 9123 docs/dev/debt/libkernel.md
PR 9156 docs/dev/debt/libkernel.md
PR 9160 docs/dev/debt/libkernel.md
PR 9187 docs/dev/debt/libkernel.md
PR 9199 docs/dev/debt/libkernel.md
PR 9284 docs/dev/debt/libkernel.md
PR 9293 docs/dev/debt/libkernel.md
PR 9297 docs/dev/debt/libkernel.md
PR 9302 docs/dev/debt/libkernel.md
PR 9557 docs/dev/debt/libkernel.md
PR 9561 docs/dev/debt/libkernel.md
PR 9566 docs/dev/debt/libkernel.md
PR 9575 docs/dev/debt/libkernel.md
PR 9693 docs/dev/debt/libkernel.md
PR 9947 docs/dev/debt/libkernel.md
PR 10319 docs/dev/debt/libkernel.md

@MarcZX10

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

@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

Copy link
Copy Markdown
Contributor Author

@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 6ef5a1c: libSceNet's Export.cpp moved by 180 lines, and the cited code is unchanged.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
@thuanquang
thuanquang force-pushed the docs/debt-sweep-kernel-sockets branch from d2e813f to 66725a2 Compare October 23, 2026 10:15
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants