feat(libSceNet): implement the net thread calls and refuse network emulation #8254
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8254"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-20T07:09:08Z.
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(#5836, #6044, #7201, #7332, #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)Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-20T11:41:55Z.
Rebased onto current
main(headca1fe58df,maind50ec76da). The only conflict was indebt/libSceNet.md, wheremainadded thesceNetEtherStrtonentry at the same spot; I kept both.mainstill hassceNetThreadCreate,sceNetThreadExit,sceNetThreadJoin,sceNetEmulationGetandsceNetEmulationSetas stubs, and the added and removed lines match the previous head.guest_net_thread,guest_sce_net,guest_inet_addressand the datagram tests pass 3 of 3 here, andcheck_conventionshas no findings.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T02:07:08Z.
I am reviewing #9506, which adds
sceNetSetDnsInfo,sceNetSetDns6InfoandsceNetGetDns6Infoplus a new registered test and debt entry. The overlap bot could not compare some of these branches because of base conflicts, and this PR author has not yet recorded an agreed merge order. Please confirm whether your current changes overlap these exact exports, CMake/test insertion, or debt section, and whether #9506 can land before your PR or should depend on yours. The #9506 author is being asked to record the agreed order inDepends onand the overlap note.Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-22T05:33:56Z.
@MarcZX10 no shared exports. This PR does
sceNetThreadCreate,sceNetThreadExit,sceNetThreadJoin,sceNetEmulationGetandsceNetEmulationSet, and #9506 does the DNS info calls. Both add a test registration tolibSceNet/CMakeLists.txtand an entry todocs/dev/debt/libSceNet.md, so whichever lands second gets a text conflict there and nothing else. #9506 can land first, and I'll rebase this one on it.Also rebased onto
mainda54c652eafter #9137 (headeaa6d8655). #9137 declaredNetThreadParameterwithout a body. This PR's{ entry, arg, reserved, flags }block now completes that declaration, the calls takemain's parameter types, and the debt lines this PR settles (sceNetThreadExitstill returning int, and thread creation in the unsupported list) are removed.guest_net_threadpasses 3 of 3.Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T13:51:03Z.
Review: APPROVED
Checked against main
522e32e3b6and shadPS4 a808e76src/core/libraries/net/net.cpp: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.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.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.