Commit Graph
90 Commits
Author SHA1 Message Date
Dean 0f0d4004a4 Merge pull request #6517 from Wild-Badger/fix/libc-wide-collate-layout
fix(libc): count wide collate string elements
2026-10-18 09:41:21 +13:00
Adrià 5859889b29 Merge pull request #6133 from AkulTyagi11/feat/libc-modti3
feat(libc): implement __modti3
2026-10-17 21:06:42 +02:00
Dean 66702f1cff Merge pull request #7060 from Aryansh1520/fix/libc-backtrace-self-linux
feat(libc): implement sceLibcBacktraceSelf and GetBufferSize on Linux
2026-10-18 04:49:45 +13:00
Dean 7b763e6359 Merge pull request #7068 from AlexOfTheForest/fix/fopen-errno
fix(libc): translate host errno from fopen, freopen and fopen_s
2026-10-18 04:49:08 +13:00
Dean 05b235498a Merge pull request #7099 from Lorkydey/feat/libc-safe-error-messages
feat(libc): implement bounded error message APIs
2026-10-18 01:58:23 +13:00
Dean df92748a30 Merge pull request #6318 from hypermoist/fix/libc-lgamma-signgam
fix(libc): store the sign of gamma in an exported signgam from lgamma
2026-10-18 00:32:04 +13:00
lorkydey 14acf7f444 feat(libc): implement bounded error message APIs 2026-10-17 13:26:23 +02:00
Alexej Szpevák 5433b32b7d fix(libc): return the open error from fopen_s instead of ENOENT
fopen_s returned ENOENT for every failed open, including an invalid mode, a directory opened for writing and the loop and long-name cases. C11 K.3.5.2.1 only asks for a nonzero value; Microsoft's CRT, which shares Dinkumware's library, returns errno. fopen_s now returns the errno fopen set.
2026-10-17 11:52:14 +02:00
Aryan Sharma 2e0d310c91 docs(debt): link the backtrace entry from its debt file 2026-10-17 14:57:32 +05:30
Aryan Sharma ec832e0bcb fix(libc): limit sceLibcBacktraceSelf to Linux and test its record layout 2026-10-17 14:56:56 +05:30
Aryan Sharma ce57c2d799 feat(libc): implement sceLibcBacktraceSelf on Linux
PPSA28997 (IL2CPP) calls sceLibcBacktraceGetBufferSize and
sceLibcBacktraceSelf. On Linux the host call stack is captured with
backtrace and each frame is resolved to its module and offset with
dladdr, then written as a linked list of frame records. The record
layout is inferred and listed in TechnicalDebt. Windows throws.
2026-10-17 14:56:56 +05:30
Dean 437f157d31 Merge pull request #6319 from hypermoist/docs/debt-duplicate-entries
docs(debt): drop the call tracing entry that --trace-imports superseded
2026-10-17 17:28:35 +13:00
Adrià d96e0e554c Merge pull request #5772 from DavidSamir/fix/libc-empty-guest-environment
fix(libc): start the guest environment empty instead of copying the host's
2026-10-16 21:23:35 +02:00
Alexej Szpevák b71434d9b7 feat(libc): read app0.zar beside app0 and refuse archive-only paths elsewhere
A ZArchive named app0.zar beside app0/ is a read-only layer under it. libc opens it at the first path resolution, looks paths missing from app0/ up case-insensitively, reads files across compressed blocks and keeps the archived descriptor table with shared positions.

