Repository navigation
Conversation
pthread_atfork (U9t5kJAWPnA, aerolib) appends the prepare, parent and
child handlers to a process-wide list under a lock and returns 0, or
ENOMEM when the entry cannot be allocated, as FreeBSD 11.4's
_pthread_atfork does (lib/libthr/thread/thr_fork.c:78-100, freebsd-src
8c639945a44588f6cfdddfb057bb5aad88735da0). Null handlers are accepted;
FreeBSD's fork skips them. The handlers never run: fork
(libkernel_sys) throws and vfork is absent, so no child process is
created. The list is kept, in registration order, for a later fork
(PthreadAtforkHandlers_nid_no_patch); recorded in TechnicalDebt.
XPSemu (PPSA97358) calls it from a constructor, before main
(ZiZc3/XPSemu 8eec07b4, util/rcu.c:488-495):
static void __attribute__((__constructor__)) rcu_init(void)
{
smp_mb_global_init();
#ifdef CONFIG_POSIX
pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child);
#endif
rcu_init_complete();
}
so a throwing export would stop the title before main. Predicted stop
removed (registry index 255, not run):
FAIL: unresolved ELF import U9t5kJAWPnA from libkernel.prx
guest_pthread_atfork checks registration order, null handlers,
concurrent registration from four threads and that no handler runs.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mlockall (x7g7Ebeo8-U, aerolib) follows FreeBSD 11.4's sys_mlockall
(sys/vm/vm_mmap.c:1067-1131, freebsd-src
8c639945a44588f6cfdddfb057bb5aad88735da0) for the flag check: 0 or
bits outside MCL_CURRENT (1) and MCL_FUTURE (2) fail with EINVAL. The
title process is taken to pass priv_check(PRIV_VM_MLOCK), as mlock
already does.
Valid flags throw. MCL_FUTURE would need every later guest and host
mapping to be locked; nothing in the mapping paths does that, and
passing it to the host would make later host allocations fail above
the host RLIMIT_MEMLOCK. MCL_CURRENT would have to lock the whole
process, which on AnyPS5 also holds host stacks, heaps, modules and
driver mappings (sceKernelVirtualQuery reports them as guest memory),
with ENOMEM above a guest RLIMIT_MEMLOCK that is not known (getrlimit
throws for it). mlock pins host pages (VirtualLock, mlock) range by
range and keeps no record, so there is no state to extend. Recorded
in TechnicalDebt.
XPSemu (PPSA97358) calls it only with -overcommit mem-lock=on
(ZiZc3/XPSemu 8eec07b4, os-posix.c:330-355, reached from
system/vl.c:831-835):
int flags = MCL_CURRENT | MCL_FUTURE;
...
ret = mlockall(flags);
if (ret < 0) {
error_report("mlockall: %s", strerror(errno));
}
and exits on failure, so that option ends in the throw; without it
the title is not affected. Predicted stop removed (registry index 201,
not run):
FAIL: unresolved ELF import x7g7Ebeo8-U from libkernel.prx
guest_mlock checks EINVAL for 0, 4, 5 and -1 and the throw for 1, 2
and 3.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
getdtablesize (sZuwaDPATKs, aerolib) is a throwing export. FreeBSD
11.4 makes it system call 89, sys_getdtablesize
(sys/kern/kern_descrip.c:338-355, freebsd-src
8c639945a44588f6cfdddfb057bb5aad88735da0):
min(lim_cur(RLIMIT_NOFILE), maxfilesperproc); FreeBSD 11.4 has no
lib/libc/gen/getdtablesize.c. Neither the console's RLIMIT_NOFILE soft
limit nor kern.maxfilesperproc is published: shadPS4 443f0224 has no
getdtablesize or RLIMIT_NOFILE (its posix_sysconf table answers
_SC_OPEN_MAX with -1, without a stated source), KytyPS5 4733b7e and
OpenOrbis 0a1aaf9d have neither, fpPS4 04cefd43 returns High(Integer)
as a placeholder, SharpProspero 5dfdb4b0 only binds it. getrlimit
keeps throwing for RLIMIT_NOFILE for the same reason. Recorded in
TechnicalDebt.
VLC (PPSA85300) and XPSemu (PPSA97358) import it and call it only from
their own closefrom (ZiZc3/VLC f3253020 and ZiZc3/XPSemu 8eec07b4,
ps5/compat/libc_stubs.c:67-73):
void closefrom(int lowfd)
{
int max = getdtablesize();
for (int fd = lowfd < 0 ? 0 : lowfd; fd < max; fd++) {
close(fd);
}
}
so the value decides how many close calls run, including over the
libSceNet descriptor range. With the export the titles load; a call
ends in the throw. Predicted stops removed (VLC registry index 354
after boykopovar#3556, XPSemu 395, not run):
FAIL: unresolved ELF import sZuwaDPATKs from libkernel.prx
guest_getrlimit checks the throw.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Progress report (a11c8f7 → 028c1b4)📈 System libraries: 85.82% (+0.01%, +3 implemented functions) ✅ 3 implemented
⚪ 1 behaviourally empty (constant return or throw)
|
This was referenced Oct 11, 2026
Contributor
|
Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
|
9 tasks done
This was referenced Oct 11, 2026
This was referenced Oct 11, 2026
5 tasks done
Collaborator
|
Closing: |
10 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Carries the three commits from David's ready branch for issue #3628, preserving his authorship. Exports
pthread_atfork,mlockall, andgetdtablesizeso XPSemu and VLC can resolve their imports. Their next startup stops are predicted from registry order and have not been observed in a title run.pthread_atforkrecords prepare, parent, and child handlers in registration order and returnsENOMEMon allocation failure. Handlers are not run becauseforkthrows andvforkis absent; the limitation is documented in TechnicalDebt.mlockallreturnsEINVALfor invalid flags and throws for valid requests because locking the whole host process or all future guest and host mappings is not implemented.getdtablesizethrows because the console'sRLIMIT_NOFILEsoft limit andkern.maxfilesperprocare unknown. Returning a guessed limit would cause callers'closefromloops to close a guessed descriptor range.Semantics are based on FreeBSD 11.4 (
8c639945); the issue body records the source references and title call sites.Tested
guest_pthread_atfork_tests,guest_mlock_tests,guest_getrlimit_tests); CTest passed all three.python3 tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpassed.Checklist
main; no other open PR implements these functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository