feat(libkernel_sys): implement pathconf #3611

Merged
nicolasfalesy merged 1 commit from upstream-pr/3611 into main 2026-10-12 21:01:46 +00:00
nicolasfalesy commented 2026-10-11 14:13:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nicolasfalesy on 2026-10-11T14:13:36Z.


What

Carries @screamm's fix from #3502 (the author is under the open-PR limit). The commit is theirs, unchanged (d93d0e588), rebased onto current main (68ab3859e) by @blawesom.

Porpoise 2.7 (PPSA99764) stops at load on main:
FAIL: unresolved ELF import oc98+zOImus from libkernel_sys.prx

oc98+zOImus is pathconf (tools/nid_names.py, aerolib.csv at zecoxao/sce_symbols 2883963a). It is exported from libkernel_sys next to link and readlink.

The lookup follows FreeBSD 11's kern_pathconf and namei (release/11.0.0, 671fb7df): links are followed, a path of 1024 bytes or more or a component over 255 fails with ENAMETOOLONG, a missing path with ENOENT. The values are the constants of FreeBSD 11's UFS ufs_pathconf, which vop_stdpathconf shares where both answer. Names whose UFS value depends on the mount, the kernel options or the page size, or on which UFS and vop_stdpathconf disagree, throw; other names fail with EINVAL. The console's filesystem values are unverified and recorded in TechnicalDebt.md.

Tested

  • Windows run (WinLibs MinGW-w64 GCC 15.2.0, per #3502): guest_kernel_sys 3/3; ctest 533/534, with main's Export.cpp the extended test fails.
  • Independent Linux verification by @blawesom (CachyOS, GCC 16.2.1, AMD RADV): 832/832 suite pass, libkernel_sys tests pass.
  • Verified locally on Linux (Arch Linux, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON): guest_kernel_sys passes (100%), full test suite 823/827 passed (with the 4 remaining failures being known host GPU tests); python3 tools/check_conventions.py --base origin/main and git diff --check origin/main pass cleanly.

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:4819684504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611). Originally posted by [nicolasfalesy](https://github.com/nicolasfalesy) on 2026-10-11T14:13:36Z. --- ### What Carries @screamm's fix from #3502 (the author is under the open-PR limit). The commit is theirs, unchanged (d93d0e588), rebased onto current `main` (68ab3859e) by @blawesom. Porpoise 2.7 (PPSA99764) stops at load on main: `FAIL: unresolved ELF import oc98+zOImus from libkernel_sys.prx` `oc98+zOImus` is `pathconf` (tools/nid_names.py, aerolib.csv at zecoxao/sce_symbols 2883963a). It is exported from `libkernel_sys` next to `link` and `readlink`. The lookup follows FreeBSD 11's `kern_pathconf` and `namei` (release/11.0.0, 671fb7df): links are followed, a path of 1024 bytes or more or a component over 255 fails with `ENAMETOOLONG`, a missing path with `ENOENT`. The values are the constants of FreeBSD 11's UFS `ufs_pathconf`, which `vop_stdpathconf` shares where both answer. Names whose UFS value depends on the mount, the kernel options or the page size, or on which UFS and `vop_stdpathconf` disagree, throw; other names fail with `EINVAL`. The console's filesystem values are unverified and recorded in `TechnicalDebt.md`. ### Tested - Windows run (WinLibs MinGW-w64 GCC 15.2.0, per #3502): guest_kernel_sys 3/3; ctest 533/534, with main's Export.cpp the extended test fails. - Independent Linux verification by @blawesom (CachyOS, GCC 16.2.1, AMD RADV): 832/832 suite pass, libkernel_sys tests pass. - Verified locally on Linux (Arch Linux, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON): guest_kernel_sys passes (100%), full test suite 823/827 passed (with the 4 remaining failures being known host GPU tests); `python3 tools/check_conventions.py --base origin/main` and `git diff --check origin/main` pass cleanly. ### 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
github-actions[bot] commented 2026-10-11 14:14:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T14:14:54Z.


Progress report (33ae282 → ce1ca8b)

➖ System libraries: 86.25% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel_sys pathconf_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109933051 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6109933051). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T14:14:54Z. --- <!-- progress-report --> ### Progress report (33ae282 → ce1ca8b) ➖ **System libraries**: 86.25% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel_sys | `pathconf_nid_postfix` | </details>
babyhuey commented 2026-10-11 14:46:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T14:46:10Z.


