Commit Graph
1068 Commits
Author SHA1 Message Date
orezraeyandClaude Opus 5.5 e385217047 fix(libkernel): report the sysctl system strings and integers a PS5 reports
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 21:03:34 -03:00
orezraeyandClaude Opus 5.5 a855c30531 fix(libkernel): follow the destroyed condition marker and thread attribute queries as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 20:47:18 -03:00
Yunus Shaikh b463132a56 Merge main into fix/libkernel-signal-handler-mask
# Conflicts:
#	core/libs/prx/libkernel/System/src/Signals.cpp
#	docs/dev/debt/libkernel.md
2026-10-22 16:27:25 -07:00
Dean 895f47f4ee Merge pull request #8866 from ycbuzi/feat/libkernel-sigintr
feat(libkernel): export _sigintr and let signal honour it
2026-10-23 12:19:08 +13:00
Dean 8964c12d5c Merge pull request #9218 from slopggobblercobbler81/feat/libkernel-setresuid-setresgid
feat(libkernel): implement setresuid and setresgid
2026-10-23 11:10:12 +13:00
Dom3005andClaude Opus 5.5 d426d2f9ef docs(debt): keep the fstatfs entry under the debt length limit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 23:06:03 +02:00
Dom3005andClaude Opus 5.5 93ab8d3514 fix(libkernel): answer fstatfs on a character device as devfs does
FreeBSD keeps every character device on devfs, whose devfs_statfs reports
512-byte blocks, 2 blocks and nothing free. Windows threw for any console,
NUL or the guest random device, and Linux described the host's /dev mount.
A kqueue now returns EINVAL, as getvnode does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 23:06:03 +02:00
Yunus Shaikh 7b6c3aae83 Merge main into feat/libkernel-sys-libthr-names
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-22 13:51:29 -07:00
Dean fe8b9b5ddd Merge pull request #8906 from hypermoist/fix/coredump-set-user-data-type
fix(libkernel): give sceCoredumpSetUserDataType its signature and result
2026-10-23 09:41:20 +13:00
orezraeyandClaude Opus 5.5 c399333e7a docs(libkernel): record that released flexible pages keep their host memory
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 17:09:36 -03:00
orezraeyandClaude Opus 5.5 2f8177d7b4 fix(libkernel): keep the range sceKernelReleaseFlexibleMemory releases mapped
Measured on firmware 13.60: the released range stays mapped with its
protection and contents, and a fixed no-overwrite map over it fails
with ENOMEM; a null or unaligned address, an unaligned length or a
range that wraps returns EINVAL, checked before a zero length, which
returns 0, as does a range with nothing mapped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 17:09:36 -03:00
orezraeyandClaude Opus 5.5 eebb009302 fix(libkernel): report AIO states as a PS5 does after the first read
Measured on firmware 13.60: the first poll or wait that reports a
finished request returns its plain state and later ones add bit
0x10000, while cancel returns the plain state and does not count as a
read; a request that fails completes with state 3 and the error in its
result, and the other requests of its batch still run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 16:57:51 -03:00
orezraeyandClaude Opus 5.5 581a951db8 fix(libkernel): answer unknown AIO ids with ESRCH states as a PS5 does
Measured on firmware 13.60: an id that is not a live request, including
one already deleted, makes poll, wait, cancel and delete return 0 and
write 0x80020003 for it; delete makes an id unknown, and cancel leaves a
finished request's state unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 16:57:51 -03:00
orezraeyandClaude Opus 5.5 2730b6abe5 fix(libkernel): match the AIO batch, priority and parameter limits to PS5
Measured on firmware 13.60: submits take 1 to 128 requests at priority
1 to 3, the id lists of poll, wait, cancel and delete take 1 to 128 ids,
wait takes mode 1 or 2, and sceKernelAioSetParam takes a window and a
delayed count of 0 to 128, a split flag of 0 or 1 and, with split on,
split and chunk sizes of 1 to 0x1000000; everything else returns EINVAL
without writing. sceKernelAioInitializeParam writes the console's three
default scheduling structs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 16:57:51 -03:00
HQasperandClaude Opus 5.5 8fd72f02c5 fix(libkernel): poll kqueues as kqueue_poll answers
A kqueue descriptor is ready for POLLIN and POLLRDNORM while one of its
events is triggered and for no other event, as FreeBSD's kqueue_poll
answers; poll threw for it on both hosts. A kqueue cannot be waited on,
so while one is polled poll checks it every millisecond and waits on the
other descriptors in slices of 1 ms. This is the loop Windows already
used for pipes, which Linux now shares.

A kqueue closed during the wait reports POLLNVAL, and one whose number
was reused is polled again with the rest of the timeout, as FreeBSD's
pollrescan looks the descriptor up again.

Depends on #7248.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 18:13:27 +00:00
bluandClaude Opus 5.5 0017ed2660 Merge branch 'boykopovar:main' into feat/libc-siginterrupt
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 10:56:17 -07:00
Adrià 29b25aaf4a Merge pull request #9101 from xXPBSXx/fix/flock-directory-windows
fix(libkernel): accept flock on a directory descriptor on Windows
2026-10-22 19:42:03 +02:00
Adrià c55d7c8e7b Merge pull request #8670 from xXPBSXx/fix/stream-send-after-reset-epipe
fix(libkernel): report EPIPE for a stream send on a connection the peer closed on Windows
2026-10-22 19:40:02 +02:00
Dean 6a6a35fdf5 Merge pull request #7965 from frankea/ps5-measured-1340
fix(libs): values measured on a PS5 (firmware 13.40) from inside retail games
2026-10-23 06:18:10 +13:00
xXPBSXxandClaude Sonnet 5.5 ff2b4ba4cc fix(libkernel): report EPIPE for a stream send on a connection the peer closed on Windows
sosend_generic fails a send on a socket that can send no more with EPIPE
before it looks at so_error. Winsock reports the same send as WSAECONNABORTED
or WSAECONNRESET, which reached the guest as ECONNABORTED or ECONNRESET.
A stream send now maps both to EPIPE. The send-after-close checks of
guest_tcp, guest_socket_read_write and guest_socket_pair run on Windows too.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-22 19:09:29 +02:00
Retr0 124dc3b3ac feat(libkernel): answer kern.boottime in sysctl and sysctlbyname
FreeBSD 11.4 serves kern.boottime ({CTL_KERN, KERN_BOOTTIME}) from
sysctl_kern_boottime in sys/kern/kern_tc.c as a read-only 16-byte struct
timeval, so a size query reports 16, a short buffer gets a partial copy
and ENOMEM, and a write gets EPERM from sysctl_root. sysctl, sysctlbyname
and sysctlnametomib now answer it with the guest CLOCK_REALTIME minus
CLOCK_UPTIME, taken at the first read and kept. HotSpot reads it while
writing its error report, which aborted with "unsupported MIB 1.21".
2026-10-22 20:04:05 +03:00
Retr0 be4fd86249 fix(libkernel): disconnect a connected datagram socket on connect to port 0
FreeBSD 11.4's soconnectat() (sys/kern/uipc_socket.c) disconnects a
connected socket of a protocol without PR_CONNREQUIRED before it calls
pru_connect. udp_disconnect() and udp6_disconnect() drop the peer and
reset the local address, then in_pcbconnect_setup() and in6_pcbladdr()
fail port 0 with EADDRNOTAVAIL, so the socket is left unconnected.
connect to port 0 on a connected datagram socket now dissolves the
association through the AF_UNSPEC disconnect path before failing with 49,
where it kept the old peer. Stream sockets keep EISCONN.
2026-10-22 20:00:13 +03:00
orezraeyandClaude Opus 5.5 d34f5c9181 Merge main into fix/libkernel-msync-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 13:09:58 -03:00
Adrià 8499ea52e5 Merge pull request #8499 from xXPBSXx/fix/sendto-port-zero
fix(libkernel): fail sendto to port 0 from an unbound IPv4 datagram socket with EADDRNOTAVAIL
2026-10-22 17:54:00 +02:00
Adrià 093149c5bd Merge pull request #8483 from xXPBSXx/fix/poll-peer-close-pollin
fix(libkernel): report a stream whose peer closed as readable in poll on Windows
2026-10-22 17:44:27 +02:00
Kraken bf787dc895 chore(libkernel): merge current main for timed join integration 2026-10-22 15:25:35 +01:00
Retr0 f04af479e6 test(libkernel): require EINPROGRESS from a nonblocking connect in progress
FreeBSD 11's kern_connectat fails a nonblocking connect that is still
connecting with EINPROGRESS (36), a second one while it is still
connecting with EALREADY, and soconnectat fails one on a connected
stream socket with EISCONN. On Windows connect has reported
WSAEWOULDBLOCK as EINPROGRESS since 79e162110, but the poll test still
accepted EAGAIN (35) and the socket error numbers debt entry still
listed the gap. Require 36 in the poll test and cut the stale sentence.
2026-10-22 16:59:54 +03:00
Dom3005andClaude Opus 5.5 4892b71494 docs(debt): match the Windows directory descriptor entry to the code
d31e28308 made getdents and getdirentries throw on a name above the
one-byte d_namlen limit, and #8591 made getdirentries report the entry
index of its block through basep. The libkernel entry still described
ENAMETOOLONG and a basep of 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 15:52:04 +02:00
Dean 830ccd121f Merge pull request #9303 from oneandonlydean/fix/getdents-app0-symlink-type
fix(libkernel): report app0 symlinks as their target type in getdirentries
2026-10-23 02:19:24 +13:00
LeandroLP23andClaude Opus 5.5 6e1df42286 feat(libkernel): answer kern.proc.env for the calling process
PS5VR (PPSA99177) reads sysctl {CTL_KERN, KERN_PROC, KERN_PROC_ENV, pid}
for its own pid at start-up and stopped on "unsupported MIB 1.14.35.<pid>".
The call now returns the empty start-up environment that environ and
libc's getenv also begin with, and follows FreeBSD 11's
sysctl_kern_proc_env for the errors: EINVAL for a MIB without exactly one
pid, ESRCH for another pid or -1, EPERM for a write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 14:57:08 +02:00
Yunus Shaikh e8172f8078 fix(libkernel): leave unmeasured scePthreadMutexattrSetkind inputs unimplemented
A null or uninitialized attribute, and a kind outside 1 to 4, threw
std::invalid_argument. They now go through NotImplemented_nid_no_patch,
as pthread_rwlockattr_settype_np's unmeasured types do. FreeBSD 11
libthr stores an unknown kind unchecked and answers a null attribute
with -1 and errno EINVAL, so scePthreadMutexattrSettype's
SCE_KERNEL_ERROR_EINVAL would match neither answer.
2026-10-22 01:44:01 -07:00
SebastianandClaude Opus 5.5 f2766b2447 docs(debt): drop the unmodelled O_EXCL reopen from the named semaphore entry
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QnkpF2oEMofseVz9Z7WEAC
2026-10-22 08:29:03 +00:00
ArjenS-LA 4fb4187bd3 fix(libkernel): classify Windows directory links by app0 scope 2026-10-22 00:02:38 -07:00
Yunus Shaikh b23cbb5bb8 Merge main into feat/libkernel-sys-libthr-names
# Conflicts:
#	core/libs/prx/libkernel_sys/Export.Discovery.cpp
2026-10-21 23:43:23 -07:00
Yunus Shaikh fa3cbbe32b fix(libkernel): leave rwlock attribute types other than 0 to 2 unimplemented
pthread_rwlockattr_settype_np stored any type and returned 0. The console's answer to a type outside 0 to 2 is unknown, and shadPS4 returns EINVAL once the stored type is above 2, so such a type now goes through NotImplemented_nid_no_patch. Types 0 to 2 are stored but not applied, so the debt entry moves to the silent stubs.
2026-10-21 22:59:51 -07:00
orezraeyandClaude Opus 5.5 8a217a1224 docs(libkernel): record the unmeasured sceKernelCreateEventFlag error order
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 02:52:40 -03:00
Yunus Shaikh 280849ebde Merge main into fix/libkernel-signal-handler-mask 2026-10-21 22:33:02 -07:00
Yunus Shaikh 410536f795 Merge main into fix/libkernel-udp-unreachable-port 2026-10-21 22:25:29 -07:00
thuanquangandClaude eceec15c61 docs(libkernel): drop the stale 32-signal limit from the pthread_sigmask entry
Co-Authored-By: Claude <[email protected]>
2026-10-22 10:44:59 +07:00
Yunus Shaikh db33bdb16a feat(libkernel): add scePthreadMutexattrSetkind
The SCE name moves from a libkernel_sys stub to libkernel. Kinds
MutexType::ErrorCheck (1) to MutexType::Adaptive (4) are the mutex
types FreeBSD 11 libthr's pthread_mutexattr_setkind_np stores, and are
set through scePthreadMutexattrSettype, which maps the same values onto
those types. Other kinds and a null or uninitialized attribute throw, as
their console answer is not known.

guest_kernel_sys_pthread_np_kind round-trips kinds 2, 3, 4 and 1
through pthread_mutexattr_gettype, checks that kind 1 makes a second
lock return EDEADLK and kind 2 lets it succeed, and checks the throws
for kinds 0, 5 and -1 (the type unchanged) and for a destroyed or null
attribute.
2026-10-22 03:02:46 +00:00
Yunus Shaikh 0d81fe5712 feat(libkernel): add pthread_rwlockattr_settype_np
The POSIX name moves from a libkernel_sys stub to libkernel and stores the
type through its SCE twin scePthreadRwlockattrSettype, converting the
result as the other POSIX rwlock calls do.

guest_kernel_sys_pthread_np_rwlockattr checks types 0, 1 and 2 through
both names, a rwlock built from the attribute, and the throws for a
destroyed or null attribute.
2026-10-22 03:02:46 +00:00
hypermist 1f8d4769b4 Merge remote-tracking branch 'upstream/main' into fix/coredump-set-user-data-type
# Conflicts:
#	core/libs/prx/libkernel/System/src/Coredump.cpp
#	core/libs/tests/GuestCoredumpUserData.cpp
2026-10-22 15:54:42 +13:00
Kraken 40c7168f9c Merge remote-tracking branch 'origin/main' into feat/libkernel-pthread-timedjoin 2026-10-22 03:48:39 +01:00
blu 9897260c6e Merge branch 'boykopovar:main' into pr/windows-reparse-non-link 2026-10-21 19:08:16 -07:00
blu c08e752fef Merge branch 'boykopovar:main' into feat/libkernel-sigintr 2026-10-21 19:03:58 -07:00
blu b440d11cbb Merge branch 'boykopovar:main' into feat/libc-siginterrupt 2026-10-21 19:03:47 -07:00
Yunus Shaikh 56b2a6393f fix(libkernel): keep another thread's block of a signal a running handler also blocks
A handler's blocks are now holds kept apart from the mask sigprocmask sets, and released when the handler returns, so a sigprocmask(SIG_BLOCK) from another thread meanwhile survives even for a signal in the handler's sa_mask. sigprocmask reports the holds; SIG_UNBLOCK of a held signal releases its hold and SIG_SETMASK, which longjmp uses, releases them all, while sigsuspend's own restore keeps them.
2026-10-21 16:39:02 -07:00
Yunus Shaikh 780aa44726 fix(libkernel): block every word of a signal handler's mask while it runs
main now keeps all four words of the guest signal mask. A handler's sa_mask above signal 32 is added too, and SIGKILL and SIGSTOP stay unblocked, as sigprocmask leaves them.
2026-10-21 15:52:34 -07:00
Yunus Shaikh e607ba1b41 Merge main into fix/libkernel-signal-handler-mask 2026-10-21 15:52:33 -07:00
qpavyros f9cd3ba1ce chore: merge current main into named shared memory 2026-10-22 01:44:14 +03:00