feat(libSceNet): implement sceNetUsleep and sceNetInetPtonEx #7823

Merged
Chikimaro merged 1 commit from upstream-pr/7823 into main 2026-10-19 13:22:02 +00:00
Chikimaro commented 2026-10-19 09:03:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Chikimaro on 2026-10-19T09:03:34Z.


What

Implements two of the libSceNet exports #6603 declared without parameters:

  • sceNetUsleep(int microseconds) fails with EINVAL (0x80410116) for a negative count and otherwise sleeps through libkernel's sceKernelUsleep, so the sleep stays a cancellation point, and returns 0.
  • sceNetInetPtonEx(int af, const char* src, void* dst, int flags) converts as sceNetInetPton does when flags is 0, including its results and errors. Any other flags throw, since their meaning is not known.

Both signatures and the negative-count error follow shadPS4's net.cpp; shadPS4 also forwards sceNetInetPtonEx to sceNetInetPton and does not know its flags. They are not measured on a console, and the two entries in docs/dev/debt/libSceNet.md now say so in place of "unknown signature".

No open PR names either function. tools/pr_overlap.py could not compare #5836, #6044, #7201, #7332 and #7511 because they conflict with main; their diffs touch neither function, their debt entries nor the lines of GuestSceNet.cpp this changes.

Tested

Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 (UCRT), Release, full build with -DBUILD_TESTING=ON, on main eaae7e069; after the rebase onto 959cfdd1c the 22 tests matching sce_net|datagram|socket_host_write|refused_connect|net_ctl|guest_net were run again and pass.

  • guest_sce_net gains CheckInetPtonEx (IPv4 and IPv6 conversion matching sceNetInetPton, invalid text, an unsupported family, null source and destination, nonzero flags throwing) and CheckUsleep (0, a 2 ms sleep that takes at least 2 ms, a negative count failing with EINVAL). It passes 5 of 5 runs.
  • With Export.cpp from main, guest_sce_net fails with sceNetInetPtonEx not implemented.
  • Every test that links libSceNet (23, matching sce_net|datagram|socket_host_write|refused_connect|memory_pool|net_ctl|guest_net) passes.
  • tools/progress.py --module libSceNet: 54 of 222, from 52.
  • python3 tools/check_conventions.py --base origin/main passes.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4918472815 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7823). Originally posted by [Chikimaro](https://github.com/Chikimaro) on 2026-10-19T09:03:34Z. --- ### What Implements two of the `libSceNet` exports #6603 declared without parameters: - `sceNetUsleep(int microseconds)` fails with `EINVAL` (`0x80410116`) for a negative count and otherwise sleeps through libkernel's `sceKernelUsleep`, so the sleep stays a cancellation point, and returns 0. - `sceNetInetPtonEx(int af, const char* src, void* dst, int flags)` converts as `sceNetInetPton` does when `flags` is 0, including its results and errors. Any other flags throw, since their meaning is not known. Both signatures and the negative-count error follow [shadPS4's net.cpp](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/net/net.cpp); shadPS4 also forwards `sceNetInetPtonEx` to `sceNetInetPton` and does not know its flags. They are not measured on a console, and the two entries in `docs/dev/debt/libSceNet.md` now say so in place of "unknown signature". No open PR names either function. `tools/pr_overlap.py` could not compare #5836, #6044, #7201, #7332 and #7511 because they conflict with `main`; their diffs touch neither function, their debt entries nor the lines of `GuestSceNet.cpp` this changes. ### Tested Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 (UCRT), Release, full build with `-DBUILD_TESTING=ON`, on `main` eaae7e069; after the rebase onto 959cfdd1c the 22 tests matching `sce_net|datagram|socket_host_write|refused_connect|net_ctl|guest_net` were run again and pass. - `guest_sce_net` gains `CheckInetPtonEx` (IPv4 and IPv6 conversion matching `sceNetInetPton`, invalid text, an unsupported family, null source and destination, nonzero flags throwing) and `CheckUsleep` (0, a 2 ms sleep that takes at least 2 ms, a negative count failing with `EINVAL`). It passes 5 of 5 runs. - With `Export.cpp` from `main`, `guest_sce_net` fails with `sceNetInetPtonEx not implemented`. - Every test that links `libSceNet` (23, matching `sce_net|datagram|socket_host_write|refused_connect|memory_pool|net_ctl|guest_net`) passes. - `tools/progress.py --module libSceNet`: 54 of 222, from 52. - `python3 tools/check_conventions.py --base origin/main` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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
github-actions[bot] commented 2026-10-19 09:14:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T09:14:57Z.


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 6044 core/libs/tests/GuestSceNet.cpp
PR 7201 core/libs/prx/libSceNet/Export.cpp
PR 7332 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6263805484 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7823#issuecomment-6263805484). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T09:14:57Z. --- <!-- pr-overlap --> 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](https://www.github.com/boykopovar/AnyPS5/pull/5836) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/tests/GuestSceNet.cpp`<br>`docs/dev/debt/libSceNet.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestSceNet.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceNet/Export.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/tests/GuestSceNet.cpp` |
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!7823
No description provided.