Resolving an archive-only path through a call that does not read the archive throws instead of failing with ENOENT, as do opendir of a directory present in both places, fdopen of an archived descriptor and chdir into the archive. A path through .. in an archive-only directory resolves.
2026-10-16 20:03:26 +02:00
hypermistandClaude Opus 5.5 20edd079e4 fix(libc): store the sign of gamma in an exported signgam from lgamma
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 16:11:02 +13:00
Adrià 7663bc63bb Merge pull request #5092 from MrMha/fix/scripting-heap-694
feat(libc): provide the runtime scripting allocator hooks
2026-10-15 22:58:23 +02:00
Anthony 2b567cda34 fix(libc): count wide collate string elements 2026-10-15 15:30:40 -03:00
Adrià d67b79a7e4 Merge pull request #5709 from fogydes/fix/libc-formatting-allocation-and-bounds
fix(libc): check allocation result in vasprintf and guard null pointer in strndup
2026-10-15 17:04:33 +02:00
Adrià f5a55a11d0 Merge pull request #5662 from Roojool/contrib/g15-libc-pending
feat(libc): implement collate<wchar_t>::_Getcat
2026-10-15 17:03:49 +02:00
Adrià 08290338aa Merge pull request #5599 from JJenkx/feat/libc-isfinitel
feat(libc): implement x87 long-double finite classification
2026-10-15 17:03:18 +02:00
Adrià 0dab493f5b Merge pull request #5816 from Nawasfadili/feat/libc-wide-and-unlocked-stream-io
feat(libc): implement wide and unlocked stream I/O
2026-10-15 15:58:44 +02:00
MrMha aea1dd601a feat(libc): provide the runtime scripting allocator hooks
Use the registered application allocator and the source-backed alignment/size signature. Add callback ownership and failure checks; record unmeasured console behavior.
2026-10-15 17:21:14 +04:00
Adrià FranchandClaude bc3f81c198 test(libc): pin vasprintf allocation failure; move debt line off the section end
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-15 14:44:16 +02:00
fogydes ceb963c6dd fix(libc): check allocation result in vasprintf and guard null pointer in strndup 2026-10-15 14:43:04 +02:00
hypermistandClaude Opus 5.5 7d7515b632 docs(debt): drop the call tracing entry that --trace-imports superseded
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 00:14:25 +13:00
Rujul Talekar 3dffc8ca9e fix(libc): give collate<wchar_t> its own 16-bit vtable 2026-10-15 11:07:58 +05:30
Akul Tyagi ec2acea5bd feat(libc): implement __modti3
Implement __modti3, the signed 128-bit integer modulo runtime helper complementing __divti3, __udivti3 and __umodti3. Add unit test coverage in guest_crt_tests and document zero-divisor exception behavior in technical debt.
2026-10-15 04:25:52 +05:30
Rujul Talekar 661b1671ff feat(libc): implement collate<wchar_t>::_Getcat 2026-10-14 22:27:59 +05:30
Nawasfadili 6509ec274a feat(libc): implement wide and unlocked stream I/O 2026-10-14 14:24:37 +00:00
Adrià Franch 32a11a57d1 docs(libc): move the fegetenv debt line off the end of its section 2026-10-14 14:02:31 +02:00
Karim IbrahimandClaude Opus 5.5 34cf0e223f test(libc): cover fegetenv with a null environment and pending x87 flags
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:02:31 +02:00
Karim IbrahimandClaude Opus 5.5 74b93adb6c feat(libc): implement fegetenv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:02:31 +02:00
Dean c3bad39372 Merge pull request #5434 from milescoviello/fix/relinked-module-name-case
fix(libc): find a relinked module whose name differs in case
2026-10-14 22:41:23 +13:00
David 69715e8393 docs(debt): record that the guest environment starts empty 2026-10-14 13:15:53 +04:00
Dean 3152609030 Merge pull request #5454 from mohammad-alosta/feat/libc-swprintf-s
feat(libc): implement swprintf_s
2026-10-14 20:12:15 +13:00
Dean 6546a33944 Merge pull request #4728 from Ondra97/codex/fix-fdopen-access-mode
fix(libc): reject incompatible fdopen access modes on Windows
2026-10-14 19:06:55 +13:00
Dean 1c95691fb5 Merge pull request #5290 from veosett/codex/allocator-failure-results
fix(libc): return allocation failures to guest callers
2026-10-14 17:26:13 +13:00
Dean 6ed374413e Merge pull request #4681 from milescoviello/fix/alias-trailing-slash
fix(libc): keep a trailing slash on paths under a mount alias
2026-10-14 17:25:15 +13:00
JJenkx 2f9d04fb77 chore: resolve current upstream integration conflicts 2026-10-13 23:13:49 -04:00
Dean 3e4fe4ce31 Merge pull request #5596 from tibzejoker/port/pr-637-main
fix(libc): track writes to singly mapped direct memory without faults on Windows
2026-10-14 15:53:44 +13:00
Dean 91e5f60880 Merge pull request #4822 from MarcZX100/fix/fopen-native-open-errors-4814
fix(libc): return native fopen errors
2026-10-14 15:36:11 +13:00
milescovielloandClaude Opus 5.5 f0c3a5c85e fix(libc): find a relinked module whose name differs in case
Borderlands 4 (PPSA01494) loads its UI library with
sceKernelLoadStartModule("/app0/prx/libRenoirCore.PS5.prx"), but ships
the module as prx/librenoircore.ps5.prx. On Linux the call fails:

    Could not load /app0/prx/libRenoirCore.PS5.prx result 0, handle result -2147352574

