feat(libkernel): implement getsid for calling process #4170

Closed
jagrat04 wants to merge 1 commit from upstream-pr/4170 into main
jagrat04 commented 2026-10-12 00:33:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-12T00:33:46Z.


What

Implement getsid in libkernel:

  • When pid is 0 or matches getpid(), return the caller's process ID (as the single guest process acts as its own session leader).
  • For any other PID, return -1 and set errno to ESRCH (3) following standard FreeBSD semantics.
  • Add test coverage in core/libs/tests/GuestParentProcess.cpp.
  • Update docs/dev/TechnicalDebt.md.

Tested

  • python tools/check_conventions.py --base origin/main passed with 0 violations.
  • Verified zero comments in C++ implementation files.

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:4823543351 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4170). Originally posted by [jagrat04](https://github.com/jagrat04) on 2026-10-12T00:33:46Z. --- ### What Implement `getsid` in `libkernel`: - When `pid` is `0` or matches `getpid()`, return the caller's process ID (as the single guest process acts as its own session leader). - For any other PID, return `-1` and set `errno` to `ESRCH` (3) following standard FreeBSD semantics. - Add test coverage in `core/libs/tests/GuestParentProcess.cpp`. - Update `docs/dev/TechnicalDebt.md`. ### Tested - `python tools/check_conventions.py --base origin/main` passed with 0 violations. - Verified zero comments in C++ implementation files. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [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-12 00:34:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T00:34:09Z.


Progress report (7a84b22 → 03ec272)

📈 System libraries: 86.5% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel getsid_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115655407 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4170#issuecomment-6115655407). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T00:34:09Z. --- <!-- progress-report --> ### Progress report (7a84b22 → 03ec272) 📈 **System libraries**: 86.5% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `getsid_nid_postfix` | </details>
github-actions[bot] commented 2026-10-12 01:17:54 +00:00 (Migrated from github.com)

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


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 L659-662
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116041466 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4170#issuecomment-6116041466). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T01:17:54Z. --- <!-- 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` [L659-662](https://github.com/boykopovar/AnyPS5/blob/8c4a295ffb7bc471a5bcee2287fd38e499d003a2/docs/dev/TechnicalDebt.md#L659-L662) | | |
oneandonlydean commented 2026-10-12 08:28:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:28:39Z.


Closing, as with #4168: getsid throws on main because sessions aren't modelled, PPSA74126 imports it without calling it, and returning the pid assumes the process leads its own session. Reopen when a title calls it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120585149 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4170#issuecomment-6120585149). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T08:28:39Z. --- Closing, as with #4168: `getsid` throws on main because sessions aren't modelled, PPSA74126 imports it without calling it, and returning the pid assumes the process leads its own session. Reopen when a title calls it.

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