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

Merged
jagrat04 merged 2 commits from upstream-pr/4578 into main 2026-10-12 21:14:58 +00:00
jagrat04 commented 2026-10-12 16:06:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-12T16:06:45Z.


What

Implements getsid (NID gokWod7GAH4) in libkernel. In FreeBSD, getsid returns the session ID of the process (or calling process if pid is 0) and ESRCH (3) for unknown processes. Since AnyPS5 models a single guest process leading its own session, getsid returns the calling process ID for pid 0 or the caller's pid, and fails with ESRCH for any other process ID. Adds unit tests in GuestParentProcess.cpp and updates TechnicalDebt.

Tested

ools/check_conventions.py --base origin/main
ools/nid_names.py --nid gokWod7GAH4

Guest unit tests in core/libs/tests/GuestParentProcess.cpp

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
  • Unblocks: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4831980570 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4578). Originally posted by [jagrat04](https://github.com/jagrat04) on 2026-10-12T16:06:45Z. --- ### What Implements getsid (NID gokWod7GAH4) in libkernel. In FreeBSD, getsid returns the session ID of the process (or calling process if pid is 0) and ESRCH (3) for unknown processes. Since AnyPS5 models a single guest process leading its own session, getsid returns the calling process ID for pid 0 or the caller\'s pid, and fails with ESRCH for any other process ID. Adds unit tests in GuestParentProcess.cpp and updates TechnicalDebt. ### Tested ools/check_conventions.py --base origin/main ools/nid_names.py --nid gokWod7GAH4 Guest unit tests in core/libs/tests/GuestParentProcess.cpp ### 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] Unblocks: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-12 16:08:12 +00:00 (Migrated from github.com)

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


Progress report (e0fad55 → 935e7d6)

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

✅ 1 implemented
Library Name
libkernel getsid_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128011265 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4578#issuecomment-6128011265). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T16:08:12Z. --- <!-- progress-report --> ### Progress report (e0fad55 → 935e7d6) 📈 **System libraries**: 87.6% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `getsid_nid_postfix` | </details>
adriadam10 commented 2026-10-12 21:10:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T21:10:26Z.


Checked getsid against FreeBSD's sys_getsid (own pid for 0/self, ESRCH otherwise) and the new cases in GuestParentProcess.

Added on top of your commit:

  • Removed guest_ioctl_getsid (core/libs/tests/GuestIoctlGetsid.cpp and its registration in libkernel/CMakeLists.txt): it asserted the old "process sessions not implemented" throw and fails with this change; GuestParentProcess covers getsid now.
  • Rebased on current main.

Full scoped ctest is green (593 tests); merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132665733 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4578#issuecomment-6132665733). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T21:10:26Z. --- Checked getsid against FreeBSD's `sys_getsid` (own pid for 0/self, ESRCH otherwise) and the new cases in `GuestParentProcess`. Added on top of your commit: - Removed `guest_ioctl_getsid` (`core/libs/tests/GuestIoctlGetsid.cpp` and its registration in `libkernel/CMakeLists.txt`): it asserted the old "process sessions not implemented" throw and fails with this change; `GuestParentProcess` covers getsid now. - Rebased on current main. Full scoped ctest is green (593 tests); merging once CI is green.
adriadam10 commented 2026-10-12 21:13:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T21:13:38Z.


Rebased on current main again: the getsid line in docs/dev/debt/libkernel.md conflicted with the sigtimedwait/pause/sigaction entries that landed meanwhile. Only the getsid line is replaced; the neighbouring entries are untouched.

Scoped ctest is green (140 tests, including guest_parent_process); merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132709930 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4578#issuecomment-6132709930). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T21:13:38Z. --- Rebased on current main again: the `getsid` line in `docs/dev/debt/libkernel.md` conflicted with the `sigtimedwait`/`pause`/`sigaction` entries that landed meanwhile. Only the `getsid` line is replaced; the neighbouring entries are untouched. Scoped ctest is green (140 tests, including `guest_parent_process`); merging once CI is green.
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!4578
No description provided.