feat(libc): implement guest gethostname #2968

Merged
babyhuey merged 7 commits from upstream-pr/2968 into main 2026-10-10 22:02:55 +00:00
babyhuey commented 2026-10-10 18:59:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T18:59:47Z.


What

Implements gethostname (-nvxBWa0iDs) in libc. The commits are @QRMOE's, from #2019 (their updated branch at a4e3ff0d, rebased onto main with their authorship kept and the two merge commits dropped). They can't open PRs yet because of the intake check and asked me to open it.

It reports the fixed guest name AnyPS5 and never queries the host machine name, which answers the review point on #2019 about handing the PC's name to the guest. Buffer copying, a null buffer and ENAMETOOLONG follow FreeBSD gethostname, and the caller's errno is kept on success. TechnicalDebt records the fixed-name policy and that the console's configurable hostname and its sysctl and resolver integration are not implemented.

XashPS5 (PPSA19111) stops at it on main 9c5d67fb, and PS5MC (PPSA99420) reaches it after execvp (#2827). Catalog builds, eboot.bin and sce_module/libc.prx unwrapped as #2605 requires (tracked in #1578):

  • main, Linux: app.elf: symbol lookup error: app.elf: undefined symbol: -nvxBWa0iDs
  • main, Windows: FAIL: unresolved ELF import -nvxBWa0iDs (gethostname) from libSceLibcInternal.prx
  • with this PR, Linux: app.elf: symbol lookup error: app.elf: undefined symbol: vhtcIgZG-Lk (realpath)

Tested

Linux (Ubuntu 24.04, GCC 13, Release) on 9c5d67fb: guest_hostname and guest_errors pass 5/5 (--repeat until-fail:5), and the XashPS5 line above. QRMOE ran the full Windows build on main 5edae353 with both tests passing 5/5. check_conventions.py passes. Windows 11 (MinGW-w64 GCC 15.2 from WinLibs, Release) on the same commit: both tests 5/5 with no warnings, and XashPS5 stops at FAIL: unresolved ELF import vhtcIgZG-Lk (realpath) from libSceLibcInternal.prx.

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:4813680655 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2968). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-10T18:59:47Z. --- ### What Implements `gethostname` (`-nvxBWa0iDs`) in libc. The commits are @QRMOE's, from #2019 (their updated branch at a4e3ff0d, rebased onto `main` with their authorship kept and the two merge commits dropped). They can't open PRs yet because of the intake check and asked me to open it. It reports the fixed guest name `AnyPS5` and never queries the host machine name, which answers the review point on #2019 about handing the PC's name to the guest. Buffer copying, a null buffer and `ENAMETOOLONG` follow [FreeBSD gethostname](https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/gethostname.c), and the caller's errno is kept on success. TechnicalDebt records the fixed-name policy and that the console's configurable hostname and its `sysctl` and resolver integration are not implemented. XashPS5 (PPSA19111) stops at it on `main` 9c5d67fb, and PS5MC (PPSA99420) reaches it after `execvp` (#2827). Catalog builds, `eboot.bin` and `sce_module/libc.prx` unwrapped as #2605 requires (tracked in #1578): - `main`, Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: -nvxBWa0iDs` - `main`, Windows: `FAIL: unresolved ELF import -nvxBWa0iDs (gethostname) from libSceLibcInternal.prx` - with this PR, Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: vhtcIgZG-Lk` (`realpath`) ### Tested Linux (Ubuntu 24.04, GCC 13, Release) on 9c5d67fb: `guest_hostname` and `guest_errors` pass 5/5 (`--repeat until-fail:5`), and the XashPS5 line above. QRMOE ran the full Windows build on `main` 5edae353 with both tests passing 5/5. `check_conventions.py` passes. Windows 11 (MinGW-w64 GCC 15.2 from WinLibs, Release) on the same commit: both tests 5/5 with no warnings, and XashPS5 stops at `FAIL: unresolved ELF import vhtcIgZG-Lk (realpath) from libSceLibcInternal.prx`. ### Checklist - [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-10 19:23:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T19:23:07Z.


Progress report (4a747c4 → f153c28)

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

✅ 1 implemented
Library Name
libc gethostname_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101279411 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2968#issuecomment-6101279411). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T19:23:07Z. --- <!-- progress-report --> ### Progress report (4a747c4 → f153c28) ➖ **System libraries**: 84.48% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `gethostname_nid_postfix` | </details>
adriadam10 commented 2026-10-10 22:02:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:02:51Z.


Checked on Linux (Release, merged onto current main): guest_hostname passes 5/5, and the rest of the libc/libs ctest scope is green. gethostname matches FreeBSD gethostname.c (truncated copy and ENAMETOOLONG when the buffer is short, null buffer returns 0, errno kept on success), the name is fixed and never read from the host, and the TechnicalDebt entry is in the right section. Windows and the title runs rest on your and @QRMOE's reports. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102649504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2968#issuecomment-6102649504). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T22:02:51Z. --- Checked on Linux (Release, merged onto current `main`): `guest_hostname` passes 5/5, and the rest of the libc/libs ctest scope is green. `gethostname` matches FreeBSD `gethostname.c` (truncated copy and `ENAMETOOLONG` when the buffer is short, null buffer returns 0, errno kept on success), the name is fixed and never read from the host, and the TechnicalDebt entry is in the right section. Windows and the title runs rest on your and @QRMOE's reports. 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!2968
No description provided.