feat(libSceLibcInternal): implement getprogname #3347

Merged
overlordxrz-source merged 1 commit from upstream-pr/3347 into main 2026-10-11 08:49:27 +00:00
overlordxrz-source commented 2026-10-11 08:24:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-11T08:24:19Z.


What

getprogname (7Psx1DlAyE4) is now the first startup stop on Linux for two catalog titles, Yamagi Quake II (PPSA99007) and Emby5 (PPSA99515). Both import it from libSceLibcInternal. Before #3031 (merged 10-11), both titles stopped at pthread_set_name_np; the rig re-run below is on current main b490b387. PSBox Cloud Gaming (PPSA99810) imports it from libSceLibcInternal too.

#1595, #1869 and #2218 were closed because no title reached getprogname on main. This PR has the title IDs and log lines that were asked for. The change takes the same approach as #2218 (MichalSy), credited here: it returns the __progname that libkernel already exports, so there is still a single name store, as in FreeBSD's getprogname. It does not touch errno.

Tested

  • guest_program_name (new, registered for Linux and Windows, with the Windows PATH set like guest_thread_atexit) checks that:
    • the returned pointer is __progname and reads eboot.bin;
    • it follows a reassigned __progname and changes to the storage behind it;
    • an empty name reads back empty;
    • guest errno is preserved.
  • Native run of the test against the changed Export.cpp with stubbed runtime hooks (zig c++, aarch64): pass. Two mutants fail: a constant "eboot.bin" and an errno write.
  • Compiled for x86_64-linux-gnu and x86_64-windows-gnu with -Wall -Wextra: no new warnings.
  • tools/check_conventions.py --base origin/main: passed.
  • Titles (Linux rig, x86_64, main b490b387, headless lavapipe):
    • Yamagi Quake II (PPSA99007): before, undefined symbol: 7Psx1DlAyE4; after, it gets past getprogname and later aborts with no unresolved import.
    • Emby5 (PPSA99515): before, undefined symbol: 7Psx1DlAyE4; after, its next stop is 2VRU7xiqLO8 (setcontext).
    • ctest on the rig: guest_program_name 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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4817703428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3347). Originally posted by [overlordxrz-source](https://github.com/overlordxrz-source) on 2026-10-11T08:24:19Z. --- ### What `getprogname` (`7Psx1DlAyE4`) is now the first startup stop on Linux for two catalog titles, Yamagi Quake II (PPSA99007) and Emby5 (PPSA99515). Both import it from `libSceLibcInternal`. Before #3031 (merged 10-11), both titles stopped at `pthread_set_name_np`; the rig re-run below is on current main `b490b387`. PSBox Cloud Gaming (PPSA99810) imports it from `libSceLibcInternal` too. #1595, #1869 and #2218 were closed because no title reached `getprogname` on main. This PR has the title IDs and log lines that were asked for. The change takes the same approach as #2218 (MichalSy), credited here: it returns the `__progname` that libkernel already exports, so there is still a single name store, as in [FreeBSD's getprogname](https://github.com/freebsd/freebsd-src/blob/stable/11/lib/libc/gen/getprogname.c). It does not touch `errno`. ### Tested - `guest_program_name` (new, registered for Linux and Windows, with the Windows `PATH` set like `guest_thread_atexit`) checks that: - the returned pointer is `__progname` and reads `eboot.bin`; - it follows a reassigned `__progname` and changes to the storage behind it; - an empty name reads back empty; - guest `errno` is preserved. - Native run of the test against the changed `Export.cpp` with stubbed runtime hooks (zig c++, aarch64): pass. Two mutants fail: a constant `"eboot.bin"` and an `errno` write. - Compiled for x86_64-linux-gnu and x86_64-windows-gnu with `-Wall -Wextra`: no new warnings. - `tools/check_conventions.py --base origin/main`: passed. - Titles (Linux rig, x86_64, main `b490b387`, headless lavapipe): - Yamagi Quake II (PPSA99007): before, `undefined symbol: 7Psx1DlAyE4`; after, it gets past `getprogname` and later aborts with no unresolved import. - Emby5 (PPSA99515): before, `undefined symbol: 7Psx1DlAyE4`; after, its next stop is `2VRU7xiqLO8` (`setcontext`). - ctest on the rig: `guest_program_name` 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-11 08:24:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T08:24:41Z.


Progress report (7b5214d → 2806eb5)

➖ System libraries: 85.54% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceLibcInternal getprogname_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107104328 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3347#issuecomment-6107104328). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T08:24:41Z. --- <!-- progress-report --> ### Progress report (7b5214d → 2806eb5) ➖ **System libraries**: 85.54% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceLibcInternal | `getprogname_nid_postfix` | </details>
LeandroLP23 commented 2026-10-11 08:29:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-11T08:29:30Z.


Windows check with two titles. Head 2806eb57 together with #1482 (whose _umtx_op is the stop before this one) merged onto main f60923bf, Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release:

Title main + #1482 + this PR
PS5 OpenGL Showcase (PPSA99005) FAIL: unresolved ELF import 7Psx1DlAyE4 from libSceLibcInternal.prx loads every import, Mesa reports ready GL=4.6, then stops at the first draw's shader (#2631)
ProsperoRadio (PPSA99001) same 7Psx1DlAyE4 line gets past it to 2VRU7xiqLO8 (setcontext, no PR yet)
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107140306 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3347#issuecomment-6107140306). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-11T08:29:30Z. --- Windows check with two titles. Head `2806eb57` together with #1482 (whose `_umtx_op` is the stop before this one) merged onto `main` f60923bf, Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release: | Title | `main` + #1482 | + this PR | |---|---|---| | PS5 OpenGL Showcase (PPSA99005) | `FAIL: unresolved ELF import 7Psx1DlAyE4 from libSceLibcInternal.prx` | loads every import, Mesa reports `ready GL=4.6`, then stops at the first draw's shader (#2631) | | ProsperoRadio (PPSA99001) | same `7Psx1DlAyE4` line | gets past it to `2VRU7xiqLO8` (`setcontext`, no PR yet) |
adriadam10 commented 2026-10-11 08:49:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:49:25Z.


Checked on current main: guest_program_name builds and passes, it fails to link without the Export.cpp change, no other library exports getprogname, and the returned pointer is the same __progname libkernel exports (FreeBSD getprogname behaviour). Windows result from @LeandroLP23 covers the Windows side; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107290154 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3347#issuecomment-6107290154). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T08:49:25Z. --- Checked on current main: `guest_program_name` builds and passes, it fails to link without the `Export.cpp` change, no other library exports `getprogname`, and the returned pointer is the same `__progname` libkernel exports (FreeBSD `getprogname` behaviour). Windows result from @LeandroLP23 covers the Windows side; merging.
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!3347
No description provided.