Skip to content

fix(libSceNet): print the console's line for a negative sceNetUsleep - #10572

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
ZSWolt:fix/libscenet-usleep-negative-log
Oct 25, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
ZSWolt:fix/libscenet-usleep-negative-log

Conversation

@ZSWolt

@ZSWolt ZSWolt commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What

After sceNetInit, a negative count to sceNetUsleep now prints [LIBNET] usleep <count> and a newline to standard output before it fails with EINVAL, as the console does. Main already returned EINVAL for a negative count, but printed nothing.

The evidence is the firmware 13.60 payload run from #9076, which recorded this gap in docs/dev/debt/libSceNet.md:

  • In its console log, lines 283–284 are [LIBNET] usleep -1 and [LIBNET] usleep -2147483648.
  • They come from the counts 0xffffffffffffffff and 0xffffffff80000000, so the line prints the signed 32-bit count the call already uses.
  • The probe in the same gist (netutil_main.c) calls sceNetInit before these cases, so the line is printed after the init check. Before sceNetInit nothing is printed, as before; that case is unmeasured and stays in the debt entry.

Tested

  • Windows 11 with WSL2, Ubuntu 26.04.1, GCC 15.2.0, Release, BUILD_TESTING=ON.
  • CheckUsleep in guest_sce_net now captures standard output:
    • sceNetUsleep(0) prints nothing.
    • sceNetUsleep(-1) and sceNetUsleep(INT32_MIN) print exactly "[LIBNET] usleep -1\n[LIBNET] usleep -2147483648\n", and still fail with errno 22.
  • It aborts on main and passes with this change (3 runs).
  • Full ctest: 2028/2029. The one failure, agc_driver_multisample_retirement, also fails on main under WSL, where /dev/udmabuf is missing; it is unrelated to this change.
  • tools/check_conventions.py: all checks passed.
  • No open PR changes sceNetUsleep. The 30 open PRs that touch libSceNet/Export.cpp don't add or remove any line mentioning usleep or LIBNET.

Checklist

After sceNetInit, the console's sceNetUsleep prints
"[LIBNET] usleep <count>" to standard output for a negative count
before failing with EINVAL, as a payload measured on firmware 13.60
(boykopovar#9076). AnyPS5 failed without printing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the implementation and regression diff. The new diagnostic is emitted only after the existing g_net_inited guard and only for negative signed int inputs; it then preserves the existing EINVAL return path. The test captures stdout and checks zero, -1, and INT32_MIN, including exact signed formatting and errno. The evidence and scope are recorded in the debt entry, including the unmeasured pre-init case. GitHub eligibility, conventions, intake, labels, and report checks pass; platform build jobs were skipped by the eligibility gate. I did not rerun the contributor-reported WSL test suite locally.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

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 5836 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 7201 core/libs/prx/libSceNet/Export.cpp
PR 7511 core/libs/tests/GuestSceNet.cpp
PR 9494 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 9727 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 9733 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
PR 9948 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 10502 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The firmware capture and debt note provide a specific basis for the added negative-count log line, and the implementation preserves the existing initialization check and EINVAL result. The focused test asserts no output for zero, exact signed output for -1 and INT32_MIN, and errno preservation. The PR reports the WSL full-suite result with its unrelated /dev/udmabuf failure identified, plus conventions passing. Hosted eligibility, conventions, intake, labels and report checks pass; the build matrix was skipped by workflow selection. git diff --check on the PR head is clean. I approve.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The negative-count behavior and captured stdout tests remain sound; the previous approvals addressed the code. I manually followed up on the new overlap report. #5836 changes socket type/options, #7201 changes macOS resolver/socket paths, #8234 changes sceNetShowIfconfigWithMemory, #9727 changes resolver/epoll argument validation, #9733 changes macOS send/receive, #10502 changes socket names/netstat, and #7511 changes kernel socket timeout cases; none edits sceNetUsleep or its new CheckUsleep assertions. However, #6044 renames core/libs/tests/GuestSceNet.cpp to core/libs/tests/networking/GuestSceNet.cpp, so this PR’s test edit needs a coordinated order to avoid being left behind during the move. Please agree on the order with #6044’s author and update the dependency/merge coordination information as needed. The author reports its focused/full tests and conventions; hosted platform builds were skipped.

@ZSWolt

ZSWolt commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Thanks for going through the overlap list. I've asked on #6044 (#6044 (comment)) for this PR to land before the GuestSceNet.cpp move, with #6044 picking up the CheckUsleep change on its rebase, and offered to rebase onto the new path if its author prefers the reverse order. The Depends on line now records this. I'll update it once they answer.

@ZSWolt

ZSWolt commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 The #6044 order is now explicit in Depends on, and either order works. If #6044 lands first, I'll merge main and move the new CheckUsleep checks into core/libs/tests/networking/GuestSceNet.cpp. If this PR lands first, #6044's rename carries them when it rebases. I've also asked TaymKal on #6044 and will update the line if they prefer one order.

@ZSWolt

ZSWolt commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 #6044 was closed without merging, so the test-file move no longer applies; the Depends on line is updated.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on exact head 412c3cd91f3aa7563417fc512813527cb3535646: the prior #6044 blocker is cleared because #6044 is closed without merging and this PR now records Depends on: none.

A new overlap with open #10628 needs coordination before merge. I confirmed with git merge-tree that the current heads conflict in docs/dev/debt/libSceNet.md; the source changes are separate, but the two debt entries need to be retained together. Please agree with #10628's author which PR lands first and how the second will rebase, then record the dependency/order in the checklist as required by CONTRIBUTING. The existing code review and tests remain applicable; hosted checks are green for this PR, with product builds skipped by eligibility.

@ZSWolt

ZSWolt commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX10 @maximilianfv #10628 already lists this PR in its Depends on and will rebase after it merges, so the order is: this PR first, then #10628. The checklist here now records that.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on exact head 412c3cd91f3aa7563417fc512813527cb3535646. The overlap with #10628 is now explicitly ordered: #10572 lands first and #10628 declares Depends on: #10572 and will rebase to retain both debt entries. #6044 remains closed without merging, so it creates no dependency. My prior review of the implementation and CheckUsleep regression still applies; the author reports the focused checks and WSL full suite, with the unrelated /dev/udmabuf failure identified. Hosted eligibility/conventions/intake/labels/report pass; platform builds were skipped. The PR is ready for maintainer review.

@oneandonlydean oneandonlydean self-assigned this Oct 25, 2026
@oneandonlydean
oneandonlydean merged commit e599efd into boykopovar:main Oct 25, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants