Commit Graph
227 Commits
Author SHA1 Message Date
bluandClaude Fable 5.1 0900ff6ff0 feat(libc): implement siginterrupt through the sigaction libkernel registers
siginterrupt is a libSceLibcInternal export (the public SDK's stub table has it there, not in the
kernel tables) and FreeBSD 11.4's lib/libc/gen/siginterrupt.c reads the signal's disposition,
sets or clears the signal's bit in _sigintr and SA_RESTART, and installs the disposition again.
libc cannot call libkernel, so, as the pthread hooks do, libc keeps a registered sigaction and
the address of the _sigintr set, and libkernel registers both from a static initializer when it
loads. A call before that throws; the set is written without libkernel's registration lock, as
FreeBSD's libc does. Builds on #8866, which adds the set.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-20 20:53:14 -07:00
Dean 2ea908a9ae Merge pull request #8841 from oneandonlydean/docs/host-write-rule
docs(dev): require a HostWrite bracket around host writes into guest memory
2026-10-21 15:44:14 +13:00
Dean 5d10ea9ea0 Merge pull request #8791 from JJenkx/windows/calltrace-faulting-thread
feat(libc): list the reporting thread's own calls in the call trace report
2026-10-21 15:40:39 +13:00
Dean Galvin 05d7bdb088 docs(dev): require a HostWrite bracket around host writes into guest memory
Kernel and native-library writes into guest pages the write watch left read-only fail with EFAULT on macOS and ERROR_NOACCESS on Windows (#7473). State the rule where contributors look and point the macOS write-watch debt entry at it.
2026-10-21 14:57:32 +13:00
Dean b13183e59e Merge pull request #7473 from Dripl1x/codex/skip-clean-resident-write-watch
perf(libc): skip write-watch queries for proven clean resident ranges
2026-10-21 14:55:09 +13:00
Dean 6c12024f7d Merge pull request #8741 from Queuse/fix/libc-freopen-share-delete
fix(libc): share delete on standard stream reopen
2026-10-21 14:47:29 +13:00
Dean 994829e44b Merge pull request #8733 from p3n1cillin/codex/libc-unlocked-status-20261020
feat(libc): implement unlocked stream status queries
2026-10-21 14:24:31 +13:00
JJenkxandClaude Opus 5.5 3316ca3b24 feat(libc): list the reporting thread's own calls in the call trace report
The crash and abort reports printed the last 64 traced calls of the whole
process, so a thread that loops on a traced import (a mutex lock/unlock
pair, a profiler marker) pushes the calls of the faulting thread out of the
report. The ring already keeps the last 65536 calls with their thread.

CopyThreadCallTrace_nid_no_patch returns the most recent calls of one
thread from that ring, oldest first, and both reports (Windows crash and
abort, Linux abort) list up to 32 of them for the reporting thread after
the process-wide list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 20:25:31 -04:00
Dean b56cfb3817 Merge pull request #8444 from SwetabhSingh17/feat/libc-mem-utilities
feat(libc): implement memmem and memccpy
2026-10-21 13:24:46 +13:00
Dean 70c497739e Merge pull request #8636 from cadenasynyster/fix/libc-thrd-detach
feat(libc): implement _Thrd_detach
2026-10-21 13:11:55 +13:00
Dean 273b1b87f4 Merge pull request #8388 from SwetabhSingh17/feat/libc-paf-mspace-posix-memalign
feat(libc): implement sceLibcPafMspacePosixMemalign
2026-10-21 12:20:57 +13:00
Queuze 3916eeaf6f fix(libc): share delete on standard stream reopen 2026-10-20 20:07:16 -03:00
Dean c8301bbca5 Merge pull request #8137 from hamb3r/feat/libc-backtrace-windows
feat(libc): implement sceLibcBacktraceSelf and GetBufferSize on Windows
2026-10-21 11:45:25 +13:00
p3nicillin dde6b34d37 feat(libc): implement unlocked stream status queries 2026-10-20 23:41:22 +01:00
Ethan Barr 4f6a37d790 fix(libc): share delete access when freopen reopens a stream onto a file on Windows
On Windows, freopen reopened a stream through _wfreopen, which opens the file without FILE_SHARE_DELETE, so remove or rename of the file failed while the stream was open, unlike fopen streams and POSIX unlink/rename of an open file. freopen now closes the previous stream and opens the new file through the same CreateFileW path fopen uses, so the reopened stream shares delete access. Host standard streams and an empty filename keep the _wfreopen path. Reference: FreeBSD 11 unlink(2) and rename(2) succeed on a file that is open.
2026-10-20 17:07:21 -04:00
Dean 29e4c46b4d Merge pull request #7417 from IshmamDC217/feat/relinker-trace-imports-linux
feat(relinker): support --trace-imports for Linux output
2026-10-21 09:03:29 +13:00
Evgeniy Kazarin 7898b5bd3a fix(libc): avoid repeated resident write faults 2026-10-21 03:55:51 +08:00
cadenasynyster 9e6544fbab docs(libc): shorten the _Thrd_detach debt entry 2026-10-20 21:43:57 +02:00
cadenasynysterandClaude Sonnet 5.5 a8b6d1c411 feat(libc): implement _Thrd_detach
Animal Well (PPSA22520) imports _Thrd_detach (L7f7zYwBvZA) from libc.prx and nothing exports it, so the Windows loader stops at startup. Register libkernel's pthread_detach with libc like pthread_create and pthread_join, and return _Thrd_error (4) when it fails.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

Claude-Session: https://claude.ai/code/session_01GtXavMkgCTCdmRpweviHcQ
2026-10-20 21:31:16 +02:00
hamb3r 50a4d5bfb3 chore(libc): merge main into feat/libc-backtrace-windows 2026-10-20 22:04:09 +03:00
Dean b85d972f42 Merge pull request #7897 from babyhuey/fix/libc-adopt-guest-heap-only-when-replaced
fix(libc): adopt the guest SDK allocator only when the title replaces the heap
2026-10-21 07:20:48 +13:00
Dean Galvin 143ed02750 Merge branch 'main' into #7417
Resolve docs/dev/debt/libc.md: keep main's _Throw_Cpp_error entry and this branch's call tracing entry.
2026-10-21 06:33:59 +13:00
Dean 542c65d74c Merge pull request #8023 from Ondra97/codex/fix-scaled-hyperbolic
fix(libc): avoid premature scaled hyperbolic overflow
2026-10-21 06:26:06 +13:00
Dean 0b1d678fe5 Merge pull request #8148 from hamb3r/feat/libc-dinkumware-threads
feat(libc): export Dinkumware thread primitives from libc.prx
2026-10-21 06:21:49 +13:00
Dean 77e31219c8 Merge pull request #8116 from dantdmdarealguy/fix/libc-readdir-fileno-windows
fix(libc): report the file number of each readdir entry on Windows
2026-10-21 04:55:57 +13:00
Adrià 1a48337f13 Merge pull request #7634 from imellag/fix/macos-guest-arena-walk-test
test(libc): check that the macOS guest arena keeps free space beside host regions
2026-10-20 17:47:19 +02:00
Swetabh Singh f3dec86695 feat(libc): implement memmem and memccpy 2026-10-20 18:12:52 +05:30
hamb3r 2693c44569 docs(libc): document Windows backtrace stop at PE unwind handlers 2026-10-20 15:22:50 +03:00
Swetabh Singh b67e2a3f2f feat(libc): implement sceLibcPafMspacePosixMemalign 2026-10-20 17:22:52 +05:30
Adrià 6bd02dd915 Merge pull request #7545 from ionut27001/fix/libc-strtod-nan-payload
fix(libc): parse NaN payloads in strtod as measured on a PS5
2026-10-20 12:25:58 +02:00
dantdmdarealguy 251ca1c100 fix(libc): report the file number of each readdir entry on Windows
readdir and readdir_r returned d_fileno 0 for every entry on Windows,
because MinGW's _wreaddir reports no inode. FreeBSD 11.4's
_readdir_unlocked (lib/libc/gen/readdir.c) never returns an entry whose
d_ino is 0, and d_fileno is the number lstat reports as st_ino.

The Windows directory stream now reads the listing from the directory
handle with GetFileInformationByHandleEx(FileIdBothDirectoryInfo), so
each entry carries the file ID of the entry itself, symbolic links
included, without opening it. The ID is folded as stat and lstat fold
nFileIndexHigh:nFileIndexLow; the fold moves to WindowsDescriptor.hpp so
both libraries use it. rewinddir restarts the scan, telldir and seekdir
count entries as _wtelldir and _wseekdir did, and opendir fails with the
open error of the directory. A file system that lists no file ID gets a
nonzero number hashed from the name. Linux truncates the host inode to
32 bits as stat does instead of reporting 0 above 2^32.

guest_directory checks that every entry has a nonzero file number, that
the numbers of a file, a subdirectory and symbolic links to both equal
lstat's st_ino, that an entry created or removed while the directory is
open shows up after rewinddir, that a delete-pending entry no lstat can
open is still listed, and that seekdir returns the same number.
2026-10-20 03:52:39 -05:00
hamb3r 57c8c01183 Merge branch 'main' into feat/libc-backtrace-windows 2026-10-20 10:15:56 +03:00
Dean 4a10f5f167 Merge pull request #8037 from MarrasFederico/feat/libc-strtonum
feat(libc): implement bounded decimal parsing with strtonum
2026-10-20 20:07:26 +13:00
Dean 8972f8ae3c Merge pull request #8129 from Th3EvilGod/codex/libc-precise-thread-sleep
fix(libc): use precise Windows thread sleep
2026-10-20 18:31:11 +13:00
Dean 329b9aa1a7 Merge pull request #7988 from MarrasFederico/feat/libc-getifaddrs-link-entries
feat(libc): list each interface's AF_LINK entry in getifaddrs on Linux
2026-10-20 17:51:27 +13:00
Dean bae00fad0a Merge pull request #7998 from priyanshrv-netizen/feat/libc-bessel
feat(libc): implement j0, j1, jn, y0, y1 and yn
2026-10-20 17:50:11 +13:00
Dean Galvin 20f75e94e0 Merge main into pr-8037
# Conflicts:
#	core/libs/tests/GuestStrings.cpp
2026-10-20 17:40:21 +13:00
Dean 1ae92bb7c9 Merge pull request #8174 from xXPBSXx/fix/rename-dot-component-fb
fix(libc): fail a rename of a path that ends in a dot component with EINVAL
2026-10-20 16:23:33 +13:00
priyanshrv-netizenandClaude Opus 5.5 16a7cece3b feat(libc): implement j0, j1, jn, y0, y1 and yn
The double Bessel functions follow the system libc.prx: FreeBSD msun
e_j0.c, e_j1.c and e_jn.c with every multiply-add the console fuses
done as one FMA, and the console's constant results for zero and
negative arguments of the second kind.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-20 06:38:32 +05:30
xXPBSXxandClaude Sonnet 5.5 49940998cd docs(libc): list the lookup order and the backslash separator among the rename dot component differences
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 02:57:14 +02:00
xXPBSXxandClaude Sonnet 5.5 9899ba0fa2 fix(libc): fail a rename of a path that ends in a dot component with EINVAL
rename and sceKernelRename resolved "dir/." to "dir" and renamed the directory. FreeBSD 11.4's lookup fails a last component of "." for DELETE and RENAME with EINVAL, for the source and the destination alike. Check the guest string before it is resolved: a last component of "." (also under trailing slashes) fails with EINVAL when its parent exists, ENOENT when it does not and ENOTDIR when it is not a directory.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 02:57:14 +02:00
xXPBSXxandClaude Sonnet 5.5 1ab777e257 docs(libc): list the backslash separator and the sceNgs2ParseWaveformFile exception among the path name length differences
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 02:47:58 +02:00
xXPBSXxandClaude Sonnet 5.5 6bc6c444e0 fix(libc): fail an oversized guest path name with ENAMETOOLONG
stat, open, mkdir, rename and the other calls that resolve a guest path answered ENOENT (or EIO for rename) for a name longer than 255 bytes or a path of 1024 bytes or more, because the host path just did not exist. FreeBSD 11.4's namei fails a component above NAME_MAX and a path of MAXPATHLEN bytes with ENAMETOOLONG. Check both limits on the guest string before it is resolved; FilesystemError already maps the error to 63.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 02:46:53 +02:00
hamb3r 47591f2e92 docs(debt): update sceLibcBacktrace technical debt entry for Windows 2026-10-20 03:28:37 +03:00
hamb3r 387be86004 docs(debt): move Dinkumware thread debt entries from libSceAmpr to libc 2026-10-20 03:22:13 +03:00
Adrià fafadca12c Merge pull request #7529 from Aspct3434/feat/swscanf-pointer
feat(libc): scan %p in swscanf and swscanf_s
2026-10-20 02:09:37 +02:00
Th3EvilGod 81b28cef61 fix(libc): use precise Windows thread sleep 2026-10-20 03:21:28 +04:00
Adrià 8b20da70a1 Merge pull request #7546 from ionut27001/fix/libc-rand48-zero-extend
fix(libc): return jrand48 and mrand48 zero-extended as measured on a PS5
2026-10-20 00:51:07 +02:00
Ishmam Ahmed 0bad015e21 fix(libc): keep the Linux call trace report when two threads abort
A thread that lost the race to write the report passed SIGABRT on straight away, and the default action ended the process while the first thread was still writing. It now waits for the report to finish, polling with nanosleep for at most 2 seconds, before it chains. guest_call_trace_abort_race aborts from two threads at once and checks the whole report; it failed 35 times in 50 without the wait. Reported by jotitadev.
2026-10-19 22:56:02 +01:00
Ishmam Ahmed 0454726744 fix(libc): write the Linux call trace report with signal-safe calls only
The SIGABRT handler used stdio and dladdr, so an abort raised while another thread held the stderr lock or the loader lock hung instead of ending. The report is now formatted into a stack buffer and written with write(2). Callers are named from a module list taken with dl_iterate_phdr when imports are traced, and import counts are read without a lock from a fixed record array. The abort test now holds the stderr lock in another thread, which timed out before this change.
2026-10-19 22:55:08 +01:00