feat(libSceLibcInternal): implement std::_Mtx_init_with_default_name_override #16029

Merged
JJenkx merged 3 commits from upstream-pr/16029 into main 2026-11-08 16:17:11 +00:00
JJenkx commented 2026-11-05 11:52:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-05T11:52:12Z.


What

std::_Mtx_init_with_default_name_override in libSceLibcInternal (the __sce_v236 symbol _ZNSt8__sce_v236_Mtx_init_with_default_name_overrideEPP13pthread_mutexiPKc, NID naKdJL9d3nE) was a recovered-inventory placeholder that threw NotImplemented. PPSA16064 imports it.

It now forwards to libc's std::_Mtx_init_with_name (__sce_v219) with the same arguments. The mangled name fixes the parameter types (pthread_mutex**, int, const char*), and the result is that function's _Thrd code.

  • The mutex is a kernel mutex under the given name.
  • It is recursive when the type has the recursive bit (0x100).
  • A null or empty name creates an unnamed mutex.

This matches libc's own unversioned _Mtx_init_with_default_name_override, which already forwards to _Mtx_init_with_name.

Debt:

  • New entry: whether the console substitutes a default name such as SceLibcI_Mtx for a null name is not measured.
  • The "Recovered inventory exports" entry now counts 39 placeholders.

Tested

Linux 7.2.11, GCC 16.2.1, Release: head b792fe2346 merged onto main e322066f82 (see the Linux check comment).

guest_libc_internal_mtx, extended:

  • A named recursive mutex locks twice, is held against another thread, unlocks twice and is destroyed.
  • A plain mutex created with a null name refuses a second lock with busy (3).

guest_libc_internal_mtx and guest_libc_threads pass. On main the new calls throw NotImplemented.

Not tested on PPSA16064.

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:5171083138 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16029). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-05T11:52:12Z. --- ### What `std::_Mtx_init_with_default_name_override` in libSceLibcInternal (the `__sce_v236` symbol `_ZNSt8__sce_v236_Mtx_init_with_default_name_overrideEPP13pthread_mutexiPKc`, NID `naKdJL9d3nE`) was a recovered-inventory placeholder that threw `NotImplemented`. PPSA16064 imports it. It now forwards to libc's `std::_Mtx_init_with_name` (`__sce_v219`) with the same arguments. The mangled name fixes the parameter types (`pthread_mutex**`, `int`, `const char*`), and the result is that function's `_Thrd` code. - The mutex is a kernel mutex under the given name. - It is recursive when the type has the recursive bit (0x100). - A null or empty name creates an unnamed mutex. This matches libc's own unversioned `_Mtx_init_with_default_name_override`, which already forwards to `_Mtx_init_with_name`. **Debt:** - New entry: whether the console substitutes a default name such as `SceLibcI_Mtx` for a null name is not measured. - The "Recovered inventory exports" entry now counts 39 placeholders. ### Tested Linux 7.2.11, GCC 16.2.1, Release: head `b792fe2346` merged onto `main` `e322066f82` (see the Linux check comment). `guest_libc_internal_mtx`, extended: - A named recursive mutex locks twice, is held against another thread, unlocks twice and is destroyed. - A plain mutex created with a null name refuses a second lock with busy (3). `guest_libc_internal_mtx` and `guest_libc_threads` pass. On `main` the new calls throw `NotImplemented`. Not tested on PPSA16064. ### 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
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!16029
No description provided.