feat(libkernel_sys): export fstatfs #3439

Merged
babyhuey merged 1 commit from upstream-pr/3439 into main 2026-10-11 10:42:21 +00:00
babyhuey commented 2026-10-11 10:34:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T10:34:09Z.


What

Exports fstatfs (+rWFNYiNaEM) from libkernel_sys, the module titles import it from, as a forwarder to libkernel's _fstatfs (#2858). On FreeBSD fstatfs and _fstatfs are the same system call under two names, so it shares the 472-byte statfs layout, the socket and descriptor checks and the errno results.

PS5VR (PPSA99177) stops at it on main 99c1c263, now that link (#3403) is in (catalog build, eboot.bin and sce_module/libc.prx unwrapped as #2605 requires; tracked in #1578):

  • Linux: app.elf: symbol lookup error: app.elf: undefined symbol: +rWFNYiNaEM
  • Windows: FAIL: unresolved ELF import +rWFNYiNaEM (fstatfs) from libkernel_sys.prx
  • with this PR, Linux: app.elf: symbol lookup error: app.elf: undefined symbol: waIF+5fE5HQ (symlink)
  • with this PR, Windows: FAIL: unresolved ELF import waIF+5fE5HQ (symlink) from libkernel_sys.prx

Tested

Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release: guest_kernel_sys passes 5/5 (--repeat until-fail:5) on both, with no warnings in Export.cpp or GuestKernelSys.cpp. The new cases call fstatfs and _fstatfs on the same descriptor and compare the version, block size and filesystem type name, then check EFAULT for a null buffer and EBADF for a closed descriptor through errno. check_conventions.py 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818425427 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3439). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T10:34:09Z. --- ### What Exports `fstatfs` (`+rWFNYiNaEM`) from libkernel_sys, the module titles import it from, as a forwarder to libkernel's `_fstatfs` (#2858). On FreeBSD `fstatfs` and `_fstatfs` are the same system call under two names, so it shares the 472-byte `statfs` layout, the socket and descriptor checks and the `errno` results. PS5VR (PPSA99177) stops at it on `main` 99c1c263, now that `link` (#3403) is in (catalog build, `eboot.bin` and `sce_module/libc.prx` unwrapped as #2605 requires; tracked in #1578): - Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: +rWFNYiNaEM` - Windows: `FAIL: unresolved ELF import +rWFNYiNaEM (fstatfs) from libkernel_sys.prx` - with this PR, Linux: `app.elf: symbol lookup error: app.elf: undefined symbol: waIF+5fE5HQ` (`symlink`) - with this PR, Windows: `FAIL: unresolved ELF import waIF+5fE5HQ (symlink) from libkernel_sys.prx` ### Tested Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release: `guest_kernel_sys` passes 5/5 (`--repeat until-fail:5`) on both, with no warnings in `Export.cpp` or `GuestKernelSys.cpp`. The new cases call `fstatfs` and `_fstatfs` on the same descriptor and compare the version, block size and filesystem type name, then check `EFAULT` for a null buffer and `EBADF` for a closed descriptor through `errno`. `check_conventions.py` 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
github-actions[bot] commented 2026-10-11 10:34:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T10:34:36Z.


Progress report (99c1c26 → 81075a6)

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

✅ 1 implemented
Library Name
libkernel_sys fstatfs_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108124146 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3439#issuecomment-6108124146). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T10:34:36Z. --- <!-- progress-report --> ### Progress report (99c1c26 → 81075a6) ➖ **System libraries**: 85.76% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel_sys | `fstatfs_nid_postfix` | </details>
adriadam10 commented 2026-10-11 10:42:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:42:18Z.


Checked build and guest_kernel_sys on Linux (libs scope, 18/18 pass); the new cases don't link without the change. fstatfs forwards to the existing _fstatfs (same syscall on FreeBSD), and the test covers EFAULT and EBADF. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108182971 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3439#issuecomment-6108182971). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T10:42:18Z. --- Checked build and `guest_kernel_sys` on Linux (libs scope, 18/18 pass); the new cases don't link without the change. `fstatfs` forwards to the existing `_fstatfs` (same syscall on FreeBSD), and the test covers EFAULT and EBADF. Merging.
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!3439
No description provided.