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]>
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]>
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]>
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]>
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".
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.
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.
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]>
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]>
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.
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.
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.
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.
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.
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.
The PS5 3.20 export lists have pselect in libkernel as well as
libkernel_sys, and on Windows a libkernel import never reaches
libkernel_sys. The implementation moves unchanged to
libkernel/Socket/src/Pselect.cpp, beside select.
The PS5 3.20 export lists have ktimer_* in libkernel as well as
libkernel_sys, and on Windows a libkernel import never reaches
libkernel_sys. The implementation moves unchanged to
libkernel/Time/Ktimer.cpp.