(0x80020002, ENOENT). Guest paths are resolved case-insensitively, but
that only finds a component that exists. With the documented layout,
app0/prx holds only the converted librenoircore.ps5.prx.guest.prx,
so the requested name resolves to itself and RelinkedModulePath then
looks for "libRenoirCore.PS5.prx.guest.prx" with its exact spelling.
Windows and macOS hosts ignore the case, so only Linux is affected.

RelinkedModulePath now falls back to the same ASCII case-insensitive
match as ResolveHostPath when the exact <name>.guest.prx is missing,
and throws for an ambiguous match as that does. dlopen,
sceKernelLoadStartModule, stat, open and sceKernelCheckReachability all
go through it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 01:31:24 +00:00
milescovielloandClaude Opus 5.5 ccfadfbeef fix(libc): keep a trailing slash on paths under a mount alias
Guest path resolution trimmed the trailing slash of a path under a
mount alias (/savedata0, /download0, /app0 and the others), so the host
saw "file" for "file/": unlink, remove, sceKernelUnlink and rename
removed or moved the file, open opened it, and chmod and access
succeeded on it. The same path outside an alias already failed with
ENOTDIR, because the host got the slash.

FreeBSD 11.4 rejects it in lookup() (sys/kern/vfs_lookup.c):

	/*
	 * If we're processing a path with a trailing slash,
	 * check that the end result is a directory.
	 */
	if ((cnp->cn_flags & TRAILINGSLASH) && dp->v_type != VDIR) {
		error = ENOTDIR;
		goto bad2;
	}

On Linux and macOS a path under an alias now keeps its trailing slash
on the host path, as paths outside an alias do, so the host fails with
ENOTDIR for a file and directories with a trailing slash still work.
Windows keeps the previous behaviour; TechnicalDebt records it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 01:31:01 +00:00
Dean dd7174423a Merge pull request #5009 from p3n1cillin/claude/libc-tzname
feat(libc): export tzname
2026-10-14 14:27:27 +13:00
thibautandClaude Opus 5.5 b7d7e71bf6 docs(libc): move the Windows direct memory debt entry to libc.md
The entry links WindowsMappings.hpp, so the debt-file convention puts it in
docs/dev/debt/libc.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1W4jdNSKTV7xwuS6xQPJV
2026-10-14 02:39:10 +02:00
alosta a0bd257a09 feat(libc): implement swprintf_s
Add the missing wide secure formatting exports required by PPSA15552
(Dead Cells), whose load failed with `undefined symbol: Im55VJ-Bekc`:
swprintf_s and its va_list counterpart follow C11 Annex K.3.9.1.4
(the complete output, including the terminator, must fit), while
vsnwprintf_s is the va_list counterpart of snwprintf_s (K.3.9.1.3,
truncation with full length). The export names produce NIDs
Im55VJ-Bekc, oDoV9tyHTbA and 8SKVXgeK1wY respectively. Document
the new functions in docs/dev/debt/libc.md.
2026-10-14 00:59:50 +01:00
JJenkx aa16bfc632 Merge commit '30f961266ade83b41d5c9de7dec1393e7fcecfb7' into feat/libc-isfinitel 2026-10-13 18:59:59 -04:00
David 773e7f218c docs(debt): describe the byte the Windows flock locks 2026-10-13 22:29:33 +00:00
screammandClaude Fable 5.1 8aa0d42824 feat(libc): implement swscanf
swscanf (HNnWdT43ues) runs the swscanf_s scanner without the buffer
size arguments after %s, %c and %[, as FreeBSD's swscanf.c passes its
arguments to vswscanf. Both entry points share one engine with a flag
for the sizes; swscanf_s behaves as before.

Title: PS5CEMU-HAR PPSA99360 imports swscanf from libSceLibcInternal.prx
(import audit with --trap-sdk-syscall-stubs, registry index 292, right
after pthread_setaffinity_np at 276). Predicted stop line once
pthread_setaffinity_np resolves, without this change:
FAIL: unresolved ELF import HNnWdT43ues (swscanf) from libSceLibcInternal.prx

NID from tools/nid_names.py, confirmed in shadPS4 aerolib.inl:51950
(e0a466753a1a). Prototype in ps5-payload-dev include/freebsd/wchar.h:133,
export in sce_stubs/libSceLibcInternal.c:8582 (f5d40f02770e).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-14 11:17:04 +13:00
Hussein Kadhim c520fda39b fix(libc): return ENOMEM when the host cannot commit a heap block and from reallocalign
A commit failure inside the guest arena threw and left the reserved range in use. The heap now resets and releases the range, and returns null with ENOMEM when the host is out of memory. reallocalign returns null with EINVAL or ENOMEM like the other allocator entry points.
2026-10-13 22:12:17 +06:00