feat(libkernel): implement getdtablesize and _SC_OPEN_MAX in sysconf #6506

Closed
QuentinRemond wants to merge 2 commits from upstream-pr/6506 into main
QuentinRemond commented 2026-10-15 18:03:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by QuentinRemond on 2026-10-15T18:03:52Z.


What

Implement getdtablesize in libkernel by querying getrlimit(RLIMIT_NOFILE) with INT_MAX clamping, and add _SC_OPEN_MAX (5) to sysconf returning getdtablesize(), following FreeBSD libc (getdtablesize.c and sysconf.c).

Tested

Fedora Linux x86_64: guest_getrlimit and guest_system_configuration unit tests passed (ctest). Rebuilt libs with all 126 PRXs patched and verified python3 tools/check_conventions.py --base origin/main.

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 under Silent stubs in their library's technical debt file
  • 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
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4877705170 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6506). Originally posted by [QuentinRemond](https://github.com/QuentinRemond) on 2026-10-15T18:03:52Z. --- ### What Implement `getdtablesize` in libkernel by querying `getrlimit(RLIMIT_NOFILE)` with `INT_MAX` clamping, and add `_SC_OPEN_MAX` (5) to `sysconf` returning `getdtablesize()`, following FreeBSD libc (`getdtablesize.c` and `sysconf.c`). ### Tested Fedora Linux x86_64: `guest_getrlimit` and `guest_system_configuration` unit tests passed (`ctest`). Rebuilt `libs` with all 126 PRXs patched and verified `python3 tools/check_conventions.py --base origin/main`. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-15 18:27:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T18:27:13Z.


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
PR 5902 docs/dev/debt/libkernel.md L161
PR 6201 core/libs/prx/libkernel/System/src/Process.cpp L611-612
core/libs/tests/GuestGetrlimit.cpp L158-164
docs/dev/debt/libkernel.md L103
PR 6446 docs/dev/debt/libkernel.md L102-103

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 3891 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4156 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4396 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4397 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4422 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4423 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4424 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4520 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4521 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4522 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4523 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4566 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4599 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4718 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4740 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4749 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4760 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 4813 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 5021 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 5835 docs/dev/debt/libkernel.md
PR 5993 docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestGetrlimit.cpp
core/libs/tests/GuestSystemConfiguration.cpp
PR 6222 core/libs/prx/libkernel/System/src/Process.cpp
docs/dev/debt/libkernel.md
PR 6447 core/libs/prx/libkernel/System/src/Process.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6199322898 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6506#issuecomment-6199322898). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T18:27:13Z. --- <!-- 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 | |---|---|---|---| | [PR 5902](https://www.github.com/boykopovar/AnyPS5/pull/5902) | `docs/dev/debt/libkernel.md` [L161](https://github.com/boykopovar/AnyPS5/blob/44df21632125dbe3113a19173e7ebb879da53003/docs/dev/debt/libkernel.md#L161) | | | | [PR 6201](https://www.github.com/boykopovar/AnyPS5/pull/6201) | `core/libs/prx/libkernel/System/src/Process.cpp` [L611-612](https://github.com/boykopovar/AnyPS5/blob/44df21632125dbe3113a19173e7ebb879da53003/core/libs/prx/libkernel/System/src/Process.cpp#L611-L612)<br>`core/libs/tests/GuestGetrlimit.cpp` [L158-164](https://github.com/boykopovar/AnyPS5/blob/44df21632125dbe3113a19173e7ebb879da53003/core/libs/tests/GuestGetrlimit.cpp#L158-L164)<br>`docs/dev/debt/libkernel.md` [L103](https://github.com/boykopovar/AnyPS5/blob/44df21632125dbe3113a19173e7ebb879da53003/docs/dev/debt/libkernel.md#L103) | | | | [PR 6446](https://www.github.com/boykopovar/AnyPS5/pull/6446) | `docs/dev/debt/libkernel.md` [L102-103](https://github.com/boykopovar/AnyPS5/blob/44df21632125dbe3113a19173e7ebb879da53003/docs/dev/debt/libkernel.md#L102-L103) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 3891](https://www.github.com/boykopovar/AnyPS5/pull/3891) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4156](https://www.github.com/boykopovar/AnyPS5/pull/4156) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4396](https://www.github.com/boykopovar/AnyPS5/pull/4396) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4397](https://www.github.com/boykopovar/AnyPS5/pull/4397) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4422](https://www.github.com/boykopovar/AnyPS5/pull/4422) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4423](https://www.github.com/boykopovar/AnyPS5/pull/4423) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4424](https://www.github.com/boykopovar/AnyPS5/pull/4424) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4520](https://www.github.com/boykopovar/AnyPS5/pull/4520) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4521](https://www.github.com/boykopovar/AnyPS5/pull/4521) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4522](https://www.github.com/boykopovar/AnyPS5/pull/4522) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4523](https://www.github.com/boykopovar/AnyPS5/pull/4523) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4566](https://www.github.com/boykopovar/AnyPS5/pull/4566) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4599](https://www.github.com/boykopovar/AnyPS5/pull/4599) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4718](https://www.github.com/boykopovar/AnyPS5/pull/4718) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4740](https://www.github.com/boykopovar/AnyPS5/pull/4740) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4749](https://www.github.com/boykopovar/AnyPS5/pull/4749) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4760](https://www.github.com/boykopovar/AnyPS5/pull/4760) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 4813](https://www.github.com/boykopovar/AnyPS5/pull/4813) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 5835](https://www.github.com/boykopovar/AnyPS5/pull/5835) | `docs/dev/debt/libkernel.md` | | [PR 5993](https://www.github.com/boykopovar/AnyPS5/pull/5993) | `docs/dev/debt/libkernel.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestGetrlimit.cpp`<br>`core/libs/tests/GuestSystemConfiguration.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libkernel/System/src/Process.cpp`<br>`docs/dev/debt/libkernel.md` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `core/libs/prx/libkernel/System/src/Process.cpp` |
QuentinRemond commented 2026-10-15 18:44:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by QuentinRemond on 2026-10-15T18:44:27Z.


Closing in favor of earlier PR #6201 which already implements getdtablesize.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6199661161 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6506#issuecomment-6199661161). Originally posted by [QuentinRemond](https://github.com/QuentinRemond) on 2026-10-15T18:44:27Z. --- Closing in favor of earlier PR #6201 which already implements getdtablesize.

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