On PS5 firmware 13.60 setpriority(PRIO_PROCESS, 0, v) returns 0 for -25,
-5, 5 and 25, and getpriority keeps returning 0. setpriority keeps its
target checks and returns 0 without storing the value.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Implement pthread_attr_setcreatesuspend_np, pthread_resume_np,
pthread_resume_all_np and pthread_multi_np with the sce forms
scePthreadAttrSetcreatesuspend, scePthreadResume, scePthreadResumeAll
and scePthreadMulti, following FreeBSD 11.4 libthr and the firmware
13.42 libkernel_sys module. A thread created suspended waits before its
start routine, outside any cancellation point, until it is resumed.
sceKernelRaiseException throws on Windows for a thread still suspended
at creation.
A handler that read the mask and put it back with SIG_SETMASK stored its
own signal, which sigprocmask reports from the hold, in the process mask
and cleared the hold, so the signal stayed blocked after the handler
returned. pselect, setcontext and a siglongjmp inside the handler replace
the mask the same way. When the handler's own thread releases a hold, the
signal now gets back its bit from before the handler when the handler
returns, as FreeBSD's sigreturn puts back the mask from before it. A mask
another thread sets meanwhile is kept.
On PS5 firmware 13.60 sceKernelGetProsperoSystemSwVersion and
sceKernelGetSystemSwVersion return 0 for every value in the leading size
field, keep it, write the string and the packed version, and return 0
without writing for a null block.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's #10706 moves the declarations of exported functions and their types
into the libraries' public headers, and gives WaitForPendingInSet a
KernelTimespec timeout. The merge keeps this branch's DeliverUnblockedPending
and ChangeBlockedMask with main's KernelTimespec. It takes main's side of
the declarations in GuestSignalSets.cpp, whose setjmp and longjmp this
branch had added and libc's Api.hpp now declares. GuestSignalHandlerMask.cpp
includes the libkernel and libc public headers in place of its own
declarations and GuestSignalSet and GuestSigaction types, as the
public_headers audit requires.
The PS5 3.20 export lists have swapcontext in libkernel as well as
libkernel_sys, and on Windows a libkernel import never reaches
libkernel_sys. The assembly entry in UserContext.cpp now is
swapcontext_nid_postfix, and the libkernel_sys jump stub is gone.
CopyOut passed a null source to memcpy for the kern.proc.env query, which reports no data. The copy length is 0 there, but a null source is undefined behavior for memcpy whatever the length, and UBSan reports it in guest_system_configuration. Copy only when there is something to copy.
Source Port (PPSA20040) checks whether a debugger is attached with
sysctl {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()} into a 1,088-byte
buffer and tests P_TRACED (0x800) in ki_flag at offset 0x170; the MIB was
unsupported, so the title threw at start-up. Return a FreeBSD 11 amd64
kinfo_proc for the calling process with ki_structsize, ki_pid, ki_ppid and
ki_comm filled and every other field 0, so P_TRACED is clear. Like
kern.proc.vmmap, any other pid fails with ESRCH, a write with EPERM and a
short buffer with ENOMEM. The rest of the record is not measured on a
console and is recorded as debt.