feat(libkernel): implement getsid #4192

Closed
codingreapermaps wants to merge 1 commit from upstream-pr/4192 into main
codingreapermaps commented 2026-10-12 01:00:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by codingreapermaps on 2026-10-12T01:00:13Z.


What

getsid was a throwing stub. It now follows FreeBSD's kern_getsid (kern_prot.c) for the only guest process: 0 and its own pid return its session id, any other pid returns -1 with ESRCH.

The session id is the guest's own pid: the guest is taken to lead its own session, as kill and setsid already take it to lead its own process group. This is an assumption, not a console measurement, and is recorded in TechnicalDebt.

No open pull request implements getsid; #4138 only has the neighbouring TechnicalDebt line as context.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), full build configuration with BUILD_TESTING=ON. Built and ran guest_ioctl_getsid, guest_kernel_sys and guest_signals: all three pass. The full test suite was not run and no title or homebrew was run. tools/check_conventions.py --base origin/main 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 (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823694312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4192). Originally posted by [codingreapermaps](https://github.com/codingreapermaps) on 2026-10-12T01:00:13Z. --- ### What `getsid` was a throwing stub. It now follows FreeBSD's `kern_getsid` ([kern_prot.c](https://github.com/freebsd/freebsd-src/blob/main/sys/kern/kern_prot.c)) for the only guest process: 0 and its own pid return its session id, any other pid returns -1 with `ESRCH`. The session id is the guest's own pid: the guest is taken to lead its own session, as `kill` and `setsid` already take it to lead its own process group. This is an assumption, not a console measurement, and is recorded in TechnicalDebt. No open pull request implements `getsid`; #4138 only has the neighbouring TechnicalDebt line as context. ### Tested Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), full build configuration with `BUILD_TESTING=ON`. Built and ran `guest_ioctl_getsid`, `guest_kernel_sys` and `guest_signals`: all three pass. The full test suite was not run and no title or homebrew was run. `tools/check_conventions.py --base origin/main` passes. ### 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 (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-12 01:18:07 +00:00 (Migrated from github.com)

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


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4138 docs/dev/TechnicalDebt.md L641-644
#4170 core/libs/prx/libkernel/System/src/Process.cpp L45, L204-206
docs/dev/TechnicalDebt.md L643
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116043413 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4192#issuecomment-6116043413). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T01:18:07Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4138 | `docs/dev/TechnicalDebt.md` [L641-644](https://github.com/boykopovar/AnyPS5/blob/ceb342b9473aa9167695f348af924012ae38ea0b/docs/dev/TechnicalDebt.md#L641-L644) | | | | #4170 | `core/libs/prx/libkernel/System/src/Process.cpp` [L45](https://github.com/boykopovar/AnyPS5/blob/ceb342b9473aa9167695f348af924012ae38ea0b/core/libs/prx/libkernel/System/src/Process.cpp#L45), [L204-206](https://github.com/boykopovar/AnyPS5/blob/ceb342b9473aa9167695f348af924012ae38ea0b/core/libs/prx/libkernel/System/src/Process.cpp#L204-L206)<br>`docs/dev/TechnicalDebt.md` [L643](https://github.com/boykopovar/AnyPS5/blob/ceb342b9473aa9167695f348af924012ae38ea0b/docs/dev/TechnicalDebt.md#L643) | | |
codingreapermaps commented 2026-10-12 02:27:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by codingreapermaps on 2026-10-12T02:27:10Z.


Closing as a duplicate of #4170, which was opened first and implements the same behaviour. Sorry for the overlap, it wasn't open yet when I started on this.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116653694 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4192#issuecomment-6116653694). Originally posted by [codingreapermaps](https://github.com/codingreapermaps) on 2026-10-12T02:27:10Z. --- Closing as a duplicate of #4170, which was opened first and implements the same behaviour. Sorry for the overlap, it wasn't open yet when I started on this.

Pull request closed

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!4192
No description provided.