Repository navigation
feat(libSceNet): implement the net thread calls and refuse network emulation - #8254
Conversation
|
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.
|
50eaa10 to
ca1fe58
Compare
|
Rebased onto current
|
|
I am reviewing #9506, which adds |
ca1fe58 to
eaa6d86
Compare
|
@MarcZX10 no shared exports. This PR does Also rebased onto |
|
The local deterministic resolver-test change for #9609 adds an internal test hook in |
…ceNetThreadJoin The thread runs the entry and argument of the caller's parameter block on a guest thread; a null block fails with EINVAL.
…EmulationSet Network emulation exists only on development units.
eaa6d86 to
42961e1
Compare
|
@MarcZX10 your resolver test hook is already on |
harisibrar1
left a comment
There was a problem hiding this comment.
Checked against main 522e32e and shadPS4 a808e76 src/core/libraries/net/net.cpp:
- It still merges cleanly with current main. The five exports still throw on main, and the debt lines you edit and remove are unchanged there.
- The new libkernel imports (
scePthreadCreate,scePthreadJoin,scePthreadExit) are all longer than 11 characters, so the Windows PE NID patcher shouldn't hit the import-name length limit, and their declarations match libkernel's definitions. - The parameter block, the null-param
EINVALand the emulationEOPNOTSUPPmatch shadPS4, which also reads the block on the new thread. The debt entry describes the one real difference accurately: errors are returned raw, where shadPS4 returnsKERNEL_ERROR_UNKNOWN + eand sets the net errno. - No made-up success: the emulation calls fail, and the thread calls do real work. LGTM.
Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
|
Re-checked against current main (e512cd5): the only main change in Export.cpp is sceNetShowPolicy, which doesn't touch these exports, so the merge is clean. The head is unchanged; EINVAL on a null block, EOPNOTSUPP for both emulation calls and the guest_net_thread assertions still hold. Merged. |
… emulation behaviour comes from Ours already implements the net thread and emulation exports more completely (copied parameter, exit flag, ERETURN) with tests in GuestSceNet; only took the PR's RunNetThread name for our trampoline, dropped its duplicate GuestNetThread test and debt. (cherry picked from commit 04696b6953588b26f4c8c67805e5f2c29b4a95b9)
What
Implements five libSceNet exports that were declared without parameters and threw:
sceNetThreadCreate(Pthread* thread, param, const char* name)starts a guest thread (scePthreadCreate) that calls theentry(arg)of the caller's parameter block{ entry, arg, reserved, flags }, and writes the thread tothreadwhen it is not null. A null block fails withEINVAL(0x80410116, errno 22), the convention the library uses for its other failures.sceNetThreadExit()ends the calling thread (scePthreadExit), andsceNetThreadJoin(Pthread)joins one (scePthreadJoin).sceNetEmulationGetandsceNetEmulationSetreturnEOPNOTSUPP(0x8041012D, errno 45).The signatures, the block layout and the emulation result follow shadPS4 (PS4); none is measured on a PS5. The new debt entry says so and lists where this differs from shadPS4:
flagsis ignored (shadPS4 ends the thread withpthread_exitwhen bit 0 is set, which ends it the same way), and a failingscePthreadCreateorscePthreadJoinresult is returned as it is without setting the net errno. The five "unknown signature" entries are removed.sceNetGetStatisticsInfois left out on purpose: shadPS4 fills it with invented free-memory figures, and there is nothing measured to report instead.Tested
Linux (Fedora 44, GCC, Ninja,
-DBUILD_TESTING=ON), based onmaine9cc4a8efb:guest_net_thread(core/libs/tests/GuestNetThread.cpp): a thread runs its entry with its argument and joins; a null block returnsEINVAL, sets errno and leaves the output alone; a thread that callssceNetThreadExitstops before the rest of its entry and still joins; a null thread output is accepted and the thread runs; both emulation calls returnEOPNOTSUPPand set errno. It passed 20 of 20 runs. It fails when the thread does not call the entry, whensceNetThreadExitreturns instead of ending the thread, and whensceNetEmulationGetreturns 0.guest_sce_netstill passes.ctest: 1671 of 1676 pass. The 5 failures (application_heap_scripting,application_heap_lazy,agc_driver_bda_device,agc_driver_guest_memory_lifetime,agc_driver_tessellation) fail the same way onmainon this machine.tools/progress.py --compare: libraries +0.09%; it counts the five exports plus the internal thread entryRunNetThread.tools/check_conventions.py --base upstream/mainpasses.tools/pr_overlap.pylists only PRs that conflict withmainand shareExport.cpp, the debt file orCMakeLists.txt(fix(libSceNet): stop Sackboy loading retries on peer sockets #5836, test: organize library tests and label CTest suites #6044, Macos port #7201, feat: macOS on Apple Silicon host support (Rosetta 2 and MoltenVK) #7332, feat(prx): declare the missing PS5 3.20 system exports #8106); none of their diffs touches these functions.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)