Checked on Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release, with this PR (68ab3859) merged onto main a11c8f7f.

  • Linux: guest_kernel_sys passes 5/5 (--repeat until-fail:5).
  • Windows: guest_kernel_sys aborts in the symlink cases before it reaches pathconf (symlink: Function not implemented). That is the main bug #3510 fixes. With #3510's change stacked it passes 5/5, and there are no warnings in the changed files.
  • Porpoise (PPSA99764) gets past pathconf on both. On main Windows stops at FAIL: unresolved ELF import oc98+zOImus (pathconf) from libkernel_sys.prx; with this PR it stops at FAIL: unresolved ELF import DxmIMUQ-wXY (pthread_attr_getstackaddr) from libkernel.prx (#3494). Linux gives the same: undefined symbol: DxmIMUQ-wXY.

Heads-up: this PR and #3510 conflict in the constants block at the top of libkernel_sys/Export.cpp, so whichever merges second needs a small rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110212772 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6110212772). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T14:46:10Z. --- Checked on Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release, with this PR (68ab3859) merged onto `main` a11c8f7f. - Linux: `guest_kernel_sys` passes 5/5 (`--repeat until-fail:5`). - Windows: `guest_kernel_sys` aborts in the symlink cases before it reaches `pathconf` (`symlink: Function not implemented`). That is the `main` bug #3510 fixes. With #3510's change stacked it passes 5/5, and there are no warnings in the changed files. - Porpoise (PPSA99764) gets past `pathconf` on both. On `main` Windows stops at `FAIL: unresolved ELF import oc98+zOImus (pathconf) from libkernel_sys.prx`; with this PR it stops at `FAIL: unresolved ELF import DxmIMUQ-wXY (pthread_attr_getstackaddr) from libkernel.prx` (#3494). Linux gives the same: `undefined symbol: DxmIMUQ-wXY`. Heads-up: this PR and #3510 conflict in the constants block at the top of `libkernel_sys/Export.cpp`, so whichever merges second needs a small rebase.
blawesom commented 2026-10-11 14:59:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T14:59:56Z.


Cross-linking for the review: this implements the fix tracked in #3502, which has an independent Linux verification on that issue — full suite 832/832 (CachyOS, GCC 16.2.1, including the Vulkan suites on AMD RX 9070 XT / RADV), conventions check clean. The rebased reference branch there also documents the one conflict that appears against current main (the newer Windows privilege constant in libkernel_sys/Export.cpp).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110336586 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6110336586). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T14:59:56Z. --- Cross-linking for the review: this implements the fix tracked in #3502, which has an independent Linux verification on that issue — full suite **832/832** (CachyOS, GCC 16.2.1, including the Vulkan suites on AMD RX 9070 XT / RADV), conventions check clean. The rebased reference branch there also documents the one conflict that appears against current `main` (the newer Windows privilege constant in `libkernel_sys/Export.cpp`).
oneandonlydean commented 2026-10-11 23:15:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:15:39Z.


Conflicts with main in core/libs/prx/libkernel_sys/Export.cpp (the constants block, after #3510) and docs/dev/TechnicalDebt.md; please rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114992775 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6114992775). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:15:39Z. --- Conflicts with main in `core/libs/prx/libkernel_sys/Export.cpp` (the constants block, after #3510) and `docs/dev/TechnicalDebt.md`; please rebase.
screamm commented 2026-10-12 00:32:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T00:32:23Z.


Heads-up from a Windows validation attempt: this branch (68ab3859, base a11c8f7f) no longer merges onto main bab7b328. libkernel_sys/Export.cpp conflicts in the constants block (both sides define GuestEloop/GuestEnametoolong; main added GuestEdeadlk, GuestEagain, GuestEnotempty, GuestEoverflow through #3685, #3555, #3485 and #3510, and the creationMask atomic moved), plus the fork bullet next to the new pathconf bullet in TechnicalDebt.md. Porpoise (PPSA99764) still stops on pathconf on current main (third catalog run, #1578), so a rebase would let it progress.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115638969 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6115638969). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T00:32:23Z. --- Heads-up from a Windows validation attempt: this branch (`68ab3859`, base `a11c8f7f`) no longer merges onto `main` `bab7b328`. `libkernel_sys/Export.cpp` conflicts in the constants block (both sides define `GuestEloop`/`GuestEnametoolong`; `main` added `GuestEdeadlk`, `GuestEagain`, `GuestEnotempty`, `GuestEoverflow` through #3685, #3555, #3485 and #3510, and the `creationMask` atomic moved), plus the `fork` bullet next to the new `pathconf` bullet in `TechnicalDebt.md`. Porpoise (PPSA99764) still stops on `pathconf` on current `main` (third catalog run, #1578), so a rebase would let it progress.
nicolasfalesy commented 2026-10-12 13:00:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nicolasfalesy on 2026-10-12T13:00:11Z.


Rebased onto main 33ae282e (now ce1ca8bf). Conflicts resolved:

  • libkernel_sys/Export.cpp: kept main's constants (including GuestEloop/GuestEnametoolong) and added only the pathconf ones. Dropped the local PathError wrapper, since main's GuestError now maps ELOOP and ENAMETOOLONG itself, and switched the path lookup to ResolvePathError_nid_no_patch like readlink.
  • TechnicalDebt.md: kept main's fork/umask bullet and added the pathconf bullet after it.

Tested on Linux (Arch, Release): guest_kernel_sys passes 5/5 (--repeat until-fail:5), check_conventions.py and check_test_registration.py are clean. Not re-run on Windows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124769090 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6124769090). Originally posted by [nicolasfalesy](https://github.com/nicolasfalesy) on 2026-10-12T13:00:11Z. --- Rebased onto `main` 33ae282e (now ce1ca8bf). Conflicts resolved: - `libkernel_sys/Export.cpp`: kept main's constants (including `GuestEloop`/`GuestEnametoolong`) and added only the `pathconf` ones. Dropped the local `PathError` wrapper, since main's `GuestError` now maps `ELOOP` and `ENAMETOOLONG` itself, and switched the path lookup to `ResolvePathError_nid_no_patch` like `readlink`. - `TechnicalDebt.md`: kept main's `fork`/`umask` bullet and added the `pathconf` bullet after it. Tested on Linux (Arch, Release): `guest_kernel_sys` passes 5/5 (`--repeat until-fail:5`), `check_conventions.py` and `check_test_registration.py` are clean. Not re-run on Windows.
babyhuey commented 2026-10-12 13:36:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T13:36:01Z.


I checked ce1ca8bf on both OSes with Porpoise (PPSA99764, catalog 3.0):

  • main 33ae282e stops at pathconf:
    • Linux: undefined symbol: oc98+zOImus (pathconf)
    • Windows 11 (MinGW GCC 15.2): FAIL: unresolved ELF import oc98+zOImus (pathconf) from libkernel_sys.prx
  • With this PR, pathconf resolves and the next stop is chroot:
    • Linux: undefined symbol: AKknh8Cx-V8 (chroot)
    • Windows: FAIL: unresolved ELF import AKknh8Cx-V8 (chroot) from libkernel_sys.prx
  • guest_kernel_sys passes 5/5 (--repeat until-fail:5) on both. No warnings in libkernel_sys/Export.cpp or GuestKernelSys.cpp.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125379733 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6125379733). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-12T13:36:01Z. --- I checked ce1ca8bf on both OSes with Porpoise (PPSA99764, catalog 3.0): - `main` 33ae282e stops at `pathconf`: - Linux: `undefined symbol: oc98+zOImus (pathconf)` - Windows 11 (MinGW GCC 15.2): `FAIL: unresolved ELF import oc98+zOImus (pathconf) from libkernel_sys.prx` - With this PR, `pathconf` resolves and the next stop is `chroot`: - Linux: `undefined symbol: AKknh8Cx-V8 (chroot)` - Windows: `FAIL: unresolved ELF import AKknh8Cx-V8 (chroot) from libkernel_sys.prx` - `guest_kernel_sys` passes 5/5 (`--repeat until-fail:5`) on both. No warnings in `libkernel_sys/Export.cpp` or `GuestKernelSys.cpp`.
github-actions[bot] commented 2026-10-12 13:49:42 +00:00 (Migrated from github.com)

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


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
#4503 pathconf_nid_postfix
#4592 pathconf_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125613079 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6125613079). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T13:49:42Z. --- <!-- 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 | |---|---|---|---| | #4503 | | `pathconf_nid_postfix` | | | #4592 | | `pathconf_nid_postfix` | |
adriadam10 commented 2026-10-12 20:53:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:53:00Z.


Rebased onto current main (conflicts in libkernel_sys/Export.cpp, and the pathconf debt entry moved to docs/dev/debt/libkernel_sys.md after the debt split). Checked the constants against FreeBSD 11 ufs_pathconf, built and ran the libs tests on the rebase (90/90), and guest_kernel_sys fails to link without the change. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132419055 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6132419055). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T20:53:00Z. --- Rebased onto current `main` (conflicts in `libkernel_sys/Export.cpp`, and the `pathconf` debt entry moved to `docs/dev/debt/libkernel_sys.md` after the debt split). Checked the constants against FreeBSD 11 `ufs_pathconf`, built and ran the libs tests on the rebase (90/90), and `guest_kernel_sys` fails to link without the change. Merging once CI is green.
adriadam10 commented 2026-10-12 21:00:48 +00:00 (Migrated from github.com)

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


main moved again (a new conflict in libkernel_sys/Export.cpp, HasLongComponent next to the new ReadNativeLink). Rebased keeping both, rebuilt and ran the libs tests (154/154 pass). Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132528883 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3611#issuecomment-6132528883). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T21:00:48Z. --- `main` moved again (a new conflict in `libkernel_sys/Export.cpp`, `HasLongComponent` next to the new `ReadNativeLink`). Rebased keeping both, rebuilt and ran the libs tests (154/154 pass). 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!3611
No description provided.