feat(libSceNetCtl): add sceNetCtlGetIfStat #4682
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4682"
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 bubblegg on 2026-10-12T18:57:41Z.
What
Adds sceNetCtlGetIfStat. PPSA09030 stops at load on main:
FAIL: unresolved ELF import teuK4QnJTGg from libSceNetCtl.prx
The title's VivoxNative.prx calls it with one pointer to a 56-byte structure
and reads 64-bit values at offsets 8 and 16 after a non-negative result, then
calls sceNetCtlGetState. The structure is laid out as device (u32), sent bytes
(u64), received bytes (u64), 8 reserved u32. The function fills the byte
counters from the host's hardware interfaces that are up, and returns
SCE_NET_CTL_ERROR_NOT_CONNECTED when the host has no address, as
sceNetCtlGetState reports it. The signature comes from that call site; I found
no public header that declares it.
Tested
Windows 11, WinLibs GCC 16.1.0. guest_sce_net passes and covers the new
function (null pointer, result against sceNetCtlGetState, counters not
decreasing). PPSA09030 gets past this import and stops at the next one
(QWSxBzf6lAg, libSceSsl), which is a separate change. The Linux path is not
built or run by me.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:11:20Z.
Code review location:
core/libs/prx/libSceNetCtl/Export.cpp; line 10This
#elsebranch also compiles on macOS, but<linux/if_link.h>and<netpacket/packet.h>are Linux-only headers. Since AnyPS5 supports macOS builds, this include will fail there before the new function can compile. Could the Linux-specific traffic-stat implementation be guarded with__linux__and use a macOS-compatible path (or an explicit unsupported fallback) for other non-Windows platforms?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:23:26Z.
Code review location:
core/libs/prx/libSceNetCtl/Export.cpp; line 105rtnl_link_stats::tx_bytesandrx_bytesare 32-bit counters (if_link.h), whileNetCtlIfStatexposes 64-bit totals. Widening here happens only after the 32-bit host counters have wrapped, so this reports incorrect totals after 4 GiB per interface. Could this read Linuxrtnl_link_stats64counters (or another 64-bit interface-counter API) instead? A test with a counter value aboveUINT32_MAXwould cover the regression.Imported from boykopovar/AnyPS5. Originally posted by bubblegg on 2026-10-12T19:30:59Z.
Code review location:
core/libs/prx/libSceNetCtl/Export.cpp; line 10fixed in 071f76d, thanks
Imported from boykopovar/AnyPS5. Originally posted by bubblegg on 2026-10-12T19:31:03Z.
Code review location:
core/libs/prx/libSceNetCtl/Export.cpp; line 105guarded with linux in dedbe7e, other platforms throw
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:32:18Z.
Code review location:
core/libs/prx/libSceNetCtl/Export.cpp; line 105Thanks—the current head reads Linux sysfs byte counters directly into
uint64_t, and the added helper regression uses a value aboveUINT32_MAX. That resolves my counter-width concern as well; I had initially reviewed the earlierrtnl_link_statsversion. The__linux__guard also resolves the macOS-header issue.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T21:11:04Z.
Progress report (
682ef0c→ 071f76d)📈 System libraries: 86.37% (+0.01%, +1 implemented functions)
✅ 1 implemented
sceNetCtlGetIfStatImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T21:17:28Z.
Checked the layout against SharpProspero's
SceNetCtlIfStatand the error values against KytyPS5;core/libsbuilds and its 24 tests pass on main + this PR, andguest_sce_netno longer compiles without the change.Added one commit on top: a TechnicalDebt line under "Unknown function info" for the signature inferred from the call site, the device kind fixed at 0, and the counters being host totals rather than "since cleared". Rebased onto current main.
The Windows path (
GetIfTable2) was not run here. Merging once CI is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T07:26:44Z.
The red
eligibilitycheck was a GitHub API rate limit on the runner (API rate limit exceeded for installation), not this diff; re-ran it. Nothing else changed since the earlier review: merging once CI is green.