Commit Graph

32 Commits

Author SHA1 Message Date
David 62f6764cc2 feat(libkernel_sys): implement pathconf
Porpoise 2.7 (PPSA99764) stops at load on main 0f863c10:

    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.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-12 22:56:28 +02:00
jagrat Singh 20243b81e4 feat(libkernel_sys): implement readlinkat 2026-10-13 02:09:59 +05:30
codingreapermaps c6be0e95cc fix(libkernel_sys): read relative symbolic links on Windows
readlink threw for every Windows reparse point, including the links
symlink creates. Read the target of a relative symbolic link from its
reparse data and return it with forward slashes. Absolute targets,
junctions and other reparse points still throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 04:39:39 +01:00
Hannah Lyons c154b8bff3 feat(libkernel_sys): implement openat 2026-10-11 18:01:11 -04:00
Adrià 72e67c0e50
Merge pull request #3555 from lisn0/feat/linux-named-shared-memory
feat(libkernel): support named shared memory on Linux
2026-10-11 23:55:30 +02:00
Adrià 562149d750
Merge pull request #3685 from zmeizy/claude/kernel-sys-errno-translation
fix(libkernel_sys): translate host errors to guest errno numbers
2026-10-11 23:50:40 +02:00
bilel f6ef5a77e2 fix(libkernel): preserve patched loading and shared-memory object identity
Keep guest creation-mask state in libc behind C-linkage helpers so NID
patching preserves the shared exports. Reject a pinned descriptor whose
file identity differs from the snapshot taken before classification.
Exercise close and reuse from another thread at both acquisition windows
for writes, resize and seek, and create temporary ordinary-file fixtures
so runtime tests work without the source tree.

Constraint: NID exemptions require the literal suffix at the end of the exported symbol
Confidence: high
Scope-risk: narrow
Tested: 18 targeted Linux runtime tests with zero skips; patched_libraries for libc/libkernel/libkernel_sys; standalone ASan/UBSan with warnings as errors; source-prefix-remapped fixtures; Clang analyzer and conventions
Not-tested: Full project build and library set, Windows runtime, console hardware and titles
Directive: Device/inode validation establishes file identity, not open-file-description identity
2026-10-11 23:40:46 +02:00
bilel 72b3a2abdd fix(libkernel): keep shared-memory identity and guest permissions consistent
Pin the descriptor before mmap validation so guest descriptor reuse cannot
redirect the eventual mapping. Apply the canonical guest creation mask when
creating named objects, distinguishing new objects before setting permissions
without changing the host process umask. Add regressions that reproduce both
failures and document the remaining host requirements.

Constraint: Guest umask must not mutate the process-wide host mask
Confidence: high
Scope-risk: narrow
Tested: 17 targeted Linux runtime tests passed with zero skips; conventions and diff checks; Clang analyzer on three changed production translation units
Not-tested: Full project build and suite, Windows runtime, console hardware and titles
2026-10-11 23:40:46 +02:00
Santhosh Kumar 2ad916566f fix(libkernel_sys): return the resolver's error from symlink
symlink, added in #3491 while this branch was open, still resolved its
new path with ResolvePath_nid_no_patch, which now throws for an invalid
"..". Use ResolvePathError_nid_no_patch as link does, so
"missing/../x" returns ENOENT and "file/../x" ENOTDIR.

Reported by @Silverash-i8 on #3485.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:25:02 +05:30
Santhosh Kumar 17827dd9ab fix(filesystem): reject invalid parent traversal on Windows 2026-10-12 01:25:02 +05:30
Claude 4a419397cb
fix(libkernel_sys): translate host errors to guest errno numbers
GuestError passed host error values up to 34 through and reported every
other value as EIO, so readlink failed with EIO for a name that is too
long or a symbolic link loop, and a host EAGAIN would have been reported
as the guest's EDEADLK. The values whose numbering differs are now
mapped to FreeBSD's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
2026-10-11 19:50:38 +00:00
Hannah Lyons 6aa0b4fb22 fix(libkernel_sys): create symlinks with CreateSymbolicLinkW on Windows 2026-10-11 08:31:59 -04:00
Adrià 1e8fff68c8
Merge pull request #3481 from sypher69/fix/fchdir-search-permission
fix(libkernel_sys): check fchdir search permission on Linux
2026-10-11 14:09:47 +02:00
Hannah Lyons 6bc537ce01 feat(libkernel_sys): implement symlink 2026-10-11 07:31:49 -04:00
Dani 0e4d94ce39 fix(libkernel_sys): check fchdir search permission on Linux 2026-10-11 13:18:30 +02:00
Adrià 74981fabe1
Merge pull request #3439 from babyhuey/feat/libkernel-sys-fstatfs
feat(libkernel_sys): export fstatfs
2026-10-11 12:42:21 +02:00
Hannah Lyons 81075a66c6 feat(libkernel_sys): export fstatfs 2026-10-11 06:30:50 -04:00
MarcZX100 1a73d0165e fix(libkernel_sys): use C ABI for fchdir helpers 2026-10-11 10:26:53 +00:00
Tharun Balaji 5a8091fafd feat(libkernel_sys): implement fchdir
FreeBSD fchdir(2) changes the working directory to the directory referenced by a descriptor. The guest imports fchdir from libkernel_sys (PPSA99764, issue #1578) and the module did not export it.

The descriptor's directory is resolved from the path recorded when the directory was opened on Windows, and from the /proc/self/fd link target on Linux. The guest working directory is then set through the libc routine shared with chdir. A descriptor that is not open returns EBADF and one that is not a directory returns ENOTDIR.

AI-assisted: yes
(cherry picked from commit 76329cbb08781e13d757c3ff955acf71f8bd506f)
2026-10-11 10:26:53 +00:00
Hannah Lyons 0e8dc6f20f feat(libkernel_sys): implement link 2026-10-11 05:47:59 -04:00
Adrià Franch d4b9808705 fix(libkernel_sys): keep umask bits up to 07777 like FreeBSD
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-11 03:36:40 +02:00
Hannah Lyons 967de40393 feat(libkernel_sys): export fork and implement setsid and umask 2026-10-11 03:36:32 +02:00
MarcZX100 0e838c5be3 fix: skip zero-length memcpy calls 2026-10-10 21:23:19 +13:00
Hannah Lyons d024717ebe feat(libkernel_sys): implement readlink 2026-10-09 17:30:55 -04:00
boykopovar 8f2bca5481 refactor(libkernel): merged dup pthread functions from _sys and _web 2026-09-13 16:24:42 +03:00
boykopovar abc72da741 feat(libs): define vabi macros + add to declarations 2026-09-10 08:07:03 +03:00
boykopovar d5bc6c9f66 refactor(libkernel): remove dup functions 2026-09-07 09:41:47 +03:00
boykopovar 6123893998 feat(libs): throw not impl ex in every stub 2026-09-06 15:05:04 +03:00
boykopovar 55a120e318 fix(nid): detect linker suffix-merged symbol names postfixes 2026-08-21 14:45:07 +03:00
boykopovar 8627076df5 fix(libs): drop std name collisions via nid postfix + remove custom entry point 2026-08-21 00:26:40 +03:00
boykopovar 47099897ac fix(libs): fix libscelibcinternal crt symbol conflict, stray macro in pthread_once, missing typedefs, unnamed params 2026-08-20 23:58:06 +03:00
boykopovar 59bee8d187 feat(libs): add libs function signatures 2026-08-20 23:18:16 +03:00