Repository navigation
feat(libkernel): implement pthread_atfork registration - #4377
Conversation
|
Windows test: head AI-assisted (Claude Code). |
|
Rebase handoff — rebased onto current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
To pick it up: |
7a510b6 to
63a14ad
Compare
63a14ad to
e2b64cc
Compare
e2b64cc to
f196b6f
Compare
|
#3980 ( |
|
I do not have a runtime log showing PPSA97358 reaches pthread_atfork after #3980. The separate XPSemu report on #4386 establishes an mlockall import stop, not an atfork call, and the original #3628 report described these stops as predictions. I will not claim title validation for this PR without that log; the PR still needs the requested rebase and current-main evidence. |
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>
(cherry picked from commit f37bccf)
f196b6f to
8d455b8
Compare
|
Not yet. The current-main XPSemu run cited on #4386 stops first at the unresolved |
|
Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release. Built on
AI-assisted (Claude Code). |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
What
Carries the
pthread_atforkimplementation from #3628, preserving its original commit author. It records prepare/parent/child handlers in registration order and returnsENOMEMon allocation failure. Null handlers are accepted. Sinceforkis not implemented, registered handlers do not run; unload-time removal is also not modeled, and both limits are documented indocs/dev/debt/libkernel.md.Tested
guest_pthread_atfork; a Linux rebase handoff reported the full suite passing.Current title evidence
PPSA97358 has a source-level
pthread_atforkcall, but a current-main run has not shown it as the active unresolved import. XPSemu's verified first stop ismlockall(#4386). No title-unblocks claim is made until a run recordspthread_atforkas the next stop after the earlier imports are resolved.Checklist
main; no other open PR implements this functionpthread_atfork