Skip to content

feat(libkernel): implement getppid - #3352

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
babyhuey:feat/libkernel-getppid
Oct 11, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
babyhuey:feat/libkernel-getppid

Conversation

@babyhuey

@babyhuey babyhuey commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Exports getppid (e6ovBo9ZvJc) from libkernel. It reports the host parent process ID, the same way getpid reports the host process ID: ::getppid() on Linux, and on Windows the th32ParentProcessID of this process's entry in a Toolhelp32 process snapshot. A parent ID of 0 (a host process started from outside its PID namespace) is passed through, an ID above INT_MAX throws like getpid, and a failed snapshot throws.

XashPS5 (PPSA19111) stops at it on main 04ab4a8, now that creat (#3322) is in (catalog build, eboot.bin and sce_module/libc.prx unwrapped as #2605 requires; tracked in #1578):

  • Linux: app.elf: symbol lookup error: app.elf: undefined symbol: e6ovBo9ZvJc
  • Windows: FAIL: unresolved ELF import e6ovBo9ZvJc (getppid) from libkernel.prx
  • with this PR, Linux: app.elf: symbol lookup error: app.elf: undefined symbol: 04AjkP0jO9U (_umtx_op, feat(libkernel): implement _umtx_op wait and wake operations #1482)
  • with this PR, Windows: FAIL: unresolved ELF import 04AjkP0jO9U (_umtx_op) from libkernel.prx

Tested

Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release: the new guest_parent_process passes 5/5 (--repeat until-fail:5) on both, with no warnings in Process.cpp or GuestParentProcess.cpp. It checks that the result is positive, differs from getpid, and is the same on a second call; on Linux it must equal the host getppid(), and on Windows OpenProcess must find a process with that ID. check_conventions.py 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

@github-actions

Copy link
Copy Markdown

Progress report (ccf9ff9 → 0cca339)

📈 System libraries: 85.55% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel getppid_nid_postfix

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked build and guest_parent_process on Linux (merged onto current main); the test doesn't link without the change. getppid matches FreeBSD's getppid(2) semantics (host parent PID, same range check as getpid) and the NID resolves to getppid. No other open PR touches it. The Windows branch is code-reviewed only (Toolhelp32 snapshot, includes present); merging once CI is green.

@adriadam10
adriadam10 merged commit c166694 into boykopovar:main Oct 11, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants