P7 — I/O core + event loop + glue (progress log)#
The last faithful-port phase: s_bsd.c (select/poll loop, local[], highest_fd,
timeofday, FdAry), packet.c, bsd.c, ircd.c (main, io_loop, signals,
rehash/restart, tune file), plus the s_auth.c socket/ident/iauth-pipe I/O deferred
from P5. Ported bottom-up (leaf-first), same mechanism as P6. One-line summaries:
PLAN-P7-progress.md.
-
2026-06-05 — P7a (
common/bsd.c) merged. First P7 step; the socket write leaf.- Cluster choice —
bsd.cis the smallest remaining C TU (164 lines, 2 exportedbsd_ext.hsymbols):deliver_itanddummy. Leaf-first start of P7. - Config-resolved body — DEBUGMODE off → the
writecalls/writeb[10]write-size histogram and allDebug(())calls drop.HAVE_RELIABLE_SIGNALSundefined (not in setup.h/config.h) →dummycompiles the#ifndefbranch and re-arms viasignal()(SIGALRM/SIGPIPE/SIGWINCH; HPUX undefined, SIGWINCH defined on Linux) — the POSIXsigactionbranch (#else, gated on POSIX_SIGNALS=1) is NOT compiled. EMSGSIZE defined (Linux) → it joins the WOULDBLOCK errno set indeliver_it. - Port —
ircd-common/src/bsd.rs:deliver_it=send(2)wrapper mapping EWOULDBLOCK/EAGAIN/EMSGSIZE/ENOBUFS → 0 +FLAGS_BLOCKED, clearingFLAGS_BLOCKED- accumulating
sendBoncptr/me/cptr->acpt(guardedacpt != &me) on success, returning-savederrnoon a fatal error;dummyre-installs itself via libcsignal.mevia bindgen global (addr_of_mut!(me));errnovia__errno_location. Both#[no_mangle] extern "C"at the exactbsd_ext.hsignatures.BSD_LINK_ANCHORadded tolib.rs::link_anchor().
- accumulating
- Drop — both symbols portable →
"bsd.o"added toPORTEDinircd-sys/build.rsand dropped outright (no_link.o, no linkage seam). The cref oracle keepsbsd.oinCREF_OBJS, socref_deliver_it/cref_dummy(and the renamedcref_me) stay available for L1. Verified:nm target/debug/ircdshowsdeliver_it/dummyasT(from Rust); RED first confirmed exactly those two symbols undefined (referenced bysend.rs::send_queued+ Circd.c/s_bsd.c). - Classification — utility/callee TU (neither symbol is a
msgtabhandler). - L1 (
ircd-testkit/tests/bsd_diff.rs) — drives the Rust port (c_*) and thecref_*oracle over identically-set-up socketpairs; compares retval /cptr.flags/cptr.sendB/acpt.sendB/ the me-globalsendB(Rust→me, oracle→cref_me, the isolated-worlds pattern) / bytes the peer received. 5 cases covering the fullFLAGS_BLOCKEDmatrix (the inverse-invariant rule): happy path CLEARS it, WOULDBLOCK (saturated non-blocking socket) SETS it + returns 0 + no counters, error (closed peer →-EPIPE) leaves it UNTOUCHED + no counters; plus theacpt == &menot-double-counted guard anddummy's SIGALRM/SIGPIPE/SIGWINCH re-arming (disposition is a real handler, not SIG_DFL/SIG_IGN — addresses differ Rust-vs-C by construction). Zero-diff. Finding: the tests share theme/cref_meby-value globals, so they must serialize on aGLOBALS_LOCKmutex — cargo's parallel test threads otherwise race (one test zeroesmewhile another reads it). This is the L1 analogue of the L2PORT_LOCK; a positive-only isolated run masked it (the diagnostic passed alone, the suite failed in parallel). - L2 — no new test.
deliver_itis the universal write path (every reply →send_queued→deliver_it), so the entire existingircd-goldensuite covers it; confirmedgolden_channel_join,golden_registration(client write path) andgolden_s2s_nick(server write path) stay byte-identical.dummyis a boot-time signal handler with no client-reachable path. - S2S — no
IsServer(cptr)/ remote-field path in either function → no S2S test (the server write path is exercised by the existing s2s golden tests above).
- Cluster choice —
-
2026-06-05 — P7b (
common/packet.c) merged. The inbound packet reassembler; second P7 step (leaf-first, afterbsd.c).- Cluster choice —
packet.cis a single-symbol leaf (packet_ext.hexports onlydopacket;nm cbuild/packet.o→T dopacket). 172 lines, but every callee is already Rust (parseP4,exit_clientP5/s_misc, themeglobal, theIsDead/IsServermacros), so it ports clean with no new C dependency. - Config-resolved body — ZIP_LINKS off → the entire
#ifdef ZIP_LINKSmachinery (unzipped/unzip_packet/FLAGS_ZIPSTART/FLAGS_ZIP, and the compressed-flowwhilecondition) is compiled out; the body that compiles is the#elseloopwhile (length > 0 && ch2). DEBUGMODE off → noDebug(()). - Port —
ircd-common/src/packet.rs:dopacket= the line reassembler. Bumpsme/cptr/acptreceiveBbylengthonce per call (with theacpt == &medouble-count guard), walks the chunk copying intocptr->buffer + cptr->count, frames on CR or LF alone (Avalon's backward-compat rule — never the CR-LF pair), skips leading/blank CR-LF (ch1 == bufptr→ continue), and on a complete line bumps thereceiveMmessage counters (same guard), resetscptr->count = 0, and callsparse():FLUSH_BUFFER→ return immediately (cptr gone),IsDead→ setexitc(EXITC_REG→EXITC_DEAD) +exit_clientwith "Max SendQ exceeded"/"Dead Socket",IsServer && FLAGS_UNKCMD→ break. Non-terminators advancech1only whilech1 < bufptr + sizeof(buffer)-1(overflow cap; always room for the NUL). Ends withcptr->count = ch1 - bufptrto carry the partial line forward.meviaaddr_of_mut!(me); inlineis_dead/is_servermirror parse.rs;FLUSH_BUFFER/FLAGS_UNKCMD/EXITC_*from bindings.PACKET_LINK_ANCHORadded tolib.rs::link_anchor(). - Drop — single portable symbol →
"packet.o"added toPORTEDinircd-sys/build.rsand dropped outright (no_link.o, no linkage seam). The cref oracle keepspacket.oinCREF_OBJS, socref_dopacketstays for L1. RED first confirmed exactlydopacketundefined (referenced 3× by Cs_bsd.c::read_message); after GREEN,nm target/debug/ircdshowsdopacketasT(from Rust). - Classification — utility/callee TU (
dopacketis not amsgtabhandler; it is called froms_bsd.c::read_message). - L1 (
ircd-testkit/tests/packet_diff.rs) — isolated-worlds (Rust→me, oracle→cref_me); drives both over identically-built clients + buffers and compares full post-state: retval,cptr.count, the whole 512-byte reassembly buffer (parse tokenizes it in place → an end-to-end check), and thereceiveB/receiveMcounters on cptr/acpt/the me-global. 8 cases honoring the inverse-invariant rule (drive the buffering round-trip, not a happy frame): single LF, single CR (CR alone terminates), skipped extra/leading CR-LF, two lines in one buffer (parse twice), a partial line that does NOT call parse (count == length, receiveM unbumped) + its continuation completing the reassembled line, theacpt == &meguard (counters bumped once, not twice), a distinct acpt (its counters bumped too), and a 600-byte no-terminator line cappingcountat BUFSIZE-1 (511) with no OOB write. Inputs use parse()'s shallow paths (the parse_diff.rs proven set: ENCAP→m_nop and a 3-digit numeric from a STAT_UNKNOWN non-person) so post-state never diverges in deep handler state. Zero-diff. Finding: like bsd_diff (P7a), the tests share theme/cref_meby-value globals → they must serialize on aGLOBALS_LOCKmutex (cargo's parallel test threads otherwise race; a positive-only isolated run masked it — the diagnostic passed alone, the suite failed in parallel). This is the L1 analogue of the L2PORT_LOCK. - L2 — no new test.
dopacketis the universal inbound read path (every line a client/server sends →read_message→dopacket→parse), so the entire existingircd-goldensuite covers it; confirmedgolden_registration(the full client read path) stays byte-identical. - S2S — the FLUSH_BUFFER / IsDead→exit_client / IsServer+FLAGS_UNKCMD branches
need deep fixtures (a quit/sendq path, a linked server) but format no
remote-user fields, and
dopacketitself has noIsServer-remote-field formatting → no S2S test (the server read path is exercised by the existing s2s golden tests, which drive lines through this same reassembler).
- Cluster choice —
-
2026-06-05 — P7c (
ircd.ctune-file pair) merged. The third P7 step and the first (partial) port of the central driver TUircd.c. Leaf-first within ircd.c.- Cluster choice —
ircd_writetune/ircd_readtune(ircd.c:1437-1522) are a self-contained leaf: pure file I/O over the 7 runtime sizing globals, all callees already Rust (mybasenameP1) or a P8-bound variadic C trampoline (sendto_flag). Both are exported inircd_ext.h(nm cbuild/ircd.o→T ircd_writetune,T ircd_readtune) → thecref_*oracle already exists, no linkage seam needed. - Config-resolved body —
USE_HOSTHASH+USE_IPHASHboth ON (verified P2: 6 hash tables) → both#ifdef'd mirror assignments (_HOSTNAMEHASHSIZE/_IPHASHSIZE=t_data[2]) compile.USE_SERVICES/LOG_SERVER_CHANNELSOFF →sendto_flagis the plain server-notice path (early-returns whensvchans[chan].svc_ptris NULL, which it is in an uninitialised L1 world → safe to call from the test). - Port —
ircd-common/src/ircd.rs(new module;pub mod ircd;+IRCD_LINK_ANCHORinlink_anchor()).ircd_writetune:truncate(filename,0)→open(O_CREAT|O_WRONLY,0600)→libc::sprintfthe 7 globals with the exact"%d\n"×7format (using libc sopoolsize'su_intbits read through%dare byte-identical) →write→sendto_flag(SCH_NOTICE/SCH_ERROR,…)the outcome viamybasename.ircd_readtune:open(O_RDONLY)→read(…,100)→libc::sscanfthe 7 ints;!= 7→close+ (BOOT_BADTUNE? silent return :fprintf(stderr)exit(1)); else assign the 7 globals + the 2 hash mirrors + thelk_size = max(lk_size, ww_size)clamp.sendto_flagdeclared in a localextern "C"variadic block (void return;fmt: *mut c_char+ cast literals).stderrreached via a localextern "C" { static mut stderr }.
- Drop — partial port →
"ircd.o" => "ircd_link.o"map inircd-sys/build.rs::link_objs(); theircd_link.osecond-compile driven throughmakewith an injected rule (likesend_link.o) so make expands the recursive IRCD*_PATH/IAUTH path vars that the surviving C in ircd.c needs byte-identically, plus-DPORT_IRCD_TUNE_P7c. The C bodies are wrapped in#ifndef PORT_IRCD_TUNE_P7cinircd/ircd.c. CREF_OBJS keeps the unguardedircd.o→cref_ircd_writetune/cref_ircd_readtunesurvive for L1. RED first confirmed exactlyircd_writetune/ircd_readtuneundefined (referenced by Rustwhowas::grow_whowas+hash::bigger_hash_tableAND Cs_die/server_reboot/c_ircd_main/io_loop); after GREEN,nm target/debug/ircdshows both asT(from Rust). - Classification — utility/callee TU (neither is a
msgtabhandler).ircd_writetuneis called froms_die/server_reboot/rehash/main;ircd_readtuneonly frommain()at boot. - L1 (
ircd-testkit/tests/ircd_tune_diff.rs) — isolated-worlds (Rust port reads/writes the real bindgen globals;cref_ircd_*oracle reads/writes thecref_*renamed copies, confirmed present in libcref.a). 9 cases honouring the inverse-invariant rule: writetune → byte-identical files for a typical vector,lk_size < ww_size(legal on-disk), and the 0/INT_MAX/u32-max edge vector; readtune → identical 9 globals for a typical vector, thelkclamp (filelk(10) < ww(500)→ both clamp to 500), the hash mirrors (both follow field 3), a missing file (globals untouched), and a malformed file +BOOT_BADTUNE(silent return, globals == seed); and the write→read round-trip (values survive, on both worlds + equal). Zero-diff. Serialized on aGLOBALS_LOCKmutex (the documented P7 L1 shared-global hazard — the sizing globals +bootopt+ the tune file are process-global). Theexit(1)arm (malformed file WITHOUTBOOT_BADTUNE) is untested by design — it would kill the test process — and noted as such. - L2 — no new test.
ircd_readtuneruns at server startup, so the existingircd-goldenboot path covers it;golden_registrationconfirmed byte-identical. No client command reaches either function under the locked config. - S2S — none. Neither function has an
IsServerbranch or formats remote-user fields.
- Cluster choice —
-
2026-06-05 — P7d (
s_bsd.csocket/file utility leaves) merged. The fourth P7 step and the first (partial) port of the central I/O TUs_bsd.c(3435 lines: the select/poll event loop,local[],highest_fd,timeofday,FdAry). Leaf-first within s_bsd.c.- Cluster choice — three small, self-contained libc-wrapper leaves that touch
none of the event-loop data globals:
get_sockerr(s_bsd.c:1503),set_non_blocking(s_bsd.c:1521),write_pidfile(s_bsd.c:817). All exported ins_bsd_ext.h(nm cbuild/s_bsd.o→Teach) → thecref_*oracle already exists, no extra linkage seam. The heavier s_bsd leaves are deferred:report_error(an output fn — sendto_flag/sendto_one/syslog; L2-covered like the sendto_* family;set_non_blocking's error path calls it, kept C); andadd_local_domain/get_my_name(pull inircd_res/mysk/find_me/the gethostbyname path → a separate name-resolution cluster). - Config-resolved body —
SO_ERRORdefined → thegetsockopt(SO_ERROR)block inget_sockerrcompiles; DEBUGMODE off →write_pidfile's open-failureDebugelse-branch is a no-op; no other#ifdef-gated bodies in the three. IRCDPID_PATH—write_pidfilebakes inIRCDPID_PATH, a Makefile recursively-expanded path var passed only ons_bsd.o's command line (absent from bindgen). Exposed to Rust exactly as P6m did forIRCDMOTD_PATH:build.rsexpands it viamake -s --evaland emitscargo:rustc-env=IRCD_PID_PATH=…;ircd-sys/src/lib.rsre-exportspub const PID_PATH = env!("IRCD_PID_PATH"). The Rustwrite_pidfileopensCString::new(ircd_sys::PID_PATH)→ identical path.- Port —
ircd-common/src/s_bsd.rs(new module;pub mod s_bsd;+S_BSD_LINK_ANCHORinlink_anchor()).get_sockerr: readerrnovia*libc::__errno_location(),libc::getsockopt(SO_ERROR)whenfd >= 0, override only whenerr != 0.set_non_blocking:libc::fcntl(F_GETFL)→fcntl(F_SETFL, res | O_NONBLOCK); both failure arms call the still-Creport_error(declared in a local non-variadicextern "C"block; the two format literals passed as*mut c_char).write_pidfile:libc::truncate→open(O_CREAT|O_WRONLY,0600)→libc::sprintf(buff,"%5d\n",getpid())→write(strlen)→close(libc verbatim so the rendered bytes are byte-identical). - Drop — partial port →
"s_bsd.o" => "s_bsd_link.o"map inircd-sys/build.rs::link_objs(); thes_bsd_link.osecond-compile driven throughmakewith an injected rule (likeircd_link.o) carrying-DPORT_S_BSD_LEAF_P7dplus s_bsd.o's-DIRCDPID_PATH/-DIAUTH_PATH/-DIAUTHmachine-path defines (so the surviving C —start_iauthetc. — is byte-identical). The three C bodies are wrapped in#ifndef PORT_S_BSD_LEAF_P7dinircd/s_bsd.c(two regions:write_pidfile, and the adjacentget_sockerr+set_non_blocking). CREF_OBJS keeps the unguardeds_bsd.o→cref_get_sockerr/cref_set_non_blocking/cref_write_pidfilesurvive for L1. RED first confirmed exactly those three undefined (referenced byircd.c,s_auth.c, and s_bsd.c'sopen_listener/start_iauth/read_message); after GREEN,nm target/debug/ircdshows all three asT(from Rust). - Classification — utility/callee TU (none is a
msgtabhandler).write_pidfileis called fromircd.cmain();set_non_blocking/get_sockerrfrom the connection-accept/close paths. - L1 (
ircd-testkit/tests/s_bsd_leaves_diff.rs) — 4 cases, serialized on aGLOBALS_LOCK(the P7 L1 shared-global convention —write_pidfilewrites the sharedIRCDPID_PATHfile andget_sockerrmutates the processerrno).get_sockerr: fd<0 returns the saved errno (ECONNREFUSED) identically; a valid socketpair fd with no pending error returns the saved errno (EAGAIN) identically.set_non_blocking: the passed pipe fd gainsO_NONBLOCKin both worlds, the fd NOT passed stays blocking (inverse-invariant).write_pidfile: identical file-state between the two worlds, with the exact"%5d\n"rendering pinned where the path is writable. Zero-diff. Untested-by-design (noted): get_sockerr'serr != 0branch (needs a pending-error socket) and set_non_blocking's fcntl-failure→report_error branch (needs a bad fd that passes the C guard). - L2 — no new test.
write_pidfileruns at boot,set_non_blocking/get_sockerron every connect → the existingircd-goldenboot/connect path covers them;golden_registrationconfirmed byte-identical. - S2S — none. No
IsServerbranch, no remote-user field formatting.
- Cluster choice — three small, self-contained libc-wrapper leaves that touch
none of the event-loop data globals:
-
2026-06-05 — P7e (
s_bsd.cname-resolution leafadd_local_domain) merged. The fifth P7 step; the second leaf plucked from the central I/O TUs_bsd.c(after the P7d socket/file trio). Leaf-first within s_bsd.c.- Cluster choice —
add_local_domain(s_bsd.c:99), the lone pure, deterministic name-resolution sub-leaf. It touches none of the event-loop data globals (local[]/highest_fd/timeofday/FdAry); its only dependency is the resolver state (ircd_res+ircd_res_init), already Rust since P6 (ircd-common/src/res_init.rs). Deferred:get_my_name(s_bsd.c:2926, its only in-s_bsd.ccaller) pulls ingethostname/gethostbyname(real DNS, host- dependent → not L1-deterministic) plusmysk/find_me→ a later cluster. - Config-resolved body —
RES_INITis defined (resolv_def.h:108) → the whole#ifdef RES_INITbody compiles;DEBUGMODEoff → theDebug((DEBUG_DNS,…))line is a no-op. Live body: strip one trailing.(andsize++); if the name has no., lazilyircd_res_init()when!(ircd_res.options & RES_INIT), then append"." + ircd_res.defdnameiffdefdname[0]andstrlen(defdname)+2 <= size. - Port — added to
ircd-common/src/s_bsd.rs(existing module).index→libc::strchr,strcat/strlenverbatim; readscrate::res_init::ircd_res/ callscrate::res_init::ircd_res_init()(the Rust resolver defs).RES_INITas a localconst RES_INIT: c_ulong = 0x1(mirrors res_init.rs;optionsisu_long). The unguardedhname[strlen(hname)-1]last-char read is replicated faithfully (C does it unguarded; callers never pass an empty string). - Drop — partial port via the existing
s_bsd_link.oseam: added-DPORT_S_BSD_LEAF_P7eto thes_bsd_link.omake-rule inircd-sys/build.rs(alongside-DPORT_S_BSD_LEAF_P7d); wrapped the C body (s_bsd.c:99–129) in#ifndef PORT_S_BSD_LEAF_P7e. CREF_OBJS keeps the unguardeds_bsd.o→cref_add_local_domain+cref_ircd_ressurvive for L1. RED first confirmed the single undefined symbol, referenced by the now-Rusts_conf.rs(attach_Iline) and the still-Cs_bsd.c(get_my_name/connect_server); after GREENnm target/debug/ircdshowsadd_local_domainasT(from Rust). - Classification — utility/callee TU (not a
msgtabhandler). Called froms_conf.c:504(now Rust) ands_bsd.cget_my_name/connect_server(still C). - L1 (
ircd-testkit/tests/add_local_domain_diff.rs) — 6 cases, isolated worlds (the Rust port reads the real Rustircd_res; thecref_oracle reads the renamedcref_ircd_res), serialized onGLOBALS_LOCK(ircd_res+$LOCALDOMAINare process-global). Honouring the inverse-invariant rule: (1) trailing-dot strip on an already-qualified name → no append; (2) unqualified + defdname + room → append; (3) the size guard at the boundary —size = len+1must NOT append,size = len+2must (the inverse of case 2); (4) empty defdname → no append; (5) the trailing-dotsize++is load-bearing —"irc."withsize = len(defdname)+1appends only because the strip bumpssizeto+2; (6) the init-trigger branch — options without RES_INIT +$LOCALDOMAINset (deterministic, host-independent) → both worlds lazily run their P6-verified-equivalentircd_res_init, populate defdname from env, append, and gain RES_INIT. Zero-diff vscref_add_local_domain. - L2 — no new test.
add_local_domainruns at boot vias_conf.cread_confand onconnect_server; the existingircd-goldenboot path covers it (golden_registrationbyte-identical). No client command reaches it under the locked config. - S2S — none. No
IsServerbranch, no remote-user field formatting.
- Cluster choice —
-
2026-06-06 — P7f (
s_bsd.cdelayed-close leafdelay_close) merged. The sixth P7 step; the third leaf plucked from the central I/O TUs_bsd.c(after the P7d socket/file trio and the P7e name-resolution leaf). Leaf-first within s_bsd.c.- Cluster choice —
delay_close(s_bsd.c:3359), the best remaining L1-deterministic s_bsd leaf. It owns a private static linked list of fds awaiting a delayedclose(); its behaviour is a pure function of two C globals (timeofday,istat) + the compile constantDELAY_CLOSE, observable through itstime_treturn (head entry's scheduled-close time, or 0) and theistat.is_delayclose/is_delayclosewaitcounters. The other remaining s_bsd symbols arestatic(nocref_oracle —set_sock_opts), sender-only side effects (report_error), real-DNS (get_my_name), or the event-loop core itself (read_message/add_connection/listeners — deferred, done last with mio). - Config-resolved body — gated by
#ifdef DELAY_CLOSE(config.h.dist:440 →#define DELAY_CLOSE 15, enabled;nm cbuild/s_bsd.oshowsT delay_close).DEBUGMODEoff → noDebug(()).MAXCLIENTS=MAXCONNECTIONS-5=50-5= 45. Live body: iffd==-2→tmpdel = is_delayclosewait(close-all); else ifis_delayclosewait > (MAXCLIENTS-is_localc)>>1→tmpdel = is_delayclosewait>>2(drop oldest quarter). Sweep the list evicting whiletmp->time < timeofday || tmpdel-- > 0; on evictionsend(fd, "ERROR :Too rapid connections from your host\r\n", 46, 0)to the new fd,close(tmp->fd),MyFree,is_delayclosewait--. Then iffd>=0:set_non_blocking+shutdown(SHUT_RD),MyMalloca node attimeofday+DELAY_CLOSE, append,is_delayclosewait++/is_delayclose++. Returnfirst ? first->time : 0. - Port — added to
ircd-common/src/s_bsd.rs(existing module).struct fdlog→ a private#[repr(C)] struct FdLog+ module staticsDELAY_CLOSE_FIRST/DELAY_CLOSE_LAST(the list never crosses the ABI — each world keeps its own). Reads the still-C globals via bindgen (ircd_sys::bindings::istat/timeofday); calls the Rustset_non_blocking(P7d, same module) +crate::list::MyMalloc(P2);MyFree→libc::free;send/close/shutdownverbatim. Faithfulness: the unsigned thresholdMAXCLIENTS.wrapping_sub(is_localc) >> 1(C'sint - u_longwraps); the||short-circuit sotmpdelis decremented only when the entry is not expired; the 46-byte error literal (43 chars +\r\n+ the implicit\0, sent to the function-argumentfd, nottmp->fd). - Drop — partial port via the existing
s_bsd_link.oseam: added-DPORT_S_BSD_DELAY_CLOSE_P7fto the make-rule inircd-sys/build.rs(alongside-DPORT_S_BSD_LEAF_P7d -DPORT_S_BSD_LEAF_P7e); wrapped the C body (s_bsd.c:3359–3441, inside the#ifdef DELAY_CLOSEblock) in#ifndef PORT_S_BSD_DELAY_CLOSE_P7f. CREF_OBJS keeps the unguardeds_bsd.o→cref_delay_close+cref_istat+cref_timeofdaysurvive for L1. RED first confirmeddelay_closeundefined — referenced bys_serv.rs(m_close, now Rust),ircd.c:1176(io_loop, still C), ands_bsd.c:1661(still C); after GREENnm target/debug/ircdshowsdelay_closeasT(from Rust). - Classification — utility/callee TU (not a
msgtabhandler). Called from the io_loop (delay_close(-1)),m_close(delay_close(-2)), and the connection-close / listener-accept paths. - L1 (
ircd-testkit/tests/delay_close_diff.rs) — 6 cases, isolated worlds (the Rust port reads/mutates the realistat/timeofday; thecref_oracle usescref_istat/cref_timeofday), serialized onGLOBALS_LOCK. Because the static lists persist across#[test]s, each testreset()s first (drains both viadelay_close(-2), then zeroes the counters). Honouring the inverse-invariant rule: (1) queue one fd → returnnow+15, counters(1,1); (2) time eviction (inverse of 1) — advance past the time, sweep withfd<0→ entry gone, return 0,wait 1→0; (3) unexpired entry stays (the time-sorted earlybreak); (4)fd==-2close-all drains 2 unexpired entries; (5) overflow —is_localc=43→ threshold 1, 4 queued then a 5th →tmpdel=4>>2=1evicts the oldest while adding (netwait4,close5); (6) chronological head — head stays the oldest entry's time until it is evicted. socketpair fds soclose/shutdown/sendsucceed identically; the same fd value drives both worlds. Zero-diff on return value +(is_delayclose, is_delayclosewait)for every call. - L2 — no new test.
delay_closeruns from the io_loop / connection-close paths; the existingircd-goldenboot path covers it (golden_registrationbyte-identical). No client command reaches it deterministically under the locked config (it needs rapid-connect refusal). - S2S — none. No
IsServerbranch, no remote-user field formatting.
- Cluster choice —
-
2026-06-06 — P7g (
s_bsd.cfd-teardown leafclose_client_fd) merged. The nexts_bsd.cleaf after P7d (socket/file trio), P7e (add_local_domain), P7f (delay_close). Portedclose_client_fd(s_bsd.c:1270) toircd-common/src/s_bsd.rs.- Cluster choice. Picked because its effect is pure post-state on the
aClient+ the fd arrays (L1-testable by inspection, likedelay_close), and all its real callees are already Rust:flush_connections(send.rs, P3),del_fd(list.rs, P2),dbuf_delete(dbuf.rs, P1). The only C dependency isreport_error, already declaredextern "C"ins_bsd.rssince P7d. - Guard / seam. Same
s_bsd_link.opartial-compile; added-DPORT_S_BSD_CLOSE_FD_P7gto the recipe inircd-sys/build.rsand wrapped the C body in#ifndef PORT_S_BSD_CLOSE_FD_P7g. RED confirmed the undefinedclose_client_fdreferenced by the still-Cclose_connection/add_connection_refuse; after GREENnmshows itTfrom Rust. The cref oracle keeps the full unguardeds_bsd.o. - Config-resolved body.
SO_LINGERdefined → the two linger blocks compile (only taken whenexitc==EXITC_PING; on a nonzerosetsockoptreturn they call the still-Creport_error).ZIP_LINKSOFF → thezip_freecall inside theIsServer||IsListenerarm is omitted. Faithful:SETSOCKOPT(...,&sockling,sockling)=setsockopt(...,&sockling,sizeof(struct linger));DBufClear(d)=dbuf_delete(d, d->length);bzero(passwd, sizeof)=memset(passwd,0,21); theIsServer||IsListener/IsClientarms are mutually exclusive (if/else if) butdel_fd(&fdall)+local[fd]=NULL+close+ the drains run unconditionally for anyfd>=0. The linger struct is fully initialized (l_onoff=0,l_linger=0, per the 2014 Kurt Roeckx fix). - Classification. Callee TU (no
msgtabentry) — reached fromclose_connection/exit_client/ the listener-accept refuse paths. - L1.
close_client_fd_diff.rs, 6 cases, isolated worlds (Rust reads/mutates the reallocal/fdas/fdall+ calls Rustflush_connections/del_fd; oracle usescref_local/cref_fdas/cref_fdall+cref_*),me.fd/cref_me.fdpinned to -1 soflush_connectionstakes theelse if fd>=0branch. Cases: client both-fds; server + listener (the fdas+fdall arm, viaFLAGS_LISTENfor the listener); fd<0 (only authfd closed, fd>=0 block skipped, queues/passwd untouched); both-fds<0 no-op; and the inverse-of-insert recvQ-drain + passwd-zero. Each asserts equal post-state + the inverse invariants (fd actually closed → secondclose()returns EBADF,local[fd]==NULL, array slot freed,fdas/fdall.highestagree, queues drained). Serialized onGLOBALS_LOCK(sharedlocal/fd-arrays/me). Zero-diff vscref_close_client_fd. - Untested-by-design.
exitc=0in every case → theSO_LINGER/report_errorfailure branches are not exercised (they need a socket whosesetsockoptfails). ThesendQflush-then-clear path (live socket I/O throughsend_queued) is L2, not L1 — queuingsendQon a synthetic client crashes the live send path; onlyrecvQ(never flushed) is used for theDBufCleardrain check. - L2 / S2S. No new L2: hit on every disconnect;
golden_registration(incl.register_quit_reuse_releases_nick) stays byte-identical. No S2S: formats no remote-user fields.
- Cluster choice. Picked because its effect is pure post-state on the
-
2026-06-06 — P7h (
s_bsd.cconnection-teardown leafclose_connection) merged. The nexts_bsd.cleaf after P7d (socket/file trio), P7e (add_local_domain), P7f (delay_close), P7g (close_client_fd). Portedclose_connection(s_bsd.c:1341) toircd-common/src/s_bsd.rs— the disconnect-bookkeeping layer directly above the P7g fd-teardown leaf.- Cluster choice. Picked as the natural next layer up from P7g:
close_connectioncallsclose_client_fd, and all its other callees are already resolvable —del_queries/find_conf_exact/det_confs_butmaskare Rust (P6),sendto_iauthis the variadic C trampoline (declaring + calling a variadic is stable),close_client_fdis the Rust P7g symbol. Its whole effect is post-state on theaClient+ the process globals → L1-testable by inspection. - Guard / seam. Same
s_bsd_link.opartial-compile; added-DPORT_S_BSD_CLOSE_CONN_P7hto the recipe inircd-sys/build.rs(alongside the P7d/P7e/P7f/P7g guards) and wrapped the C body (s_bsd.c:1341-1453) in#ifndef PORT_S_BSD_CLOSE_CONN_P7h. RED confirmedclose_connectionundefined — referenced by the now-Rusts_misc.rs(exit_client) and the still-Cs_bsd.c:458; after GREENnm target/debug/ircdshows itTfrom Rust. The cref oracle keeps the full unguardeds_bsd.o. - Config-resolved body.
USE_IAUTHON → thesendto_iauth("%d D", cptr->fd)notify block (gated!IsListener && !IsConnecting) compiles. DEBUGMODE off → theDebug()lines vanish. No other#ifdef'd branches. Macros reproduced inline:IsHandshake/IsConnecting(status == STAT_HANDSHAKE/STAT_CONNECTING),IsIllegal(aconf)(status & CONF_ILLEGAL),ConfConFreq(aconf)(aconf->class->conFreq, int→time_t),CFLAG(CONF_CONNECT_SERVER|CONF_ZCONNECT_SERVER= 40);HANGONRETRYDELAY=30/HANGONGOODLINK=900 (config.h.dist:656-657, object-like config macros absent from bindgen → Rust consts). Reuses the P7gis_server/is_client/is_listenerhelpers. The reconnect-reschedule arm short-circuits onIsServer(sofind_conf_exactis only called for a server) exactly as C. - Classification. Callee/utility TU (no
msgtabentry) — reached fromexit_client(s_misc.c) and the listener/acceptor cleanup paths. - L1.
close_connection_diff.rs, 6 cases, isolated worlds (Rust reads/mutates the realircstp/nextconnect/ListenerLL/local/fdas/fdall/me/istat+ calls Rustclose_client_fd/del_queries/det_confs_butmask; oracle usescref_*), serialized onGLOBALS_LOCK.me.fd/cref_me.fdpinned to -1 (innerflush_connectionselse-branch);adfd/cref_adfdpinned to -1 (sendto_iauthno-op, no live iauth pipe);firsttime/sincepinned to constants for deterministictimeofday - firsttimedeltas. Cases: (1) server →is_sv/is_sbs/is_sbr/is_sti; (2) client →is_cl/is_cbs/is_cbr/is_cti(inverse: server/ni untouched); (3) unknown → onlyis_ni; (4) handshake + connecting,nextconnect==0→nextconnect = now + 30; (5) P-line acceptor refcount 5→4 (inverse: closed client fd torn down); (6) illegal listener (CONF_ILLEGAL,clients<=0) unlinked from a 2-nodeListenerLL— inverse invariants: head.next NULL,ListenerLLhead intact, target fd -1,fromNULL,confsdetached. Zero-diff vscref_close_connection. Fixture note: case 6'sdet_confs_butmask→detach_confdecrements the unsignedistat.is_conflinkonce per detached link; seededis_conflink=1in both worlds (the realattach_confwould have incremented it) — without it the decrement underflows (C wraps silently, Rust debug-overflow panics, surfacing the unrealistic fixture). - Untested-by-design. The recursive
close_connection(cptr->acpt)when the acceptor itself becomes illegal (needs a fully-illegal acceptor conf — case 5 covers the non-recursive refcount arm). Thefind_conf_exactreconnect-reschedule arm (returns NULL with no conf loaded → both worlds skip it identically). Thesendto_iauthwire emission (L2, variadic trampoline, like the rest of the sendto_* family). - L2 / S2S. No new L2: hit on every disconnect;
golden_registration(incl.register_quit_reuse_releases_nick) stays byte-identical. No S2S: formats no remote-user fields (theIsServerbranch touches only local stats counters + reconnect scheduling, not wire output).
- Cluster choice. Picked as the natural next layer up from P7g:
-
2026-06-06 — P7i (
s_bsd.clistener-list teardown leafclose_listeners) merged. The nexts_bsd.cleaf after P7d (socket/file trio), P7e (add_local_domain), P7f (delay_close), P7g (close_client_fd), P7h (close_connection). Portedclose_listeners(s_bsd.c:427) toircd-common/src/s_bsd.rs— the listener-GC layer directly above the P7g/P7h teardown leaves.- Cluster choice. The cleanest remaining s_bsd leaf: it is a pure walk over the
ListenerLLglobal dispatching to two already-Rust callees (close_client_fdP7g,close_connectionP7h) — no socket syscalls of its own, effect fully observable asListenerLL+ per-nodeaClientpost-state. The other remaining s_bsd symbols are the event-loop core (read_message/add_connection), listener construction (inetport/add_listener/open_listener— realsocket/bind/listen), sender-only (report_error), real-DNS (get_my_name), orstatic(nocref_oracle:set_sock_opts/check_init). - Guard / seam. Same
s_bsd_link.opartial-compile; added-DPORT_S_BSD_CLOSE_LISTENERS_P7ito the recipe inircd-sys/build.rs(alongside the P7d/P7e/P7f/P7g/P7h guards) and wrapped the C body (s_bsd.c:427-462) in#ifndef PORT_S_BSD_CLOSE_LISTENERS_P7i. RED confirmedclose_listenersundefined — referenced only by the now-Rusts_conf.rsrehash (s_conf.c:1315); after GREENnm target/debug/ircdshows itTfrom Rust. The cref oracle keeps the full unguardeds_bsd.o. - Config-resolved body. UNIXPORT off (
cbuild/config.h:339 #undef UNIXPORT;nm cbuild/s_bsd.ohas nounixport) → the entire#ifdef UNIXPORTIsUnixSocket/sprintf(unixpath)/unlinkblock is not compiled. Resolved body:for (acptr = ListenerLL; acptr; acptr = bcptr) { aconf = acptr->confs->value.aconf; bcptr = acptr->next; if (IsIllegal(aconf)) { if (aconf->clients > 0) close_client_fd(acptr); else close_connection(acptr); } }. Thebcptr = acptr->nextis read before the teardown becauseclose_connectionmay unlinkacptr(the P7hListenerLL-unlink arm).IsIllegalreuses the existingconf_is_illegalhelper (aconf->status & CONF_ILLEGAL). No new externs — both callees are Rust in the same module. - Classification. Callee/utility TU (no
msgtabentry) — the rehash listener garbage-collector, called froms_conf.crehash. - L1.
close_listeners_diff.rs, 5 cases, isolated worlds (Rust reads/mutates the realListenerLL/local/fdas/fdall/me/ircstp/istat+ calls the Rustclose_client_fd/close_connection; oracle usescref_*), serialized onGLOBALS_LOCK.me.fd/adfdpinned to -1 (innerflush_connectionselse-branch +sendto_iauthno-op); listeners built with statusSTAT_ME+ flagsFLAGS_LISTEN+from = self+ a one-element confsLink+ a live pipe fd registered inlocal/fdas/fdall;istat.is_conflinkseeded perclose_connection-bound node (itsdet_confs_butmaskdecrements the unsigned counter once per detached link — underflow else). Each case builds an identicalListenerLLon both worlds, runsclose_listeners, and compares the structural walk (surviving node count + per-node(fd_torn, from_null, confs_null)— pointers differ across worlds so the comparison is on observable facts) plus inverse invariants. Cases: (1) illegal clients=0 →close_connection→ unlinked (ListenerLLdrained, fd -1,fromNULL, confs detached); (2) illegal clients>0 →close_client_fd→ fd torn BUT node stays linked +from == self+ confs NOT detached (inverse of 1); (3) legal → fully untouched (fd still a valid descriptor viafcntl(F_GETFD), still linked); (4) mixed[legal] -> [illegal,c=0] -> [legal]→ middle removed, the two legals relinked head↔next with intact fds; (5) all-illegal-c=0 → list fully drained. Zero-diff vscref_close_listeners. - L2 / S2S. No new L2:
close_listenersis the rehash listener-GC, exercised at boot/rehash by the existing golden suite (golden_registrationbyte-identical). No S2S: it formats no remote-user wire fields (its only side effects are the descriptor teardowns +ListenerLLmutation).
- Cluster choice. The cleanest remaining s_bsd leaf: it is a pure walk over the
-
2026-06-06 — P7j (
s_bsd.clistener-reactivation leafactivate_delayed_listeners) merged. The nexts_bsd.cleaf after P7d–P7i; the reactivation counterpart to P7i'sclose_listenersteardown. Portedactivate_delayed_listeners(s_bsd.c:526) toircd-common/src/s_bsd.rs.- Cluster choice. The cleanest remaining s_bsd leaf: a pure walk over
ListenerLLflipping one flag bit (FLAGS_LISTENINACTIVE) + alisten()syscall + a counter, the natural pair to P7i. Its whole effect is per-nodeflags/listen-state post-state → L1-testable by list inspection. The other remaining s_bsd symbols are the event-loop core (read_message/add_connection), listener construction (inetport/add_listener/open_listener/reopen_listeners— realsocket/bind/listen), sender-only (report_error), process setup (daemonize/init_sys/start_iauth), real-DNS (get_my_name), orstatic(nocref_oracle:set_sock_opts/check_init/check_clones). - Guard / seam. Same
s_bsd_link.opartial-compile; added-DPORT_S_BSD_ACTIVATE_DELAYED_P7jto the recipe inircd-sys/build.rs(alongside the P7d–P7i guards) and wrapped the C body (s_bsd.c:526-545) in#ifndef PORT_S_BSD_ACTIVATE_DELAYED_P7j. RED confirmedactivate_delayed_listenersundefined — referenced by the now-Rusts_serv.rs:739(m_setburst path) ands_misc.rs:1153(check_split); after GREENnm target/debug/ircdshows itTfrom Rust. The cref oracle keeps the full unguardeds_bsd.o→cref_activate_delayed_listeners. - Config-resolved body. No
#ifdefs in this function; DEBUGMODE off → noDebugline.IsListenerInactive(x)=(x)->flags & FLAGS_LISTENINACTIVE(0x8000000, bindgen const);ClearListenerInactive(x)=(x)->flags &= ~FLAGS_LISTENINACTIVE;flagsis ac_longfield so the mask isas c_long.LISTENQUEUE(config.h:622 = 128) is a config#defineabsent from bindgen → reproduced as aconst c_int.listen()'s return is ignored exactly as C → the observable post-state (inactive bit cleared, node kept) is identical regardless of the fd.sendto_flag(SCH_NOTICE, ...)is the existing variadic C trampoline (ircd_sys::bindings::sendto_flag+ServerChannels_SCH_NOTICE); no new extern. It is safe in L1 because it short-circuits whensvchans[chan].svc_ptr == NULL(the default un-setup_svchans'd state) → no-op in both worlds. - Classification. Callee/utility TU (no
msgtabentry) — reached from the server-burst / TS-adjust path (s_serv.c) ands_misc.ccheck_split. Formats no remote-user fields (only an integer count) → no S2S even though a server path reaches it. - L1.
activate_delayed_listeners_diff.rs, 5 cases, isolated worlds (Rust reads/mutates the realListenerLL/me; oracle usescref_*), serialized onGLOBALS_LOCK.me.fd/adfdpinned to -1 (defensive). Eachnew_listener(inactive)builds anaClient(statusSTAT_ME, flagsFLAGS_LISTEN[+FLAGS_LISTENINACTIVE]) over a real TCP socket solisten()genuinely succeeds (asserted viagetsockopt SO_ACCEPTCONN). Each case builds an identicalListenerLLon both worlds, runs the function, and compares the per-node(still_inactive, accepting)vector + node count (listeners are never removed). Cases: (1) single inactive → activated (bit clear +SO_ACCEPTCONN==1); (2) single active → untouched (inverse — flag stays clear, not re-listened, stays in list); (3) mixed[active,inactive,active]→ only middle activated, all 3 kept, order preserved; (4) empty → no-op (cnt=0,sendto_flagnot fired, no crash); (5) all-inactive (3 nodes) → all activated. Zero-diff vscref_activate_delayed_listeners. - Untested-by-design. The
sendto_flagwire emission (cnt>0) is the variadic-trampoline path; with NULLsvc_ptrit is a no-op (L2 territory, like the rest of thesendto_*family).listen()'s failure path is unreachable-by-observation (return ignored). - L2 / S2S. No new L2: hit by server-burst/rehash;
golden_registration(incl.register_quit_reuse_releases_nick) stays byte-identical. No S2S: formats no remote-user wire fields.
- Cluster choice. The cleanest remaining s_bsd leaf: a pure walk over
-
2026-06-06 — P7k (
s_bsd.cadd_connection_refuse, connection-refuse leaf) merged. The next leaf in the central I/O TU after the P7d–P7j socket/file/teardown/listener leaves; the refuse-path companion toadd_connection(which stays C).- Cluster choice —
add_connection_refuse(s_bsd.c:1594), a true leaf: its only callees areclose(libc),free_client(Rust, P2), and a bump of the bindgenircstpglobal. Called fromadd_connection's four refuse paths (clone-check fail, IP-line refuse,DELAY_CLOSEaccept throttle, DNSBL/iauth refuse), all later in the same C TU. - Guard — partial-ported via
s_bsd_link.owith-DPORT_S_BSD_ADD_CONN_REFUSE_P7kadded to the build.rs make-eval recipe; the C body wrapped in#ifndef PORT_S_BSD_ADD_CONN_REFUSE_P7k … #endif. The cref oracle keeps the full unguardeds_bsd.osocref_add_connection_refusesurvives. - Config-resolved body —
DELAY_CLOSEis defined (config.h:440, =15) → the#if !defined(DELAY_CLOSE)arm (delay = 0) is not compiled;delayis honored verbatim. Body:if (delay==0) close(fd); ircstp->is_ref++; acptr->fd = -2; free_client(acptr);. - ABI — no
*_ext.hprototype (file-local-by-use, defined before its callers in the same TU) but a globalTsymbol; the#[no_mangle] pub unsafe extern "C" fn add_connection_refuseresolves the Cadd_connectioncall sites at link. No bindgen decl needed.free_clientcalled ascrate::list::free_client(same crate). - Classification — utility/callee TU, not a
msgtabhandler. → L1 is the gate. - L1 (
add_connection_refuse_diff.rs, 3 cases) — two isolated worlds (Rust portc_add_connection_refusevscref_add_connection_refuse), each with its own backingstats(itsircstppoints at it) and its ownmake_client/free_client.acptrbuilt via that world'smake_client(NULL)sofree_clientis the clean inverse (acalloc'd client would tripfree_client'sauth != usernameerror arm).acptris freed inside the call → post-state is a UAF, so the test compares side effects:is_refdelta (+1) and the fd's fate. Case 1delay==0: fd actually closed (secondclose→ EBADF). Case 2delay==1: fd left open (ourclosereturns 0) — the happy-path/inverse pair. Case 3: two refuses accumulateis_refto 2. Zero-diff vscref_; serialized onGLOBALS_LOCK(the P7 L1 shared-global hazard —ircstp/cref_ircstpprocess-global). - Untested-by-design —
acptr->fd = -2(set immediately beforefree_client; no surviving reader under the locked config).free_clientinternals are P2-tested (list_diff.rs). - No L2 / no S2S — reached only from
add_connection's refuse paths; no client command reaches it deterministically under the locked config, and it formats no remote-user wire fields. Sibling s_bsd L1 tests (P7d–P7j) re-run green after the shareds_bsd_link.orecipe change.cargo build0 warnings;add_connection_refuseresolvesTintarget/debug/ircd.
- Cluster choice —
-
2026‑06‑06 — P7l (
s_bsd.csetup_ping, UDP CPING‑socket setup leaf) merged. Ported the next s_bsd.c leaf after the P7d–P7k socket/file/teardown/listener/refuse leaves: the one‑shot setup half of the server‑to‑server CPING (UDP ping) feature.- Cluster choice.
setup_ping(s_bsd.c:3018) is a self‑contained leaf — it binds the single sharedudpfdUDP socket and returns its fd. Its only non‑libc deps areinetpton(Rust P1),minus_one(bindgen all‑0xffglobal), andudpfd(a C global it sets). The CPING‑output siblingssend_ping(non‑static) andcheck_ping/polludp(static) stay C; they shareudpfdonly, which stays a C global, so no atomic cluster move is needed. - Guard / seam. Partial port via the existing
s_bsd_link.osecond‑compile, new guard-DPORT_S_BSD_SETUP_PING_P7ladded alongside the P7d–P7k guards inircd-sys/build.rs; the C body wrapped in#ifndef PORT_S_BSD_SETUP_PING_P7l. - Config‑resolved body.
AFINET=AF_INET6(common/os.h:680) →fromis alibc::sockaddr_in6, theSIN_FAMILY/SIN_PORT/SIN_ADDRmacros map tosin6_family/sin6_port/sin6_addr. TheSETSOCKOPTmacro (sys_def.h:29) passessizeof(int)=4 as the option length, notsizeof(*p).FNDELAY=O_NDELAY=O_NONBLOCK.DEBUGMODE/USE_SYSLOGoff → theDebug/sysloglines vanish.IN6ADDRSZ= 16. - Faithfulness. Idempotent short‑circuit (
udpfd != -1→ return it, ignoreaconf); the assign‑then‑test ((udpfd = socket(...)) == -1) reproduced as set‑bindgen‑extern‑then‑check; each later failure doesclose(fd); udpfd = -1; return -1. Bind address: a numericaconf->passwd(isdigit(*passwd)) →inetpton(AF_INET6, …), falling back to a 16‑bytebcopyofminus_oneon parse failure; elsein6addr_any.htons=(port as u16).to_be(). - Classification. Callee TU, not a
msgtabhandler — reached only from the now‑Rusts_conf.rsrehash (s_conf.c:2041, aconnect{}block with a port). RED confirmed the undefinedsetup_pingreferenced bys_conf.rs; after GREENnm target/debug/ircdshowssetup_pingasT(from Rust). - L1.
ircd-testkit/tests/setup_ping_diff.rs, 3 cases: (1) fresh setup opens a valid non‑blockingSOCK_DGRAMrecorded inudpfd; (2) idempotent second call (the inverse‑of‑state path) returns the same fd unchanged and opens no new socket, even with a differentaconf; (3) numericpasswd"::1"drives theinetptonbind‑address branch (loopback bind succeeds) vs thein6addr_anydefault. Zero‑diff vscref_setup_ping; isolated worlds (realudpfdvscref_udpfd), serialized onGLOBALS_LOCKwith areset()that closes the prior socket + restoresudpfd = -1between cases. Because each world opens its own socket, the test compares the fd's properties (open, non‑blocking,SOCK_DGRAM) + the global‑state contract (udpfdset / idempotent), never the integer fd value. - L2 / S2S. No new L2 (callee, hit by rehash;
golden_registrationbyte‑identical, 0 warnings). No S2S (formats no remote‑user fields). - Untested‑by‑design. The
setsockopt/bind/fcntlfailure arms (close(fd); udpfd = -1) need an induced syscall failure (privileged/occupied bind) — not deterministic in the sandbox; both worlds take the success path identically. The actual UDPsendtoissend_ping's concern (a later leaf).
- Cluster choice.
-
2026‑06‑06 — P7m (
s_bsd.csend_ping, UDP CPING‑output leaf) merged. Ported the next s_bsd.c leaf after the P7d–P7l socket/file/teardown/listener/refuse/CPING‑setup leaves: the output half of the server‑to‑server CPING (UDP ping) feature, the sibling to P7l'ssetup_ping.- Cluster choice.
send_ping(s_bsd.c:3077) is a self‑contained leaf — its only non‑libc dependency is theudpfdC global itsendtos over (and which stays C, shared withsetup_ping/polludp). No ircd callees → no atomic cluster move. The CPING‑input siblingscheck_ping/polludp(bothstatic, nocref_oracle) stay C; they shareudpfdonly. - Guard / seam. Partial port via the existing
s_bsd_link.osecond‑compile, new guard-DPORT_S_BSD_SEND_PING_P7madded alongside the P7d–P7l guards inircd-sys/build.rs; the C body (s_bsd.c:3077‑3117) wrapped in#ifndef PORT_S_BSD_SEND_PING_P7m. RED confirmedsend_pingundefined — referenced by the still‑Circd.c:405(try_connectionsCPING path); after GREENnm target/debug/ircdshows itTfrom Rust. The cref oracle keeps the full unguardeds_bsd.o→cref_send_ping. - Config‑resolved body.
AFINET=AF_INET6(common/os.h:680) →sinis alibc::sockaddr_in6,SIN_PORT/SIN_FAMILY/SIN_ADDRmap tosin6_*.IN6ADDRSZ=16 →bcopy(aconf->ipnum.s6_addr, sin.sin6_addr.s6_addr, 16). DEBUGMODE/USE_SYSLOG off → theDebugline vanishes.PING_CPING=0x02 (struct_def.h:411, bindgen const) →pi.pi_id = htonl(2)(au_long, network order). - Faithfulness. The C guard
if (!aconf->ipnum.s6_addr || AND16(...)==255 || !cp->port)— the first disjunct is the address of an array field, so it is always false in C; reproduced as the two real gates only (AND16==255≡ all 16 bytes0xffviaiter().fold(0xff, &), the unresolvedminus_onesentinel; andcp->port==0). AllaCPingcounters (ping/seq/lseq/recvd) areu_long→ unsigned arithmetic (cp->seq * conFreq > 1200,cp->ping -= cp->ping/cp->recvd).pi.pi_seq = cp->lseq++is post‑increment (the packet carries the pre‑increment value). The window block doesseq++then conditionalseq--(net 0 when it fires), withrecvd--only whenrecvd == seq(post‑++).sin.SIN_PORT = htons(cp->port)=(*cp).port.to_be(). - Classification. Callee/utility TU (no
msgtabentry) — reached from the server‑connect /try_connectionsCPING path, not a client command. Formats no remote‑user fields (only a binary UDP datagram to the configured peer) → no S2S. - L1.
send_ping_diff.rs, 7 cases, isolated worlds (Rust reads the realudpfd; oracle readscref_udpfd), serialized onGLOBALS_LOCK. Each caseopen_udp()s a fresh UDP socket as that world'sudpfd, binds a non‑blocking::1:<ephemeral>receiver, points the conf's destination port at it, drivessend_ping, andrecvfroms the datagram. Compares Rust‑vs‑oracle the deterministicaCPingpost‑state (seq/lseq/recvd/ping) byte‑identical + the world‑independent packet fields (pi_id == htonl(2),pi_seq == pre‑increment lseq);pi_cp(a live pointer) andpi_tv(gettimeofday) are nondeterministic/world‑specific → excluded. Cases: (1) basic send, no window →lseq0→1,seq0→1, packet withpi_seq=0; (2) unresolved ipnum (all0xff,AND16==255) → early return, counters untouched, no packet (inverse of 1); (3)cp->port==0→ early return; (4)conFreq==0→ early return; (5) windowrecvd>0(seq=12→13,13*100>1200→ping 1000 - 1000/5 = 800,recvd≠seqstays,seq--→12); (6) windowrecvd==0(ping→0); (7) windowrecvd==seqpost‑++(recvd--also fires:ping 1300-100=1200,recvd 13→12). Zero‑diff vscref_send_ping. - Untested‑by‑design.
pi_tv(gettimeofday) +pi_cp(a live pointer) are nondeterministic/world‑specific → excluded from the packet comparison. Thesendtofailure path is(void)‑ignored by C → unobservable. - L2 / S2S. No new L2: callee, hit by the server‑connect CPING path;
golden_registration(incl.register_quit_reuse_releases_nick) stays byte‑identical. No S2S: formats no remote‑user wire fields.
- Cluster choice.
-
2026‑06‑06 — P7n (
s_bsd.clistener-(re)construction wrappersopen_listener/reopen_listeners) merged. The nexts_bsd.cleaf after the P7d–P7m socket/file/teardown/listener/CPING leaves — the layer directly above the still-C socket constructorinetport. Portedopen_listener(s_bsd.c:467) +reopen_listeners(s_bsd.c:512) toircd-common/src/s_bsd.rs.- Cluster choice. The cleanest remaining s_bsd leaf with no static-callee blocker:
reopen_listenersis a pureListenerLLwalk →open_listener;open_listenerdispatches to the still-Cinetport(real socket/bind/listen, keeps its static calleeset_sock_optswith internal linkage in the surviving C) plus the already-Rustadd_fd(P2) andset_non_blocking(P7d). The strangler seam holds withinetportstaying C, called via the bindgen extern — porting the layer above a still-C leaf is allowed (symbols resolve either direction). The other remaining s_bsd symbols are the event-loop core (read_message/add_connection), listener construction (inetport/add_listener— real syscalls + the staticset_sock_opts), sender-only (report_error), process setup (init_sys/daemonize/start_iauth), connection auth (check_client/check_server/check_server_init), real-DNS (get_my_name), orstatic(nocref_oracle). - Guard / seam. Same
s_bsd_link.opartial-compile; added-DPORT_S_BSD_OPEN_LISTENER_P7nto the recipe inircd-sys/build.rs(alongside the P7d–P7m guards) and wrapped the two C bodies (s_bsd.c:467-525) in a single#ifndef PORT_S_BSD_OPEN_LISTENER_P7n. RED confirmed both symbols undefined —open_listenerreferenced by the still-Cadd_listener(s_bsd.c:347),reopen_listenersby the now-Rusts_conf.rsrehash (line 2927); after GREENnm target/debug/ircdshows bothTfrom Rust. The cref oracle keeps the full unguardeds_bsd.o→cref_open_listener/cref_reopen_listeners. - Config-resolved body.
UNIXPORTOFF (config.h:339) →open_listener's*aconf->host == '/'unix-socket branch is not compiled; only the inet branch survives. No other#ifdefs. Macros reproduced inline:IsListener(x)(existingis_listenerhelper),IsConfDelayed(aconf)=aconf->flags & PFLAG_DELAYED(bindgen const,flagsisc_long),SetListenerInactive(x)=flags |= FLAGS_LISTENINACTIVE(bindgen const),IsIllegal(aconf)(existingconf_is_illegalhelper).firstrejoindone/ListenerLL/fdas/fdall/inetport/add_fdare bindgen externs (inetport/firstrejoindonestay C;add_fdresolves to the Rust list port). - Faithfulness.
open_listenerearly-returns on!IsListener(cptr) || cptr->fd > 0— note> 0(not>= 0), so fd 0 does not early-return. The delayed branch setsdolisten = 0AND marks the listener inactive, soinetportskipslisten()(socket created, not accepting).inetportreturning non-zero resetscptr->fd = -1("to allow further inetport calls"); only whencptr->fd >= 0afterward is the fd registered infdas/fdall+ flipped non-blocking. - Classification. Callee/utility TU (no
msgtabentry) —reopen_listenersreached fromrehash(s_conf.rs),open_listenerfromadd_listener/reopen_listeners. → L1 is the gate; no S2S (formats no remote-user wire fields). - L1.
open_listener_diff.rs, 6 cases, isolated worlds (Rust port reads/mutates the realListenerLL/local/fdas/fdall/me/firstrejoindone+ calls the real Cinetportand the Rustadd_fd/set_non_blocking; oracle usescref_*+cref_inetport), serialized onGLOBALS_LOCK. Each world opens its own socket viainetport(fd integers differ) → the comparison is on the fd's observable properties (fd_validviafcntl F_GETFD,listeningviaSO_ACCEPTCONN,nonblockingviaO_NONBLOCK), theFLAGS_LISTENINACTIVEbit,fdas/fdallmembership,local[fd]==cptr, andport. Listener built withip=NULL,port=0(no bind → no addr-family hazard;inetportstill doessocket/getsockname/listen),ipmask="0.0.0.0";me.namepointed atme.namebufand pinned to"irc.test"in both worlds soinetport'sME-basedsockhostis identical. Cases: (1) normal listener → listening, non-blocking, registered, not inactive; (2) delayed +firstrejoindone==0→dolisten=0: created but NOT listening,FLAGS_LISTENINACTIVEset, still registered + non-blocking; (3) delayed +firstrejoindone==1(inverse of 2) → behaves normal (listening, flag clear); (4)!IsListener→ no-op (fd stays -1, nothing registered); (5)fd>0early-return → fd untouched, not registered; (6)reopen_listenersover[illegal fd<0, legal fd<0, legal fd>0]→ only the legal-fd<0 node is opened, the illegal + already-open nodes skipped (the open node's per-world pipe fd compared against its own recorded start value, not cross-world). Zero-diff vscref_*. - Untested-by-design.
inetport's failure arms (socket/bind failure →report_error+cptr->fd=-1) need an induced syscall failure; both worlds take the success path identically. Thecptr == &mewrite(0,…)KLUDGE insideinetportis not reached (our cptr !=me). - L2 / S2S. No new L2: hit at boot/rehash by the existing golden suite (
golden_registrationbyte-identical, 0 warnings). No S2S: formats no remote-user wire fields.
- Cluster choice. The cleanest remaining s_bsd leaf with no static-callee blocker:
-
2026‑06‑06 — P7o (
s_bsd.cadd_listener, listener-constructor wrapper) merged. The nexts_bsd.cleaf after the P7d–P7n socket/file/teardown/listener/CPING leaves — the listener constructor directly above the now-Rustopen_listener(P7n). Portedadd_listener(s_bsd.c:330) toircd-common/src/s_bsd.rs.- Cluster choice. The natural next leaf:
add_listeneris a thin constructor whose every callee is already Rust —make_client/make_link(P2) andopen_listener(P7n, which itself calls the still-Cinetport+ the Rustadd_fd/set_non_blocking). Its whole effect is the new listener-stubaClient's fields + the socket open (delegated toopen_listener) + theListenerLLprepend → fully observable as list + per-node post-state. The remaining s_bsd symbols are the event-loop core (read_message/add_connection), the real socket constructor (inetport+ its staticset_sock_opts), sender-only (report_error), process setup (init_sys/daemonize/start_iauth), connection auth (check_client/check_server/check_server_init+ the staticcheck_init), real-DNS (get_my_name), orstatic(nocref_oracle). - Guard / seam. Same
s_bsd_link.opartial-compile; added-DPORT_S_BSD_ADD_LISTENER_P7oto the recipe inircd-sys/build.rs(alongside the P7d–P7n guards) and wrapped the C body (s_bsd.c:330-358) in#ifndef PORT_S_BSD_ADD_LISTENER_P7o. RED confirmedadd_listenerundefined — referenced only by the now-Rusts_conf.rsinitconf (s_conf.c:2287); after GREENnm target/debug/ircdshows itTfrom Rust. The cref oracle keeps the full unguardeds_bsd.o→cref_add_listener. - Config-resolved body. No
#ifdefs inadd_listeneritself (the adjacent#ifdef UNIXPORT unixportblock is a separate function, untouched). Macros reproduced inline:FLAGS_LISTEN(bindgen const,flagsisc_long),ME=me.name(read the bindgenmeglobal'sname),SetMe(cptr)=cptr->status = STAT_ME(Status_STAT_ME).make_client(NULL)allocates aCLIENT_LOCALclient (fd = -1, soopen_listenerdoes not early-return);make_link()is the one-element confs link. - Faithfulness. The order matters:
make_clientalready setsname = namebuf+firsttime = timeofday;add_listeneroverwritesname = MEandfirsttime = time(NULL)(wall clock, not the event-looptimeofday).open_listeneris called before the list splice. The prepend is the verbatim C:if (ListenerLL) ListenerLL->prev = cptr; cptr->next = ListenerLL; cptr->prev = NULL; ListenerLL = cptr;. - Classification. Callee/utility TU (no
msgtabentry) — the listener constructor, called froms_conf.cinitconf (boot) and rehash. → L1 is the gate; no S2S (formats no remote-user wire fields). - L1.
add_listener_diff.rs, 3 cases, isolated worlds (Rust port reads/mutates the realListenerLL/local/fdas/fdall/me+ calls the real Cinetportvia the Rustopen_listener; oracle usescref_*+cref_inetport), serialized onGLOBALS_LOCK. Each world opens its own socket (fd integers differ) andmake_clientallocates its own client pointer → the comparison is on observable facts: the listener'sflags/status,acpt/fromself-pointers (as bools),namestring,confs->value.aconfidentity (matches the conf handed in) +confs->next == NULL, theListenerLLprepend linkage (prev == NULL,next == old head), and the fd's properties (fd_validviafcntl F_GETFD,listeningviaSO_ACCEPTCONN,nonblockingviaO_NONBLOCK) +fdas/fdall/local[fd]==cptrmembership +port.me.namepinned to"irc.test"in both worlds soinetport'sME-basedsockhostis identical.firsttime = time(NULL)is nondeterministic across the two calls → asserted non-zero, excluded from the cross-world compare. Cases: (1) into emptyListenerLL→ sole node,FLAGS_LISTEN/STAT_ME/self pointers/MEname/confs->aconf, listening + non-blocking + registered, prev/next NULL; (2) prepend before an existing node → new head withprev == NULL,next == old head, and the inverse invariant — the old head'sprevnow points back at the new node; (3) two consecutive calls → head is the 2nd,head->next == 1st,1st->next == NULL, with both back-links. Zero-diff vscref_add_listener. - Untested-by-design.
firsttime = time(NULL)(wall clock) is nondeterministic → asserted non-zero, not compared.inetport's failure arms (socket/bind failure →report_error+fd = -1) need an induced syscall failure; both worlds take the success path identically (covered transitively by P7n's open_listener test notes). - L2 / S2S. No new L2:
add_listenerruns at boot (and rehash) vias_conf.cinitconf; the existing golden suite exercises it —golden_registration(incl.register_quit_reuse_releases_nick) stays byte-identical (0 warnings). No S2S: it formats no remote-user wire fields.
- Cluster choice. The natural next leaf:
-
2026‑06‑06 — P7p (
s_bsd.cinetport, listener socket constructor) merged. The nexts_bsd.cleaf after the P7d–P7o socket/file/teardown/listener/CPING leaves — the real socket constructor directly below the now-Rustopen_listener(P7n). Portedinetport(s_bsd.c:210) + a private twin of itsstaticcalleeset_sock_optstoircd-common/src/s_bsd.rs.- Cluster choice.
inetportis the layeropen_listener(P7n) andadd_listener(P7o) call; porting it completes the listener-construction stack bottom-up. Its onlystaticcalleeset_sock_opts(s_bsd.c:1468) has nocref_oracle, so it is ported as a private (non-#[no_mangle]) Rust fn alongsideinetport; the Cstatic set_sock_optsis not removed — it stays compiled for its other in-TU callerscheck_server_init/connect_server(a static + a private-Rust twin coexist with no symbol clash; the duplicate vanishes when those two callers are ported).inetport's effects are fully L1-observable (the created fd's properties + thecptrfield writes), the same harness shape as P7n/P7o. The remaining s_bsd symbols are the event-loop core (read_message/add_connection), connection auth (check_client/check_server/check_server_init+ the staticcheck_init), sender-only (report_error), process setup (init_sys/daemonize/start_iauth), real-DNS (get_my_name), orstatic(nocref_oracle). - Guard / seam. Same
s_bsd_link.opartial-compile; added-DPORT_S_BSD_INETPORT_P7pto the recipe inircd-sys/build.rs(alongside the P7d–P7o guards) and wrapped the Cinetportbody (s_bsd.c:210-323) in#ifndef PORT_S_BSD_INETPORT_P7p(the adjacentstatic set_sock_optsleft untouched). RED confirmedinetportundefined — referenced by the now-Rustopen_listener(s_bsd.rs:605) and the still-Circd.c:1107; after GREENnm target/debug/ircdshowsinetportTfrom Rust, and the Cset_sock_optssurvives as atlocal (with the mangledircd_common::s_bsd::set_sock_optsprivate twin). The cref oracle keeps the full unguardeds_bsd.o→cref_inetport. - Config-resolved body.
AFINET=AF_INET6(os.h:680) →serveris alibc::sockaddr_in6,SIN_FAMILY/SIN_PORTmap tosin6_*;SOCKADDR_IN=sockaddr_in6.__CYGWIN32__off → no in-bodyset_non_blocking.LISTENQUEUE= 128 (config const, not in bindgen).ME=me.name.cptr->ipis the bindgenin6_addr(a__in6_u.__u6_addr8union, not libc's.s6_addr).cptr->portis au_short.set_sock_optsconfig-resolution: SO_REUSEADDR (opt=1) + SO_RCVBUF/SO_SNDBUF/SO_SNDLOWAT (opt=8192) all compile; SO_DEBUG is#if … && 0(never); SO_USELOOPBACK is not defined on Linux (skipped). TheSETSOCKOPTmacro (sys_def.h:29) passessizeof(int)=4 as the option length for every call (sizeof(o3)whereo3is the value arg), notsizeof(*p). SO_SNDLOWAT is set quietly (noreport_erroron failure); the othersreport_erroron failure (kept C). - Faithfulness. Order matters: the NULL-ipmask refuse and the
ad[i]>>8invalid-ipmask refuse bothreturn -1before thesockhost/auth/socketwrites (so on those pathsfdstays -1,authNULL). Theif (cptr->fd == -1)socket-open is conditional (an already-open fd is reused). Thecptr == &meKLUDGE (sprintf(buf, replies[RPL_MYPORTIS], ME, "*", ntohs(port)); write(0, buf, …)) is reproduced verbatim via the bindgenrepliesincomplete-array +RPL_MYPORTISconst, but is unreachable for a listener stub (cptr != &me).DupString(cptr->auth, ipname)=MyMalloc(strlen+1)(Rust P2) +strcpy. The ipmask canonicalization (sscanf "%d.%d.%d.%d"→sprintfback) and thesprintf "%-.42s.%u"sockhost are done vialibc::sscanf/libc::sprintffor byte-exactness. The bind addr:in6addr_anywhen!ip || (!isxdigit(*ip) && *ip != ':'), elseinetpton(Rust P1) with the 16-byteminus_onefallback on parse failure. - Classification. Callee/utility TU (no
msgtabentry) —inetportis reached fromopen_listener(boot/rehash) and the inetdme-listener path. → L1 is the gate; no S2S (formats no remote-user wire fields). - L1.
inetport_diff.rs, 6 cases, isolated worlds (the Rust port reads/mutates the reallocal/highest_fd/meand calls the realinetpton/MyMalloc; the oracle uses thecref_*copies +cref_inetport), serialized onGLOBALS_LOCK.me.namepinned to"irc.test"in both worlds so theME-based sockhost matches. Because each world opens its own socket (fd integers differ), theObscompares the fd's observable properties (fd_validviafcntl F_GETFD,listeningviaSO_ACCEPTCONN, the three socket options viagetsockopt SO_REUSEADDR/SO_RCVBUF/SO_SNDBUF) + the world-independent struct fields (sockhost,auth,port,ip16 bytes,local[fd]==cptr, the -1/0 return), never the raw fd;highest_fdis asserted per-world to equal the new fd. Cases: (1) normal port=0 listener (dolisten=1) → full compare: ret 0, listening, sockhostirc.test.0, auth0.0.0.0, port 0, registered,highest_fdbumped; (2) dolisten=0 (thelisten()inverse) → socket created + opts set but NOT listening, still registered; (3) NULL ipmask → return -1 before any socket (the refuse inverse), fd untouched, auth NULL; (4) invalid ipmask256.0.0.0(256>>8 != 0) → return -1 before sockhost/auth/socket; (5) wildcard bind (ip=NULL, port=P) →in6addr_any, getsockname →::,cptr->ipall-zero, sockhostirc.test.<P>; (6)::1bind (*ip == ':'→ theinetptonbranch) → bind::1, getsockname →::1,cptr->ip=::1, sockhost::1.<P>. The two bind cases (5,6) are serialized per world (run + observe + close Rust, then cref) over oneprobe_free_port()'d port, since both worlds would otherwise collide on it. Zero-diff vscref_inetport; sibling P7d–P7o L1 tests +golden_registrationre-run green. - Untested-by-design. The
socket/bind/getsocknamefailure arms (→report_error+ close + return -1) need an induced syscall failure; both worlds take the success path identically. Thecptr == &meKLUDGE (write(0, …)) and thefd >= MAXCLIENTSoverflow refuse are unreachable for a listener stub.set_sock_opts'sreport_errorarms fire only on asetsockoptfailure (none here). - L2 / S2S. No new L2:
inetportruns at boot (and rehash) viaopen_listener; the existing golden suite exercises it —golden_registration(incl.register_quit_reuse_releases_nick) stays byte-identical (0 warnings). No S2S: it formats no remote-user wire fields.
- Cluster choice.
-
2026‑06‑06 — P7q (
s_bsd.creport_error, error-reporting output leaf) merged. The genuine clean leaf left in the central I/O TU.- Cluster choice.
report_error(s_bsd.c:151) calls no others_bsd.cfunction → it ports in isolation. The 27 internal call sites (the still‑Cadd_connection/check_*/connect_server/read_message+ the already‑Rust P7d–P7p leaves that called it via anextern "C"decl) now resolve to the Rust definition. The remaining unported s_bsd.c functions (add_connection,read_message,connect_server,get_my_name,init_sys/daemonize/start_iauth, thecheck_*conf cluster) are all either event-loop cores, fork/destructive glue, or clustered via the file-privatestatic mysk(get_my_name↔connect_server↔check_client) — none is a clean standalone leaf, soreport_errorwas the right next pick. - Guard / seam. Partial port via the existing
s_bsd_link.osecond-compile, new guard-DPORT_S_BSD_REPORT_ERROR_P7q(added alongside P7d–P7p inircd-sys/build.rs). The Rust port replaces the oldextern "C" { fn report_error }decl ins_bsd.rs. - Config‑resolved body.
SO_ERRORdefined → the getsockopt readout compiles (mirrors P7d'sget_sockerr);DEBUGMODEoff → noDebug;USE_SYSLOGoff → nosyslog.textis a printf format taking two%s(host,strerror). Faithful:errtmp = errnofirst;host = get_client_name(cptr, FALSE)or""; the!IsMe && fd>=0SO_ERROR refinement;sendto_flag(SCH_ERROR, text, host, strerror); theConnecting||Handshake+serv->byuid[0]+ remote‑bysptrNOTICE (:%s NOTICE %s :viastrcpy+strncat, thensendto_one(bysptr, fmbuf, ME, bysptr->name, host, strerror)); theserverbootingfprintf(stderr, text, host, strerror)+fprintf(stderr, "\n")echo. The variadicsendto_flag/sendto_one/fprintfare called (legal in stable Rust), not defined — the trampolines stay C until P8.stderris glibc'sextern FILE *stderrsymbol (not the macro). Added inlineis_me/my_connecthelpers + aSCH_ERRORconst. - Classification. Utility / output leaf — no
msgtabentry. Effects: theSCH_ERRORopers notice (variadic wire, L2), the remotebysptrNOTICE (S2S), and theserverbootingstderr echo (L1‑capturable). So L1 gates the deterministic format core; the wire paths are L2/S2S/untested‑by‑design. - L1.
report_error_diff.rs, 4 cases, isolated worlds (Rust reads the realserverbooting+ calls Rustget_client_name; oracle usescref_serverbooting+cref_get_client_name), serialized onGLOBALS_LOCK. Acapture_stderrhelper dup/pipe‑redirects fd 2 around each call,fflush(NULL)before+after, reads the pipe, restores fd 2. The same heapaClient(calloc‑zeroed,fd=-1→!MyConnect→host=name, no SO_ERROR,status=STAT_CLIENT→ no bysptr) is passed to both worlds (read‑only). Each case sets both worlds'serverbooting+errno. Cases: (1)serverbooting=1+cptr=NULL→host="",errno=ECONNREFUSED→ formatted"…:Connection refused\n"; (2) inverse / the gate —serverbooting=0→ no stderr output (both empty); (3)serverbooting=1+cptrnon‑NULL →host=get_client_name=name,errno=EHOSTUNREACH; (4) host embedded mid‑string + varied errno (ETIMEDOUT/EPIPE). Zero‑diff vscref_report_error. - Verification.
cargo build(workspace, 0 warnings);nm target/debug/ircd | grep ' T report_error'→ defined from Rust; L1 zero‑diff; L2golden_registration(boot path exercisesreport_erroron errors) byte‑identical. - No new L2 / no S2S. Output callee, not a
msgtabhandler — theSCH_ERRORerror notice is covered by the existing golden suite. Untested‑by‑design: theSO_ERRORgetsockopt readout (needs a pending‑error socket;fd<0skips it identically), thesendto_flagSCH_ERROR wire emission (L2, variadic), thebysptrremote NOTICE (S2S — needs aConnecting/Handshakeserver whosebyuidresolves to a remote introducer).
- Cluster choice.
-
2026-06-06 — P7r (
s_bsd.cinit_sys, fd-table boot leaf) merged. Ported the cleanest remaining leaf in the central I/O TUs_bsd.c.- Cluster choice — after the P7d–P7q leaves, the genuinely-clean leaves are nearly exhausted;
init_sysis the last one that calls no others_bsd.cfunction and shares no private static with still-C code (it touches only the already-exportedfdas/fdall/localglobals). Contrast:get_my_nameshares the privatemyskstatic with still-Ccheck_init/connect_server(a shared-static connected component, deferred);daemonize/start_iauthare blocked on the still-C iauth spawn. - Config-resolved body — two
#ifdefs collapse the source:RLIMIT_FD_MAXis not defined on Linux (verified viagcc -E) → the entiregetrlimit/setrlimitofRLIMIT_FD_MAX+RLIMIT_COREblock (with itsexit(-1)arms) does not compile;USE_POLL=1(setup.h:390) → the#if !defined(USE_POLL)sequentsetdtablesizeblock is excluded; Linux (not PCS/DYNIXPTX/SVR3/HPUX/SVR4) → thesetlinebuf(stderr)branch. Resolved body:setlinebuf(stderr);bzero(&fdas)/bzero(&fdall)+fdas.highest=fdall.highest=-1;local[0]=local[1]=local[2]=NULL;for (fd=3; fd<MAXCONNECTIONS=50; fd++){ local[fd]=NULL; close(fd); }. Callees: libc only. - Mechanism — partial port via the existing
s_bsd_link.osecond-compile seam, new guard-DPORT_S_BSD_INIT_SYS_P7rinircd-sys/build.rs;init_syswrapped in#ifndef PORT_S_BSD_INIT_SYS_P7rinircd/s_bsd.c. Rust port inircd-common/src/s_bsd.rs:setlinebufvia a local extern (reusing the module'sstderrextern),fdas/fdallviaaddr_of_mut!(ircd_sys::bindings::fdas/fdall)+write_bytes(_,0,1),local[]via the existinglocal_base()helper,MAXCONNECTIONSfrom bindgen. - Classification — boot callee, not a
msgtabhandler. - L1 —
init_sys_diff.rs, 3 cases, zero-diff vscref_init_sys. The close loop closes fds3..49in the calling process → destructive to cargo's test fds, so each world runs in a forked child and returns its post-state through anmmap(MAP_SHARED|MAP_ANONYMOUS)region (memory, not an fd → survives the close loop); the parentwaitpids and asserts Rust-child == cref-child == expected. Each child pre-dirties its globals (highest=7,fd[]non-zero,local[0]/[5]/[N-1]sentinels) so the test proves the body wrote (inverse-of-dirty), opens a sentinel fd dup'd onto fd 10, and reports:fdas/fdall.highest(=-1), non-NULLlocal[]count (=0),fd[]fully zeroed, sentinel-fd-closed, fds 1/2 still open. Isolated worlds (realfdas/fdall/localvscref_*), serialized onGLOBALS_LOCK. - L2 / S2S — no new L2 (boot callee; the existing golden suite boots through it,
golden_registrationbyte-identical confirmed); no S2S (formats no remote-user fields). Untested-by-design:setlinebuf(stderr)(unobservable line-buffering); the rlimit/exitarms don't compile under the locked config.
- Cluster choice — after the P7d–P7q leaves, the genuinely-clean leaves are nearly exhausted;
-
2026-06-06 — P7s (
s_bsd.cget_my_name, server-own-hostname resolver, + de-staticmysk) merged. The most leaf-like remainings_bsd.cfunction after the P7d–P7r leaves. Portedget_my_name(s_bsd.c:2940) toircd-common/src/s_bsd.rs.- Cluster choice. After P7d–P7r the genuinely-clean s_bsd.c leaves are exhausted; the remaining exported functions are the event-loop core (
add_connection/read_message+ statics), the connection-auth cluster (check_init/check_client/check_server/check_server_init),connect_server, and the fork/iauth glue (daemonize/start_iauth).get_my_nameis the most leaf-like: its only in-TU callee isadd_local_domain(already Rust, P7e); everything else is libc (gethostname/gethostbyname/isdigit/strlen) or already-Rust (find_meP6,inetpton/mycmpP1,minus_one/mebindgen). NB: theutmp_open/utmp_read/utmp_closetrio +summonare not remaining leaves — they're#if defined(ENABLE_SUMMON) || defined(USERS_SHOWS_UTMP)(both off) so they don't compile at all (user-confirmed). - The
myskblocker / de-static.get_my_namewrites the file-privatestatic struct SOCKADDR_IN mysk(s_bsd.c:55); the still-Ccheck_client(s_bsd.c:965, localhost detection) andconnect_inet(s_bsd.c:2687/2692, outgoing bind) read it. To split the writer (→ Rust) from the C readers,myskneeds a linkable symbol → changedstatic struct SOCKADDR_IN mysk;→struct SOCKADDR_IN mysk;(file-scope global) unconditionally (behaviour-preserving: single TU, no othermysk; storage-class only). This also makes the cref archive exportcref_mysk(theobjcopy --prefix-symbolsrename only follows global symbols — the L1 static-symbol limit), so the L1 test gets a full cross-worldmyskcomparison.myskstays C-owned (defined ins_bsd_link.o); Rust references it via a localextern "C" { static mut mysk: libc::sockaddr_in6; }. - Guard / seam. Partial port via the existing
s_bsd_link.osecond-compile, new guard-DPORT_S_BSD_GET_MY_NAME_P7sadded alongside P7d–P7r inircd-sys/build.rs; the C body (s_bsd.c:2940-3023) wrapped in#ifndef PORT_S_BSD_GET_MY_NAME_P7s. RED confirmedget_my_nameundefined — referenced by the still-Circd.c:702(boot); after GREENnm target/debug/ircdshowsget_my_nameTfrom Rust andmyskaBglobal. The cref oracle keeps the full unguardeds_bsd.o→cref_get_my_name+cref_mysk. - Config-resolved body.
HAVE_GETIPNODEBYNAMEundef (setup.h:53) → the plaingethostbyname(cname) || gethostbyname(name)branch (nogetipnodebyname/freehostent).DEBUGMODEoff → noDebugat 3015. Themysk.SIN_ADDRwrite at s_bsd.c:3012 is inside a#if 0 … #endif(dead) → not ported.SOCKADDR_IN=sockaddr_in6(AFINET=AF_INET6);tmp[HOSTLEN+1](=64) is a module-privatestatic mut;ME=me.name;BadPtr(cname)=cname.is_null() || *cname == 0;strncpyzt=strncpy+ force-NUL. - Faithfulness.
myskisbzero'd first → full-struct byte compare is valid (padding/flowinfo/scope_id stay zero). The passwd branch fires only whenaconf->passwd && isdigit(*passwd)(so"2001:db8::1"qualifies but"::1"does not — leading char must be a digit);inetptonfailure →bcopy(minus_one, …, 16). The alias loop isfor (hname=h_name, i=0; hname; hname=h_aliases[i++])→ Rust readsh_aliases[i]theni += 1(post-increment).gethostbynameis declared via a local extern (absent from the libc crate). - Classification. Boot callee / utility TU (no
msgtabentry) — called fromircd.cboot +connect_server. → L1 is the gate; no S2S (formats no remote-user wire fields). - L1.
get_my_name_diff.rs, 6 cases, isolated worlds (Rust writes the realmysk; oracle writescref_mysk), sharedconf/cref_confM-conf list + shared read-onlycptr,me/cref_meME pinned toirc.test, separatenameoutput buffers, serialized onGLOBALS_LOCK. Determinism:gethostname/gethostbynameare non-deterministic across runs but identical across the two worlds in one run → the differential holds whatever DNS returns; the test asserts the two worlds agree (namebytes + the full 28-bytemysk==cref_mysk), not a fixed string. Cases: (1) M-conf NULL passwd → addr stays zero (family/port set); (2) non-digit passwd"abc"→ isdigit false → addr zero (inverse); (3) valid"2001:db8::1"→ inetpton fills20 01 0d b8 … 01; (4) digit-but-invalid"9zz"→ inetpton fails →myskaddr all-0xff(minus_one); (5)cname="localhost"→ drives thegethostbyname+ alias-loop branch; (6)cname=""→BadPtrearly return afteradd_local_domain. Zero-diff vscref_get_my_name. - Verification.
cargo build(workspace, 0 warnings); L1 zero-diff; sibling s_bsd L1 (s_bsd_leaves_diff/add_local_domain_diff/init_sys_diff/report_error_diff/close_connection_diff) re-run green;golden_registrationbyte-identical (boot exercisesget_my_name). - Untested-by-design. The resolved hostname is host-dependent (asserted as agreement, not a literal); the
gethostname == -1early return needs an induced failure (both worlds take the success path identically).
- Cluster choice. After P7d–P7r the genuinely-clean s_bsd.c leaves are exhausted; the remaining exported functions are the event-loop core (
-
2026-06-06 — P7t (
ircd.ccalculate_preference, AC preference leaf) merged. Portedcalculate_preference(ircd.c:387) toircd-common/src/ircd.rs.- Cluster choice — the cleanest remaining exported leaf in
ircd.c: thes_bsd.cclean leaves are exhausted (the rest belong to the deferred event-loop / auth / connect clusters), andcalculate_preference's only TU-callee,send_ping, was already ported in P7m. It is the periodic auto-connect (AC) preference recompute invoked fromio_loop(ircd.c:1164) whentimeofday >= nextpreference. - Body — walks the global
conflist; skips non-C-lines (status lackingCONF_CONNECT_SERVER|CONF_ZCONNECT_SERVER) and AC-ineligible C-lines (port <= 0); for the rest firessend_ping(aconf)(advances the conf'saCPingsliding window) then setspref = -1when there is no usable window (cp==NULL || cp->seq==0 || cp->recvd==0), else computespref = (u_int)(f*100)fromrecvd/seq,pow(f,20),ping/recvdwith a0.001floor and a100000.0ceiling. Returnscurrenttime + 60. - Config-resolved body — no
#ifdefs; compiles verbatim.CONF_CONNECT_SERVER=0x08,CONF_ZCONNECT_SERVER=0x20. - Seam — partial port via the existing
ircd_link.osecond-compile (which already drops the P7c tune pair); new guard-DPORT_IRCD_CALC_PREF_P7tadded to itsmake --evalline. The C function is wrapped#ifndef PORT_IRCD_CALC_PREF_P7t … #else extern time_t calculate_preference(time_t); #endif— the function is in no*_ext.h, andio_loop(its sole caller, same TU, defined later) relied on the in-file definition for its implicit prototype, so the#elsesupplies theexterndeclaration.nm target/debug/ircdconfirmsT calculate_preference(came from Rust). - Faithfulness — calls the libc
powvia a localextern "C" { fn pow(f64,f64)->f64; }, NOTf64::powf: the std intrinsic is permitted to differ from the systempowin the last ULP, which would diverge the(u_int)(f*100.0)integer truncation and break L1. The final store reproduces the Cdouble → u_int → intcast chain as(f * 100.0) as u32 as c_int(fis clamped≤ 100000.0, sof*100 ≤ 1e7fitsu32).send_pingis called before thecpread, faithfully — order matters because it mutates the window the pref math reads. - Classification — utility / callee TU (no
msgtabentry; reached only fromio_loop). - L1 —
ircd-testkit/tests/calculate_preference_diff.rs, zero-diff vscref_. Two isolated worlds (Rust readsconf/udpfd; oracle readscref_conf/cref_udpfd), each builds a parallelconflinked list, runs, then compares every node'spref+aCPingpost-state + thecurrenttime+60return. 5 cases: non-C-line skip (pref untouched),port<=0skip (send_ping not even called),recvd==0sentinel (send_ping bumps seq/lseq, recvd stays 0 →-1), full-window compute (byte-identical pref), and a 5-node mixed list.udpfdleft at-1(send_ping'ssendtofails, ignored; the pref math reads only the counters mutated beforehand). Serialized onGLOBALS_LOCK(the P7 L1 shared-global hazard). - L2 — no new test: the locked golden config defines no
connect{}C-lines, so the loop body is a no-op on a golden boot →golden_registrationstays byte-identical (re-confirmed). Same utility-leaf L2 posture as P7c/P7m. - S2S — none: formats no remote-user wire fields (only a numeric
preffield and a binary UDP datagram via send_ping). - Untested-by-design — the
cp==NULLclause of the-1sentinel is dead defensive code:calculate_preferencecallssend_ping(aconf)first, andsend_pingunconditionally dereferencescp->port, so an AC-able C-line withping==NULLsegfaults both implementations identically. It never occurs in practice (config allocates anaCPingfor everyconnect{}line), so the L1 test never builds such a node and the realistic sentinel is exercised viarecvd==0.
- Cluster choice — the cleanest remaining exported leaf in
-
2026-06-06 — P7u (
s_auth.ciauth/STATSreportersreport_iauth_conf/report_iauth_stats) merged. Opened the last P7 TU,s_auth.c(the socket/ident/iauth-pipe I/O deferred from P5), by porting its two cleanest leaves toircd-common/src/s_auth.rs.- Cluster choice. After P7a–P7t the clean leaves of
s_bsd.candircd.care exhausted (the rest are the deferred event-loop/auth/connect-server/signal clusters), so the natural next move iss_auth.c. Its iauth-pipe write path (vsendto_iauth/sendto_iauth) is irreducibly C —vsendto_iauthtakesva_listandsendto_iauthis variadic (the keystone send-family finding) → P8, not now. The read pathread_iauthis the big iauth protocol parser (stays C). The two cleanest leaves are the/STATSreporters: each walks aLineItem(aExtCf/aExtData=struct LineItem { char *line; struct LineItem *next; }) linked list and emits one numeric per node viasendto_one. Their only in-TU dependency is the two list headsread_iauthpopulates. - Config-resolved body. Both live in the
#if defined(USE_IAUTH)block (USE_IAUTH ON → compiled).RPL_STATSIAUTH=239,RPL_STATSDEBUG=249(bindgen consts);ME=me.name. No#ifdef-gated branches inside either body.report_iauth_confearly-returns whenadfd < 0(iauth slave fd);report_iauth_statshas no guard. - The seam / de-static. The writer
read_iauthstays C, so to split the Rust readers from it the two file-staticlist headsiauth_conf/iauth_stats(s_auth.c:97-98) are de-static'd (dropstatic, file-scope global) — behaviour-preserving (single TU, no other symbol of those names; storage-class only), the P7smyskprecedent. This gives the C-owned globals linkable symbols (defined ins_auth_link.o, written byread_iauth; Rust references them via a localextern "C" { static mut … : *mut LineItem }) and makes the cref archive exportcref_iauth_conf/cref_iauth_stats(theobjcopy --prefix-symbolsrename only follows global symbols — the L1 static-symbol limit), giving the L1 differential parallel C-owned heads to populate. - Guard / build.rs. Partial port via a new
s_auth_link.osecond-compile, guard-DPORT_S_AUTH_REPORT_P7u; the C bodies wrapped#ifndef PORT_S_AUTH_REPORT_P7u … #endif. Added"s_auth.o" => "s_auth_link.o"tolink_objs()and a plainsh -ccompile (s_auth.c references no machine-path macros —start_iauthlives ins_bsd.c, not here — so nomake --evalpath-var expansion needed, unlikes_bsd_link.o/ircd_link.o).s_auth.ostays inCREF_OBJS(unguarded oracle); not inPORTED(still-C symbols remain). RED confirmedreport_iauth_conf/report_iauth_statsundefined — referenced by the already-Rustm_stats(s_serv.rs) andtstats(s_misc.rs); after GREENnm target/debug/ircdshows bothT(from Rust) andiauth_conf/iauth_statsB(C-owned globals). - Faithfulness.
report_iauth_confchecksadfd < 0before the walk; both post-increment throughectmp = ectmp->nextin declaration order (head first).sendto_onecalled via a localextern "C"variadic decl (the s_numeric pattern); fmt literalc":%s %d %s :%s".as_ptr() as *mut c_char. - Classification. Utility / callee TU (no
msgtabentry) — reached only from STATS:report_iauth_conf←s_serv.cm_stats (/STATS a/i),report_iauth_stats←s_misc.ctstats(/STATS t). → L1 is the gate. - L1.
ircd-testkit/tests/iauth_reporters_diff.rs, 6 cases, zero-diff. The reporters' only observable surface is the bytessendto_onebuffers into the recipient'ssendQ, so the test builds a shared read-onlyLineItemlist (pointed at by bothiauth_confandcref_iauth_conf— the reporters never mutate it), gives each world its OWN heap recipientaClient(Rustsend_message→Rustdbuf_putvscref_send_message→cref_dbuf_put— separate dbuf pools), drives both reporters, then drains eachsendQwith its MATCHINGdbuf_get(cross-reading would corrupt the foreign freelist) and asserts byte-identical. Recipient:fd=-1,status=STAT_CLIENT,from/serv/confsNULL (get_sendqreturns default QUEUELEN, no deref),acpt = &me/&cref_mesosend_message'sif (to->acpt != &me) (*to->acpt).sendM++branch is skipped (a real local client always has a validacpt; the zeroed NULL would deref — found the hard way). Cases: (1) 3-node conf list,adfd=5→ 3× RPL_STATSIAUTH; (2) inverse/guard non-empty list,adfd=-1→ no output; (3) inverse empty conf list → no output; (4) 3-node stats list → 3× RPL_STATSDEBUG; (5) inverse empty stats list → no output; (6) single node + longertoarg →%s :%spassthrough. Serialized onGLOBALS_LOCK(me/adfd/iauth_conf/iauth_statsare process globals). - L2. No new test: golden boots
-t -s(no iauth) →adfd<0+ empty lists → both reporters are no-ops, so any STATS path stays byte-identical = no-regression only.golden_registrationre-confirmed byte-identical. - S2S. None — the reporters format no remote-user wire fields (only the local server name + a config/stat line).
- Verification.
cargo build --workspace(0 warnings); L1 zero-diff (6/6);golden_registrationbyte-identical.
- Cluster choice. After P7a–P7t the clean leaves of
-
2026-06-06 — P7v (
s_auth.cset_clean_username) merged. The last pure-logic leaf ofs_auth.c; everything else left in the TU is socket/ident/iauth-pipe I/O kept in C.- Cluster choice.
set_clean_username(s_auth.c:44) is the onlys_auth.cfunction with no socket/fd dependency — callees are libc-only (strchr/strlen/isspace/strcmp,MyFree→free) plus theistatglobal (defined in still-C ircd.c, reachable via bindgen) and the interior self-pointercptr->auth = cptr->username. The remainings_auth.csymbols are all I/O:read_iauth(iauth-pipe parser, writes the P7u list heads), the variadicsendto_iauth/vsendto_iauth,start_auth+ the ident-protocolsend_authports/read_authports— per the PLAN these stay C for now. - Behaviour. Derives
cptr->username(≤USERLEN=10 + NUL) from the raw ident reply: NULLauth→ early return; mark "dirty" (prefix a-) ifauthcontains[/@,strlen>USERLEN, has a leading:(then skip it), or has whitespace followed by more chars; copy up to USERLEN chars dropping@/[/whitespace; if the cleaned namestrcmp-equals the original,MyFree(auth)+ redirectauthat the interiorusernamebuffer (themake_clientself-pointer hazard →addr_of_mut!), else the original heapauthsurvives andistat.is_authmem += strlen+1,istat.is_auth += 1. - Guard / seam.
set_clean_usernamewasstatic→nm -g(ircd-testkit's cref renamer) emitted no oracle. De-static'd in s_auth.c (storage-class only, behaviour-preserving — single TU, no other symbol of this name; the P7smysk/ P7u list-head precedent) and the body#ifndef PORT_S_AUTH_CLEAN_USERNAME_P7v-guarded out ofs_auth_link.o(-Dadded to the recipe inircd-sys/build.rsalongside-DPORT_S_AUTH_REPORT_P7u), with an#elseextern prototype so the still-C callers keep a declaration. RED confirmedundefined reference to set_clean_usernamefrom both the test and the C callers (read_iauth:410,read_authports:810); after GREENnm target/debug/ircdshowsT set_clean_username(from Rust). The cref oracle keeps the full unguardeds_auth.o→cref_set_clean_username. - Classification. Utility/callee (no
msgtabentry). Reached only from the still-Cread_iauth/start_auth, which need a live iauth/ident peer the golden harness doesn't run (boots-t -s,adfd<0). L1 is the gate. - L1.
ircd-testkit/tests/set_clean_username_diff.rs: two independent calloc'd heapaClients per case (one driven byc_set_clean_username[→Rust], one bycref_set_clean_username), each with its ownauthallocated by libcstrdup(the fn mayfree()it → must be malloc-compatible, not a RustCString); calloc'd → zeroedusername[11]so trailing bytes match. Asserts byte/field-identical across worlds: the fullusername[11]buffer, theis_auth/is_authmemdeltas (istatvscref_istat, read before/after), and theauth == &usernameself-pointer predicate (plus, when false, the survivingauthstring content). 9 cases: free path ("bob", exact-USERLEN"abcdefghij", empty""), istat path ("bob@host","bo[b","verylongusername",":bob","bo b"), inverses ("bob "trailing-whitespace not-dirty-but-unequal, NULL-auth early return). Zero-diff; serialized onGLOBALS_LOCK(istat/cref_istatare process globals). - L2 / S2S. No new L2: the only callers are unreachable under the golden harness's
-t -sboot (no iauth slave, no ident peer);golden_registrationstays byte-identical (no-regression). No S2S — the function formats no remote-user fields / has noIsServerbranch.
- Cluster choice.
-
2026-06-06 — P7w (
s_auth.cident-protocol I/O pairsend_authports/read_authports) merged. The RFC1413 ident query/reply pair — the leaf relative to the still-Cstart_auth+ thes_bsd.cevent loop (s_bsd.c:2363/2368, theFLAGS_WRAUTH/auth-readable arms). Ported toircd-common/src/s_auth.rsalongside the P7u reporters + P7vset_clean_username.- Cluster choice — leaf-first: these are leaves relative to
start_auth(which opens the ident connection) and the still-C select/poll loop. They share no file-staticwith the rest ofs_auth.c(theiauth_*statics belong toread_iauth) → independent cluster. The remaining s_auth C =read_iauth(iauth-pipe parser),start_auth(connection setup), the variadicsendto_iauth/vsendto_iauth. - Config-resolved body —
USE_SYSLOGundef → the get{sock,peer}name-errorsyslog(...)block (the onlyget_client_namecall) drops to a baregoto authsenderr;DEBUGMODEundef → everyDebug((...))a no-op (itsinet_ntop/ipv6stringarg never evaluated);AFINET=AF_INET6→SOCKADDR_IN=sockaddr_in6,SIN_PORT=sin6_port,SOCKADDR=sockaddr,SOCK_LEN_TYPE=socklen_t;BUFSIZE=512(cptr->bufferis[char;512],countanint); flagsFLAGS_AUTH=0x200/FLAGS_WRAUTH=0x400/FLAGS_GOTID=0x1000,ClearAuth=flags&=~FLAGS_AUTH. send_authports—getsockname/getpeername(fd)(short-circuit||preserved),sprintf→Rustformat!("{} , {}\r\n", ntohs(them.sin6_port), ntohs(us.sin6_port)), singlewrite(authfd). A short write or a get{sock,peer}name failure isauthsenderr:ircstp->is_abad++,close(authfd), walkhighest_fddown whilelocal[highest_fd]is NULL,authfd=-1, clearFLAGS_AUTH|FLAGS_WRAUTH. Success → clear onlyFLAGS_WRAUTH.read_authports—read(authfd, buffer+count, sizeof(buffer)-1-count)(buffered across partial reads viacount), thenlibc::sscanf(buffer, "%hd , %hd : USERID : %*[^:]: %512s", &remp, &locp, ruser)(driven through libc with the exact C format → bit-identical parse). On a match: extractsystem(the: <type> :field viastrrchr+ leading-isspaceskip +strncpyzt) andruser(copy non-space/non-:chars). No match butlen!=0and a\n/\rpresent → clearruser; no\n/\ryet → early return (keep reading). Thenclose(authfd)+highest_fdwalk +count=0+authfd=-1+ClearAuth;!locp||!remp||!*ruser→is_abad++, elseis_asuc++; free the oldauth(+istatdecrement) when it's not the interiorusernamepointer, setauth(OTHER→MyMalloc+'-'+strcpy, elsemystrdup),set_clean_username,FLAGS_GOTID.- Seam —
-DPORT_S_AUTH_AUTHPORTS_P7wadded to thes_auth_link.osecond-compile; both bodies#ifndef-guarded out ofs_auth.c. Both are already global ins_auth_ext.h(unlike the staticset_clean_username), so the C callers' prototype comes from the header → no de-static, no#elseprototype needed (the P7ureport_iauth_*precedent). RED confirmed:cargo build -p ircd-rs→ exactlysend_authports/read_authportsundefined (froms_bsd.c:2363/2368); GREEN:nm target/debug/ircdshows both asT(from Rust).index→strchr,rindex→strrchr,MyFree→free,ntohs→u16::from_be; globalsircstp/highest_fd/local[]/istat+mystrdup/MyMallocare the ircd-common defs. - Classification — utility/callee TU (no
msgtabentry); reached only from the still-C ident I/O path. L1 is the gate. - L1 —
ircd-testkit/tests/authports_diff.rs, 10 cases, zero-diff vscref_*. Two independent heapaClients + per-worldircstp(+backingstats)/istat/highest_fd/local[](thecref_*twins), serialized onGLOBALS_LOCK(the P7 L1 shared-global convention). fd I/O over socketpairs.send_authports: both worlds'fdpoint at one real connected IPv6-loopback socket (connected_inet6) sogetsockname/getpeernamepopulatesin6_portidentically — an AF_UNIX socketpair leaves the port bytes untouched, so C reads uninitialised stack while Rust reads its zeroed buffer (the one false diff this caught, fixed in the harness, not the port). Each world writes to its ownauthfdwhose bytes are read back and compared. Cases: success (identical written bytes +FLAGS_WRAUTHcleared,FLAGS_AUTHuntouched), getsockname-error (fd=-1→is_abad++,authfd=-1, flags cleared), and theauthfd==highest_fdwalk to a non-NULLlocal[]floor.read_authports: each world'sauthfdis a socketpair read-end fed an identical canned reply. Cases: validUSERID(→is_asuc++, usernamebob, free path),OTHER(→-bob), bad reply with\n(→is_abad++, noGOTID),ERRORreply, partial read with no\n/\r(→ early return:authfdstill open,countadvanced, no counter change — the inverse/round-trip case), EOF (read==0 →is_abad++), and a pre-existing heapauth(→ freed +istatdecremented). Asserts byte/field identicalusername[11],auth(string or theauth==&usernamepredicate),flags,count,authfd, and theis_asuc/is_abad+is_auth/is_authmemdeltas. - L2 / S2S — none. No
msgtabentry; the ident path needs a live ident server theircd-goldenharness doesn't run (-t -s,adfd<0). Formats no remote-user wire fields, noIsServerbranch → no S2S. Existing golden suite stays byte-identical (golden_registrationre-run green as the no-regression check).
- Cluster choice — leaf-first: these are leaves relative to
-
2026-06-06 — P7x (
s_auth.cident initiatorstart_auth) merged. Portedstart_auth(s_auth.c:544) toircd-common/src/s_auth.rs— the function that initiates the RFC1413 (ident) query carried out by the P7w pairsend_authports/read_authports.- Cluster choice — leaf-first: the last ident-protocol leaf in s_auth.c. Remaining C in s_auth.c after this =
read_iauth(iauth-pipe parser) + the variadicsendto_iauth/vsendto_iauth(va_list → P8 trampolines). - Guard —
-DPORT_S_AUTH_START_AUTH_P7xadded to the existings_auth_link.orecipe (alongside_P7u/_P7v/_P7w). The C body is#ifndef-guarded with an#elseextern prototype so the still-C callers (s_bsd.c:1272/1732—check_client/add_connection) keep a declaration. - Config-resolved body —
NO_IDENTundef → full body (not the empty stub);USE_IAUTHon → the(iauth_options & XOPT_REQUIRED) && adfd<0early-return + theadfd>=0iauth-handoffabufblock;USE_SYSLOGundef → thesocket()-failuresyslogcollapses to a bareircstp->is_abad++;DEBUGMODEundef → everyDebug((...))no-op;AFINET=AF_INET6→SOCKADDR_IN=sockaddr_in6,SIN_FAMILY/SIN_PORT=sin6_family/sin6_port,SOCK_LEN_TYPE=socklen_t. - Faithfulness —
ntohs→u16::from_be,htons→u16::to_be; the iauth query is built with libcsprintfthrough the exact"%d C %s %u "/"%s %u"formats + the globalipv6stringscratch the C reused (sequenced them→us, byte-for-byte);IsConfTLS(x)=x->flags & PFLAG_TLS,BadPtr(x)=!x||*x=='\0'. The Rust portsset_non_blocking(P7d)/report_error(P7q)/inetntop/inetpton(P1) resolve through the link seam; the variadicsendto_iauth/sendto_flagare called via a localextern "C"block.errnovia*libc::__errno_location()compared toEINPROGRESS. - Classification — utility/callee TU (no
msgtabentry); reached only from the still-C connection path (add_connection→check_client→start_auth), which needs a live ident peer theircd-goldenharness doesn't run. - L1 —
ircd-testkit/tests/start_auth_diff.rs, 3 cases, zero-diff vscref_start_auth, serialized onGLOBALS_LOCK(P7 shared-global convention), per-worldadfd/iauth_options/ircstp/highest_fd: (1)XOPT_REQUIRED && adfd<0early return (authfd/flags untouched); (2) iauth handoff —adfd=socketpair write-end (write succeeds →sendto_iauthreturns 0),cptr->fd=a shared real connected IPv6-loopback socket so both worlds' getpeername/getsockname read identical addrs/ports → the query bytes written toadfdare byte-identical,authfdclosed,FLAGS_XAUTHset; (3) getpeername failure on an unconnected socket →report_error+authfd=-1(compares cptr state only; the client needs a realname+STAT_CLIENTsince fd>=0 →get_client_nametakes the MyConnect/showip branch). Not covered (noted in the test header): theMAXCONNECTIONS-2fd-exhaustion guard (can't force a high fd) and the bind/connect-to-113 network tail. - L2 / S2S — no new test. Utility TU with no client/golden path under the locked config (no ident peer); L1 is the gate. Existing golden suite stays byte-identical (
golden_registrationgreen). No S2S — noIsServerbranch, formats no remote-user fields. - Observation (out of scope, pre-existing P5) — case 3 surfaced a
get_client_name(showip=TRUE)divergence on a NULLauthpointer: the Rust port emitstester[@]where glibcsprintf("%.*s", N, NULL)emitstester[(null)@]. Only observable viareport_error's stderr (not asserted here); a latent faithfulness gap in the P5get_client_nameport, not P7x.
- Cluster choice — leaf-first: the last ident-protocol leaf in s_auth.c. Remaining C in s_auth.c after this =
-
2026-06-06 — P7y (
s_auth.ciauth-pipe line parserread_iauth) merged.- Cluster choice —
read_iauth(s_auth.c:174), the last non-variadic logic in s_auth.c (per [[p7-started]]). Leaf-first relative to the still-Cs_bsd.cselect/poll loop that calls it whenadfdis readable. After this, the only C left in s_auth.c is the variadicsendto_iauth/vsendto_iauthtrampolines (→ P8). - Guard —
-DPORT_S_AUTH_READ_IAUTH_P7yadded to the existings_auth_link.orecipe inircd-sys/build.rs(alongside_P7u/_P7v/_P7w/_P7x); the C body is#ifndef-guarded with an#else void read_iauth(void);prototype so the still-C callers (the event loop) keep a declaration. The cref oracle keeps the full unguardeds_auth.o→cref_read_iauth+ thecref_iauth_*globals survive for L1. - Config-resolved body — USE_IAUTH ON (whole body live); AFINET=AF_INET6 → the per-client prefix formats
inetntop(AF_INET6, &cptr->ip, ipv6string, sizeof); DEBUGMODE off. No#ifdefinside the function.index→strchr,bcopy(a,b,c)→memmove(b,a,c)(os.h:384),MyFree→ libcfree;MyMalloc/mystrdupare the ircd-common allocators. Function-staticcarry state (obuf/last/olen/ia_dbg) → private modulestatic mut(thedebugbufprecedent). File-scope globalsiauth_version(de-static'd-by-default, not in any header → declared extern in the module),iauth_conf/iauth_stats(P7u de-static'd),iauth_options/iauth_spawn(bindgen) stay C-owned in s_auth_link.o. - Classification — utility/callee TU, no
msgtabentry; called from the still-C event loop when a live iauth slave writes the pipe. L1 is the gate. No L2/S2S: the golden harness runs-t -swithadfd<0(no iauth slave), so the path is unreached there; noIsServerbranch, formats no remote-user wire fields. Existing golden suite stays byte-identical (golden_registration2/2 confirmed, no-regression). - L1 —
ircd-testkit/tests/read_iauth_diff.rs, 10 cases, zero-diff vscref_, serialized onGLOBALS_LOCK. Drivesread_iauth/cref_read_iauthon independent per-world copies of every touched global (adfd/iauth_options/iauth_spawn/iauth_version/iauth_conf/iauth_stats/istat/me/local[]/timeofday); each world'sadfdis the read end of its own non-blocking socketpair fed the identical protocol bytes;timeofday/iauth_spawnpinned so thes-headermyctime/spawn line is byte-identical. Cases: O-options (incl. flagless reset), V replace+free, A/a conf add+clear (inverse pair), s/S stats reset+append (inverse pair), U/u per-client ident (freshauth==usernameself-pointer → no-free path), U-with-pre-existing-heap-auth(istat-decrement + free, allocated through each world's ownMyMalloc/cref_MyMallocto avoid crossing allocator twins), gone-client / port-mismatch / garbage negatives (client untouched), and the obuf/olen partial-line carry round-trip (split feed == one-shot). - Finding — the per-client prefix check formats the client IP through the ported
inetntop, which expands::1→0:0:0:0:0:0:0:1(a faithful quirk ofsupport.c's::-expander). In production the iauth daemon echoes the same expanded form (start_auth builds the query with the sameinetntop), so the prefix matches; the L1 input lines must carry the expanded IPv6 form, not::1. Initial test used::1→ both worlds correctly took the mismatch branch (differential green, expectation wrong) — surfaced the quirk. - Not covered (noted) — the recv-error "lost slave" branch (
close(adfd)+start_iauth) and theD/K/kfinish/kill paths (register_user/exit_client, need a fully-registered client + the event loop) — deterministic only at L2/soak with a live iauth.
- Cluster choice —
-
2026-06-06 — P7z (
s_bsd.ccheck_client) merged. Ported the ordinary-client access checkcheck_client(s_bsd.c:909) toircd-common/src/s_bsd.rs; guard-DPORT_S_BSD_CHECK_CLIENT_P7zon thes_bsd_link.orecipe.- Cluster choice —
check_clientis a callee of the Rustregister_user(s_user.c:557), reached when a connecting client finishes registration. It resolves the socket peer address, validates the DNS host↔ip mapping, and attaches the matching I:line. The file-statichelpercheck_init(s_bsd.c:868) is shared with the still-Ccheck_server_init(s_bsd.c:1083), so it is NOT dropped: ported as a private Rust twin while the Cstatic check_initstays compiled. Aftercheck_clientwas#ifdef'd out,check_inithas exactly one remaining caller (check_server_init) → GCC inlines it and drops the symbol; the build resolves cleanly. This is the P7pset_sock_optsprecedent (astaticcallee ported as a private twin while the Cstaticsurvives for its other caller). - Config-resolved body —
NO_OPER_REMOTEundef → the trailingFLAGS_LOCAL/is_locblock (s_bsd.c:961–975) is not compiled, socheck_clientends atattach_Ilineand makes nomyskuse (unlikecheck_server_init/connect_server).UNIXPORTundef → noIsUnixSocketbranch in either fn;hp = cptr->hostpunconditionally.DEBUGMODEoff → allDebug(...)no-ops.AFINET=AF_INET6→sockaddr_in6/sin6_addr/sin6_port/in6_addr. - Faithfulness notes —
check_initdoesgetpeername(cptr->fd)(isatty branch kept for the inetd-on-tty case →me.sockhost),inetntopinto the caller'ssockname,bcopythe 16-byte addr intocptr->ip,cptr->port = ntohs(sin6_port). The IP# Mismatch arm reads fourc_ulongs fromhp->h_addr(a 16-byte addr — a latent C over-read;%08xtruncates each to 32 bits) and writes theinetntopresult into the real globalipv6string(matching the C side effect).attach_Iline(P6) /inetntop/report_error(P7q) are Rust; the variadicsendto_flagis called (→ P8). - Classification / L1 — callee TU (no
msgtabentry).cref_check_clientis exported → full cross-world L1 differential (ircd-testkit/tests/check_client_diff.rs, 4 cases). Both worlds get separate aClients (check_client mutatesip/port/hostp+ attaches confs) but share one real connected IPv6-loopback fd sogetpeernameis byte-identical;conf/cref_confboth empty →attach_Ilinereturns-2 EXITC_NOILINE(the loop never runs) — deterministic, no fixture. Cases: (1) no hostp/empty conf → ip/port filled, hostp stays NULL, -2; (2) hostp addr matches::1peer → hostp kept; (3 inverse) hostp addr mismatches → IP# Mismatch → hostp cleared to NULL; (4) unconnected socket → getpeername fails → check_init → report_error → -1. Asserts return +ip/port/hostp-nullness agree. Serialized on aGLOBALS_LOCK(conf/ipv6string/meare process globals; see the p7-l1-shared-global-race memory). Fixture finding: the getpeername-failure path → report_error → get_client_name →mycmp(name, sockhost)derefscptr->name, so the harness client must set a non-NULLname(the realmake_clientsetsname = namebuf). - L2 / S2S — L2 = existing
ircd-goldengolden_registrationbyte-identical; it drives a real client through registration with a real I:line, exercising the success path (return 0) that L1's empty-conf cases don't. No S2S:check_clienthas noIsServer(cptr)branch and formats no remote-user fields (servers go throughcheck_server_init/check_server).
- Cluster choice —
-
2026-06-06 — P7aa (
s_bsd.ccheck_server_init+check_server) merged. The server-side access-check cluster — the sibling of the P7zcheck_client, reached from the Rustm_server/completed_connectionon a server link.- Cluster choice —
check_server_init(s_bsd.c:992) is the entry point; it tail-callscheck_server(s_bsd.c:1076), so the two form one connected component over the C/N-line lookup. Ported together under one guard-DPORT_S_BSD_CHECK_SERVER_P7aa. - Guard / check_init — both functions
#ifndef'd out ofs_bsd_link.o. The file-staticcheck_init(s_bsd.c:868, ported as a private Rust twin in P7z) had its two callerscheck_client(P7z) andcheck_server(P7aa); with both now ported, the Cstatic check_init+ its forward prototype (s_bsd.c:64) lose their last C caller, so they are guarded out under the samePORT_S_BSD_CHECK_SERVER_P7aasymbol (no unused-static warning). The Rust port reuses the existing P7zcheck_inittwin. - Config-resolved body —
UNIXPORTundef → everyIsUnixSocket/#ifdef UNIXPORTbranch dropped (theget_sockhostunix guards collapse to always-run; noIsUnixSocket(cptr)in the addr-validation or conf scan);DEBUGMODEoff → allDebug(...)no-ops;AFINET=AF_INET6.CFLAG/NFLAG/SCH_DEBUGadded as module consts. - Faithfulness — the
check_serverbackgoto becomes aloop(validatehpthenbreak; the goto fires only in theelse if (cptr->hostp)re-entry); the alias walkfor(i=0,name=h_name; name; name=h_aliases[i++])becomes awhile !name.is_null()readingh_aliases[i]theni+=1; theIP# Mismatcharm reads fourc_ulongs fromhp->h_addr(the same faithful over-read ascheck_client); the async-DNS stackLinkis built viastd::mem::zeroed()+lin.value.aconf/lin.flags = ASYNC_CONF;AND16(c_conf->ipnum)==255(unresolved sentinel) reuses thesend_pingfold and copiescptr->ipinto the conf's ipnum (dynamic-ip C-line rewrite).index→libc::strchr;sprintf("%s@%s")via a local variadic extern. - Callees —
attach_confs/find_conf/find_conf_host/find_conf_ip/attach_conf/det_confs_butmask/count_cnlines(P6 s_conf),get_sockhost(P5 s_misc),gethost_byname(P6 res),add_local_domain(P7e),inetntop/strncpyzt(P1/local) all Rust;sendto_flagis called (variadic → P8).nextdnscheckglobal write via bindgen extern. - Classification — utility/callee TU (no
msgtabentry). L1 is the differential gate; the C+N success path (return 0, attach,get_sockhost) is exercised by the existing L2-S2S golden suite, not a new L2 file. - L1 —
ircd-testkit/tests/check_server_diff.rs, 6 cases zero-diff vscref_:check_server_initwithIsUnknown+ empty conf →attach_confsNULL → -1 (beforecheck_server);IsHandshake, NULL confs →find_confNULL →sendto_flag+det_confs_butmask→ -1;check_serverunconnected fd →check_initgetpeernamefails → -2; connected ::1 fd no-hostp / hostp-addr-match / hostp-addr-mismatch → allfind_conf_*miss → -1, asserting post-stateip/port/sockhostagree. Separate aClients per world (the fns mutateip/port/sockhost/confs), one shared real ::1-loopback fd sogetpeernameis byte-identical; serialized onGLOBALS_LOCK(conf/me/ipv6string/nextdnscheckare process globals; the [[p7-l1-shared-global-race]] memory). hostents use a dottedh_namesoadd_local_domainis a no-op (no resolver/env dependency), with each addr padded to 32 bytes for the mismatch over-read. - S2S — no new file:
golden_s2s_link/_eob/_who(and the rest of the S2S suite) link a realPeerthat the Rust ircd accepts throughcheck_server_init/check_server(s2s.confcarries the C/N lines), so a regression in the success/attach path fails the burst diff. All ran green;golden_registration(local client) also green.
- Cluster choice —
-
2026-06-06 — P7bb (
s_bsd.cadd_connection+check_clones) merged.- Cluster choice — the inbound-connection acceptor
add_connection(s_bsd.c:1638), the next leaf bottom-up after the P7d–P7aa socket/teardown/listener/access-check leaves: it is called from the still-Cread_listenerfor each fdaccept()ed off a listener. Its only caller-private calleecheck_clones(s_bsd.c:1572,CLONE_CHECK) is ported alongside it. - Guard —
-DPORT_S_BSD_ADD_CONN_P7bbwraps two regions under one macro:check_clones(inside the surrounding#ifdef CLONE_CHECK) andadd_connection. The P7kadd_connection_refusesitting between them keeps its own guard.add_unixconnection(#ifdef UNIXPORT) is not compiled. check_clonesas a private twin —staticin C → nocref_symbol → cannot be L1-diffed directly; ported as a module-private Rustfnwith astatic mut BACKLOGmatching the C function-localstruct abackloglist (age outpt+CLONE_PERIOD<timeofday, prepend{ip,now}, count same-ip nodes).MyMalloc(P2) / libcfree(theMyFreemacro). Observed only throughadd_connection's clone-reject path. The P7pset_sock_opts/ P7zcheck_initprecedent.- Config-resolved body —
NO_DNS_LOOKUPset (build.rsEXTRA_CFLAGS): theelsearm just setsacptr->hostp = NULL, and theUSE_IAUTH && !NO_DNS_LOOKUPalias-forwarding block (%d A/%d Nto iauth) is compiled out.CLONE_CHECKon (CLONE_MAX=10, CLONE_PERIOD=2) → the clone branch compiles;DELAY_CLOSE=15 → clone reject usesnextdelayclose = delay_close(fd)thenadd_connection_refuse(fd,acptr,1).UNIXPORTundef,AFINET=AF_INET6(sin6_*, 16-bytein6_addr),linux→ the getpeername-fail arm guardsreport_errorbehinderrno != ENOTCONN. - Callees —
make_client/add_client_to_list/add_fd(P2),inetntop(P1),report_error(P7q),add_connection_refuse(P7k),delay_close(P7f),set_non_blocking(P7d),set_sock_opts(P7p private twin),start_auth(P7x) all Rust;get_sockhost/get_client_host/sendto_flogstay C (non-variadic bindgen externs);sendto_flagis called (variadic, → P8).local/highest_fd/fdall/nextdelayclose/ipv6string/timeofdayare bindgen statics. - Classification — utility/callee TU (not a
msgtabhandler): reached fromread_listener. Universally exercised by L2. - L1 —
ircd-testkit/tests/add_connection_diff.rs, 3 tests, zero-diff vscref_.start_authneutralized in both worlds byiauth_options=XOPT_REQUIRED+adfd=-1(its top early-return) so its socket side effects drop out of the diff.normal_accept_then_clone_flood(case 1 + 4 merged so the process-staticbacklog starts pristine): first accept over a SHARED connected ::1 fd → compare full surviving post-state (return non-null,ip=::1,port,sockhost,fd,acpt,hostp=NULL,local[fd],highest_fd,aconf->clients=1); then per world calls #2..#10 succeed and the 11th (count=11>CLONE_MAX) is clone-refused (exercising the backlog twin).getpeername_failure_refuses+illegal_conf_refuses: the two refuse inverses (NULL +ircstp->is_ref+1 +clientsuntouched + fd closed; own fd per world since the path closes it). Serialized onGLOBALS_LOCK(local/highest_fd/fdall/ipv6string/timeofday/ircstp/iauth_options/adfd/the backlog are process globals; the p7-l1-shared-global-race hazard). - L2 — no new test.
add_connectionis the universal inbound acceptor — everyircd-goldenclient connection already flows through it;golden_registration(success path) byte-identical,golden_s2s_linkgreen (incoming server links also go through it beforem_server/check_server_init). - S2S — none.
add_connectionformats no remote-user fields and has noIsServer(cptr)branch (the client has no name/type yet).
- Cluster choice — the inbound-connection acceptor
-
2026-06-06 — P7cc (
s_bsd.cconnect_server+ staticconnect_inet) merged. The outbound server-connection setup (s_bsd.c:2511) — the counterpart of the inboundadd_connection(P7bb). Ported toircd-common/src/s_bsd.rs; guard-DPORT_S_BSD_CONNECT_SERVER_P7ccon thes_bsd_link.orecipe.connect_servernow resolves from Rust; the still-Cdo_dns_async/try_connectionsand the Rustm_connectcall it via thes_bsd_ext.hprototype.- Cluster choice — the next leaf bottom-up after the P7d–P7bb socket/teardown/listener/access-check leaves.
connect_server's only caller-private callee is the file-staticconnect_inet(s_bsd.c:2674), ported alongside as a private Rust twin (nocref_oracle for astatic). set_sock_optslifecycle — ported as a private Rust twin back in P7p, while the Cstaticwas kept for its remaining compiled caller. Survey: 268 (inetport, P7p — guarded out), 1731 (add_connection, P7bb — guarded out), 1802 (add_unixconnection, UNIXPORT off — not compiled), 2595 (connect_server— the last one). Withconnect_serverported, the Cstatic set_sock_opts+ its forward proto (s_bsd.c:69) have zero compiled callers → both guarded out underPORT_S_BSD_CONNECT_SERVER_P7cc(the P7aacheck_initprecedent); the Rust port uses the existing P7p twin.- Config-resolved body —
UNIXPORTundef →connect_unixnot compiled, the*aconf->host == '/'branch drops → alwaysconnect_inet;AFINET = AF_INET6→sockaddr_in6/sin6_*/16-bytein6_addr;DEBUGMODEoff → allDebug(...)no-ops (the leadinginet_ntopintoipv6stringis insideDebug(...)→ not evaluated).mysk(P7s de-static'd) is the outbound-bind source;minus_onethe all-0xffsentinel. - FINDING (faithful) —
connect_server's DNS-resolution block (s_bsd.c:2538-2558, guarded byif (!aconf->ipnum.S_ADDR && *aconf->host != '/')) is dead code under AF_INET6.S_ADDR=s6_addr, an embedded array;!aconf->ipnum.s6_addris the address of that array → always non-NULL → always false. The block never runs (the same!ipnum.s6_addrarray-address quirk noted insend_ping/P7m);hpis used directly. Omitted in the port with a comment. - Faithfulness — the
free_server:goto becomes aconnect_server_free(cptr)helper returning -1;SetConnecting=status = STAT_CONNECTING (-4);connect_inet'sstatic struct SOCKADDR serveris a modulestatic mut MaybeUninit<sockaddr_in6>(bzero'd every call, the Cstaticsemantics); the dup-IP scan compares network-orderserver.sin6_portto the host-orderacptr->port(a faithful C quirk);index→strchr(unused — DNS block dead),htons→u16::to_be.dummy(P7a) is theSIGALRMhandler. - Callees —
find_server(P4),make_client/make_server/free_client/free_server/add_fd/add_client_to_list(P2),attach_confs_host/find_conf_host/det_confs_butmask(P6),get_sockhost/get_client_name(P5),set_non_blocking(P7d),set_sock_opts(P7p twin),inetpton(P1) all Rust; the variadicsendto_flag/sendto_oneare called (→ P8).mysk/minus_one/portnum/highest_fd/local/fdall/nextping/timeofday/istat/meare bindgen statics. - Classification / L1 — utility/callee TU (not a
msgtabhandler; reached fromm_connect/try_connections/do_dns_async).cref_connect_serverexported → cross-world differential (ircd-testkit/tests/connect_server_diff.rs, 3 cases zero-diff). The success path does a livesocket/bind/connectto a configured peer → not deterministic at L1. Cases: (1)server_already_present—find_serverhit →SCH_NOTICE+ return -1 before anymake_client/socket work (by=NULL); (2)server_already_present_remote_by— remoteIsPersonby(fd<0 →!MyClient) so the extrasendto_one(by,...)arm fires; (3 inverse/cleanup)connect_inet_failure_refused— empty hash →make_client/make_server→connect_inetsocket+bind(unconfigured zeroedmysk→ AF_UNSPEC) fails →return NULL→free_servercleanup → -1; assertshighest_fdunchanged + the hash left clean. Per-worldinithashtables()(elsehashtabis NULL → segv); serialized onGLOBALS_LOCK(the [[p7-l1-shared-global-race]] hazard). Findings:hash_find_server's suffix-mask search overwrites'.'→'*'in-place → the conf/lookup strings must be writable heap (notc"…"literals); a remotebyneedsacptset (self) orsend_messagenull-derefs(*to).acpt. - L2 / S2S — no new file. The existing
ircd-golden/boot_s2sharness dials into the ircd (TcpStream::connect= inboundadd_connection), so it does not exerciseconnect_server's outbound dial; deferred to the event-loop/CONNECT L2 (theread_messagecluster). Regression check:golden_registration+golden_s2s_linkbyte-identical (the port doesn't touch inbound paths). No remote-user field formatting → no S2S-specific path.
- Cluster choice — the next leaf bottom-up after the P7d–P7bb socket/teardown/listener/access-check leaves.
-
2026-06-06 — P7dd (
s_bsd.cstart_iauth) merged. The iauth subprocess (re)spawn leaf (s_bsd.c:565) — the deepest remaining leaf ins_bsd.c's boot subtree (daemonizecalls it;read_messageis the loop top). Ported toircd-common/src/s_bsd.rs; guard-DPORT_S_BSD_START_IAUTH_P7ddon thes_bsd_link.orecipe.- Cluster choice — after P7d–P7cc ported every socket/teardown/listener/access-check/connection leaf, the three C functions left in
s_bsd.carestart_iauth,daemonize, andread_message(+ itsstaticsiblingspolludp/check_ping).daemonizecallsstart_iauthandread_messageis the loop top, sostart_iauthis the next leaf bottom-up. It is the only function that creates theadfdpipe the P7u–P7ys_auth.creaders drain. - Classification — utility/callee TU (no
msgtabentry). Callers:daemonize(boot),io_loop(therestart_iauth/nextiarestarttimer, ircd.c:1286),rehash(start_iauth(2)= kill-first, s_conf.c:1303),s_auth.cread_iauthrestart requests. All reach it vias_bsd_ext.h. L1 is the differential gate (extern→cref_start_iauthoracle). - Config-resolved body —
USE_IAUTHon → the whole#if defined(USE_IAUTH)body compiles;IAUTH_BUFFER = 65535;MAXCONNECTIONS = 50(the child fd-close bound).IAUTH_PATH(=$(server_bin_dir)/$(IAUTH)) andIAUTHare recursively-expanded Makefile vars passed only ons_bsd.o's compile line (absent from bindgen) → build.rs expands both viamakeand hands them to the crate asircd_sys::IAUTH_PATH/ircd_sys::IAUTH(thePID_PATH/MOTD_PATHprecedent), so the Rustexeclspawns the identical binary as reference-C. - Faithfulness — the three function
statics (last/first/iauth_pid) → module-privatestatic mut START_IAUTH_*; both worlds startfirst = 1so the burst-send block is skipped on the first call.vfork()→libc::fork(): behaviorally identical here (the child only runs a close loop +dup2+execl, so COWforkproduces the same result) and Rust's libc deprecatesvforkas memory-unsafe (the close-loop/dup2-between-vfork-and-exec is exactly the flagged pattern). The socketpair-failure arm does NOT early-return (faithful). The burst-send pointer arithmetic (s += sprintf(s, "%d O\n", i), thes > eflush, the*(s-1) = '\0'newline-strip) is translated byte-for-byte over a[c_char; BUFSIZ](libc::BUFSIZ= 8192 on gnu, matching the C<stdio.h>macro).execlCStrings are built beforefork. - Callees —
read_iauth(P7y),set_non_blocking(P7d) Rust;sendto_flag/sendto_iauthare called (variadic → P8);socketpair/setsockopt/fork/dup2/execl/close/kill/_exit/timeare libc.adfd/iauth_spawn/bootopt/highest_fd/localare bindgen globals. - L1 —
ircd-testkit/tests/start_iauth_diff.rs, 3 cases zero-diff vscref_, serialized onGLOBALS_LOCK(the [[p7-l1-shared-global-race]] hazard; each world keeps its ownadfd/iauth_spawn/bootopt).boot_noiauth_returns:BOOT_NOIAUTH→ immediate return,adfdstays -1,iauth_spawnunchanged.already_running_returns: not-NOIAUTH butadfd>=0,rcvdsig=0→ returns untouched (the inverse).spawn_sets_adfd: the real meat — the socketpair + setsockopt +set_non_blocking+ fork prefix; asserts the observable post-state agrees across worlds and the spawn happened (adfdopened nonblocking viafcntl F_GETFL & O_NONBLOCK,iauth_spawn == 1); the childexecls the absentIAUTH_PATHand_exits, reaped via a boundedwaitpid(WNOHANG)loop so the test can never hang. The non-first-call burst is skipped (bothfirst = 1) → its differential coverage is deferred to L2/soak (needs a populatedlocal[]+ a second post-firstcall). - L2 / S2S — no new file. The golden harness boots
-t -s(BOOT_NOIAUTH) → onlystart_iauth's early return runs (golden_registrationbyte-identical); the full spawn is a process-lifecycle side effect whose end-to-end gate is the P7-exit L2/soak run with iauth enabled, as fordaemonize/server_reboot. NoIsServer(cptr)branch / no remote-user field formatting → no S2S path.
- Cluster choice — after P7d–P7cc ported every socket/teardown/listener/access-check/connection leaf, the three C functions left in
-
2026-06-06 — P7ee (
s_bsd.cdaemonize) merged. Ported the boot detach gluedaemonize(s_bsd.c:794), the layer directly above the P7ddstart_iauth.- Cluster choice. Called once from
ircd.c:1152(still C → resolves to the Rust def once dropped). Now a clean leaf: its only non-libc callees —init_resolver(P6, Rust) andstart_iauth(P7dd, Rust) — are already ported. With it gone, the only still-C logic ins_bsd.cis the event loop (read_message+ its staticspolludp/check_ping). - Guard / seam. Partial port via the existing
s_bsd_link.orecipe, new guard-DPORT_S_BSD_DAEMONIZE_P7ee; the C body#ifndef-guarded (no#elseproto —daemonizeis declared ins_bsd_ext.h). - Config-resolved body.
TIOCNOTTYdefined on Linux → theint fd+ ioctl block compiles. Thesetpgrparm resolves to the#elsesetpgrp(0, getpid())branch (verified by preprocessing — none ofHPUX/SVR4/DYNIXPTX/_POSIX_SOURCE/SGI/__CYGWIN32__/__APPLE__are defined); the linked glibc symbol issetpgrp(void)(ignores the args) — declared 2-arg in a local extern to mirror the source verbatim.stdout/stderr/stdinare glibcextern FILE *symbols (not the macros) → local externs (stderrreuses the module-top decl).init_resolvercalled ascrate::res::init_resolver;start_iauthis the local Rust def in this module (called bare, not imported, to avoid shadowing the bindgen decl). - Faithfulness.
bootopt & BOOT_TTY→ short-circuit toinit_dgram(no fork/no fd close); elsefclose(stdout)/close(1), (unlessBOOT_DEBUG)fclose(stderr)/close(2), and when((bootopt & BOOT_CONSOLE) || isatty(0)) && !(bootopt & BOOT_INETD)→fork()(the parentexit(0)s to detach),open("/dev/tty")+ioctl(TIOCNOTTY)+close,setpgrp(0, getpid()),fclose(stdin)/close(0); then alwaysresfd = init_resolver(0x1f)+start_iauth(0). - Classification / L1. Utility/boot callee (no
msgtabentry). Mostly untestable by design: the detach path forks (parentexit(0)s) and closes fds 0/1/2 — calling it on that path destroys the test harness, and even fork-isolation (P7r's trick) can't measure a function whose whole job is to detach. The only differentially-safe path is theBOOT_TTYshort-circuit (goto init_dgram: no fork, no fd close) — which is also the only path any harness ever takes (golden boots-t=BOOT_TTY).daemonize_diff.rs(1 case):bootopt = cref_bootopt = BOOT_TTY|BOOT_NOIAUTH,adfd=-1,resfd=-99sentinel → call each world'sdaemonize→ assertresfd != -99and>= 0(init_resolver opened the resolver socket),(resfd>=0)==(cref_resfd>=0)(both worlds succeeded identically), and the inverse:adfd == -1in both (start_iauth(0)reached but short-circuited onBOOT_NOIAUTH, touching nothing). Serialized onGLOBALS_LOCK; the opened resolver sockets are closed afterward. Untested-by-design: the entire detach path (fclose/closeof 0/1/2,fork+parentexit,TIOCNOTTYioctl,setpgrp). - L2 / S2S. No new L2 (boot callee, not a
msgtabhandler — the existing golden suite boots through theBOOT_TTYpath ofdaemonize;golden_registrationbyte-identical, confirmed). No S2S (formats no remote-user wire fields).
- Cluster choice. Called once from
-
2026-06-06 — P7ff (
s_bsd.cread_message+ 8 statics — the event loop) merged. Ported the select/poll event loopread_message(s_bsd.c:2088) and its eight file-statichelpers toircd-common/src/s_bsd.rs; guard-DPORT_S_BSD_READ_MESSAGE_P7ffon thes_bsd_link.orecipe. This is the body ofio_loopand the last logic ins_bsd.c— after it,s_bsd_link.odefines zero functions, only the data globals.- Cluster choice —
read_messageis the only non-staticsymbol left ins_bsd_link.o; its calleescompleted_connection(s_bsd.c:1247),read_listener(1835),read_packet(2004),client_packet(1938),ircd_no_fakelag(1930),do_dns_async(3324),polludp(3212),check_ping(3165) are allstatic(nocref_oracle) → one connected component, ported together as module-private Rust twins (thecheck_init/set_sock_opts/connect_inet/check_clonesprecedent). - Config-resolved body —
USE_POLLoff → theselect()/fd_set/FD_*/highfdpath compiles; the entire#if defined(USE_POLL)pfd machinery is dead and omitted.USE_IAUTHon (theDoingXAuth/WaitingXAuth/adfd/read_iauth/sendto_iautharms + do_dns_async's iauth alias-forward block).LISTENER_DELAY= 1 (the listener once-per-second throttle),LISTENER_MAXACCEPT= 10,MAXCLIENTS= 45,CLIENT_FLOOD= 1000,HELLO_MSG/IRC_VERSIONresolved as module consts.ZIP_LINKS/UNIXPORT/DEBUGMODEoff,DELAY_CLOSE/CACCEPT_DELAYED_CLOSEon,JAPANESEoff,AFINET=AF_INET6. - Faithfulness —
highfd/delay2/retdeclared before thefor(res=0;;)select-retry loop (persist across retries, never reset — the faithful C quirk). Theread_messageper-fd dispatchgoto deadsocketbecomes adead: bool+ structuredcontinues (both goto sites setdead, the deadsocket block runs once).while(max--)inread_listener→ a{ let cur = max; max -= 1; cur != 0 }head.client_packet's inner long-no-newlinewhile(dolen<=0)drain +FLAGS_NONLbreak preserved.check_ping'scp->ping = (cp->rtt /= cp->lrecvd)order kept;powis the libc symbol (NOTf64::powf— last-ULP drift, the P7t precedent).polludp'sntohl/htonlover theu_long pi_idtruncate to 32 bits then byteswap (u32::from_be/to_be as u_long); the#if 0recvfrom-error report and the functionstaticslast/cnt/mlen/lasterr→ modulestatic mut.do_dns_async'sstatic Link ln→ a modulestatic mut DO_DNS_LN(const-initialised union) so the address handed toget_resis stable;hp->h_addrmacro =h_addr_list[0]. The privatestatic char readbuf[READBUF_SIZE](16384) → a modulestatic mut READBUF. - Callees — in-module Rust:
add_connection(P7bb),connect_server(P7cc),delay_close(P7f),report_error(P7q),get_sockerr(P7d). bindgen externs (resolve to Rust at link):dopacket(P7b),exit_client/get_client_name(P5),send_queued/flush_connections(P3/send),start_auth/read_iauth/send_authports/read_authports(P7w-y),find_conf/is_allowed(P6),match_/inetntop(P1),dbuf_get/getmsg/put(P1),get_res/del_queries/find_bounce/my_name_for_link,restart. Variadic (called, → P8):sendto_flag/sendto_one/sendto_iauth. The data globalslocal[]/highest_fd/timeofday/fdas/fdall/readcalls/udpfd/resfd/adfd/ircstp/istat/iconf/conf/nextping/nextdelayclose/ipv6string/meare bindgen statics (still C-owned ins_bsd_link.o). - Classification — utility/boot callee (no
msgtabentry; reached fromio_loop).read_messagehas acref_oracle but is the event loop — every meaningful pathselect()s real fds,accept()s/recvfrom()s/send()s real sockets, and destructivelyexit_clients, none of which is differentially deterministic in isolation (thedaemonize/P7ee situation). L2 is the real gate. - L1 —
ircd-testkit/tests/read_message_diff.rs, 2 cases zero-diff vscref_, serialized onGLOBALS_LOCK(the [[p7-l1-shared-global-race]] hazard;udpfd/resfd/adfdare process globals). The one differentially-safe path: an emptyFdAry(highest = -1) +udpfd = resfd = adfd = -1+delay = 0→ an empty fd_set,select(0, …, 200ms)returns 0, no dispatch, return 0; both worlds agree (ro = 0andro = 1). Proves the loop skeleton + theselectcall + the no-fds-ready dispatch are byte-identical. - L2 / S2S — no new file. The entire
ircd-goldengolden_*+golden_s2s_*suite (111 test files) runs throughread_message(it isio_loop's body) — registration, every channel/user/oper command, and the full S2S server-burst/netsplit matrix exercise the accept/read/write/exit + server-linkread_packet/completed_connectionpaths end-to-end. Ran the full 111-file suite with--no-fail-fast: 192 passed, 2 failed, both pre-existing reference-C STATS garbage flakes ([[p5-s2s-stats-flake]]), not P7ff regressions (the reference-C binary is frozen — a Rust edit can't change its output; the Rust side prints the correct value in both): (1)golden_s2s_s_serv_statss2s_stats_match_reference— uninitialised peer-burst sendq (…965524992kB sqvs Rust0kB sq); (2)golden_s_miscstats_t_matches_reference— STATS t's "dropped %luSq/%luYg/%luFl" printsircstp->is_cklQ/is_ckly/is_cklno(u_int, 4 bytes) with%lu(8 bytes) in the still-C variadicsendto_one, so reference-Cva_args 4 bytes of call-frame garbage (281470681743360Sq/…) vs Rust0Sq/0Yg/0Fl— a%lu/u_intwidth-mismatch in s_misc.c:1079, surfaced (not caused) by P7ff. - Untested-by-design (noted) — the destructive accept/read/write/exit dispatch,
polludp/check_ping(need a live UDP CPING peer), anddo_dns_async(needs a live resolver fd) are deterministic only at L2/soak.
- Cluster choice —
-
2026-06-06 — P7gg (
ircd.ctry_connections, auto-connect timer) merged. Ported the staticio_loopAC timer (ircd.c:226) toircd-common/src/ircd.rs, the sibling ofcalculate_preference(P7t).- Cluster choice —
try_connectionsis the nextio_looptimer helper aftercalculate_preference. Each AC tick it walks the globalconflist, folds the lowest futureholdintonext, and chooses the single best AC-ableconnect{}C-line to dial: candidate = status carriesCONF_CONNECT_SERVER|CONF_ZCONNECT_SERVER,port > 0, classmaxLinks != 0; skipped if future-held / atmaxLinks/ already linked (find_name/find_mask) / denied (find_denied); best by (lowerpref >= 0, else higher class number). The winner is spliced to the list tail (round-robin), itsholdpenalised by anothercon_freq, then deferred (AC disabled) or dialed viaconnect_server(P7cc). Returns the next-call time (0= nothing pending);BOOT_STANDALONE→0. - Guard / de-static —
try_connectionsisstatic→ nocref_oracle symbol. De-static'd in ircd.c under#ifndef PORT_IRCD_TRY_CONNECTIONS_P7gg(themysk/check_init/connect_inetprecedent) so the cref archive's prefix-rename exportscref_try_connections; the#elsebranch is anextern time_t try_connections(time_t)prototype so the still-Cio_loopcaller (ircd.c:1186) keeps a declaration.-DPORT_IRCD_TRY_CONNECTIONS_P7ggadded to theircd_link.omake rule (alongside the P7c/P7t defines). The fullircd.o(cref oracle, no PORT define) keeps the non-static body. - Config-resolved body —
DISABLE_DOUBLE_CONNECTSundef → the wholefor (i=highest_fd…)duplicate-IP scan +SCH_SERVER"AC postponed" notice block is dead (dropped);DEBUGMODEoff → everyDebug((…))no-op. - Faithfulness — the tail-splice replicates the C
for (pconf=&conf; (aconf=*pconf); pconf=&(aconf->next))walk exactly: theif (aconf==con_conf) *pconf=aconf->next;removal does NOT short-circuit the pointer advance, and the detached node's ownnextis left intact so the walk still reaches the real tail through it. Macros inlined:Class(x)=x->class,MaxLinks(x)=x->maxLinks,Links(x)=x->links,ConfClass(x)=x->class->class,get_con_freq(Rust P2).DELAYCHASETIMELIMIT=1800. The variadicsendto_flagis called via the module's localextern "C"block (→ P8);connect_server(P7cc)/find_name/find_mask(P4)/find_denied(P6) resolve through the link seam. - Classification —
io_loopcallee (nomsgtabentry), reached only from the periodic AC recompute; formats no remote-user wire fields. - L1 —
try_connections_diff.rs, 8-case zero-diff vscref_try_connectionsover two isolated conf worlds (Rustconf/iconf/bootoptvs thecref_copies), serialized onGLOBALS_LOCK(the documented P7 shared-global hazard). Covers every path that does NOT reachconnect_server:BOOT_STANDALONEearly return, empty conf, all skip-continues (non-C-line,port<=0,maxLinks==0, future-held, class-full-before-hold-write, already-linked, denied), and — by pinningiconf.aconnect=0— the best-conf selection, the tail-splice (winner moved to list end), thehold += get_con_freqpenalty, and the "administratively disabled" deferred-notice branch. Compares per-confhold/pref+ the resulting list order (by build index) + the return value. Two initial expectation bugs in the test (wrongBOOT_STANDALONEliteral; assuming the class-full skip writeshold) were caught because the Rust↔oracle diff stayed green while the absolute-value asserts failed — fixed the expectations, port unchanged. - L2 — the
connect_server-reached dial is L2-only: theircd-golden/S2S harness dials into the ircd and never auto-connects out (the P7cc precedent), so the outbound AC dial is deferred to the event-loop/CONNECT L2.golden_registrationconfirmed byte-identical (boot/event-loop path unaffected). No S2S (no remote-field formatting).
- Cluster choice —
-
2026-06-06 — P7hh (
ircd.ccheck_pings— the io_loop ping/timeout sweep) merged. Ported the staticio_looptimer helpercheck_pings(ircd.c:525) toircd-common/src/ircd.rs, the sibling oftry_connections(P7gg) andcalculate_preference(P7t). The nextio_loopcallee after the AC timer; one of the two remaining loop helpers (delayed_killsis next).- Cluster choice / Scope. Called once per loop tick from
io_loop(ircd.c:1277) whentimeofday >= nextping. Walkslocal[highest_fd..0]; per non-listener local connection: pings idle registered links (FLAGS_PINGSENTstate machine), times out unregistered/unresponsive ones (exit_client; servers/connecting/handshake get a "No response … closing link" notice, with a remote-oper NOTICE viabysptr; DNS/auth/xauth waiters either get an iauth extension (%d d/%d T) or are reset/exited), and folds the soonest next-check calendar time intooldest(the return), with the+PINGFREQUENCY/+30clamps. - Guard / de-static.
check_pingsisstatic→ nocref_oracle symbol. De-static'd in ircd.c under#ifndef PORT_IRCD_CHECK_PINGS_P7hh(thetry_connections/myskprecedent) so the cref archive's prefix-rename exportscref_check_pings; the#elsebranch is anextern time_t check_pings(time_t)proto so the still-Cio_loopcaller keeps a declaration.-DPORT_IRCD_CHECK_PINGS_P7hhadded to theircd_link.omake recipe (alongside the P7c/P7t/P7gg defines). The fullircd.o(cref oracle, no PORT define) keeps the non-static body. - Config-resolved body.
TIMEDKLINESoff (config.h:207 commented) → thestatic time_t lkill, thekflag = find_kill(...)block, theif (kflag && IsPerson)kill-notice arm, and the trailingif (currenttime - lkill > 60)all vanish;kflagis permanently 0 → the goto guard reduces toif (IsRegistered && ping >= now-lasttime), the timeoutifto((idle >= 2*ping && PINGSENT) || (!registered && firsttime-too-old)), and the kill/else collapses to alwaysexit_client(... "Ping timeout").USE_IAUTHon → the iauth extwait/notimeoutsendto_iauthblock compiles.DEBUGMODEoff → everyDebug((...))no-op.ACCEPTTIMEOUT=90,PINGFREQUENCY=120 (plain#defines, inlined as module consts). - Faithfulness. The C forward
goto ping_timeout(recently-active fast path) is modelled by guarding the whole timeout/ping if/else on the negated recently-active condition and falling through to the timeout computation — no control-flow change.bysptris declared once outside the loop and never reset inside (faithful: a server-timeout'sbysptrpersists across later iterations).ME=me.name. Macros inlined as privateunsafe fnhelpers (copied from s_bsd.rs):is_listener/is_registered/is_server/is_connecting/is_handshake/doing_dns/doing_auth/doing_xauth/clear_auth/clear_dns/clear_xauth/clear_wxauth/set_done_xauth/my_connect/me_ptr/local_base. The variadicsendto_one/sendto_iauth/sendto_flagare called via the module's localextern "C"block (→ P8);exit_client/find_uid/get_client_name/del_queriesresolve through the link seam (Rust P5/P6). - Classification.
io_loopcallee (nomsgtabentry), reached only from the periodic ping recompute. The only remote read isbysptr(a remote oper) for a NOTICE on server timeout — a server-link path exercised by the L2/S2S loop, not a client command. → L2-gated, with an L1 over the deterministic non-destructive paths. - L1 —
check_pings_diff.rs, 7-case zero-diff vscref_check_pingsover two isolated worlds (Rustlocal/highest_fd/mevs thecref_copies), each building its own parallel client set, serialized onGLOBALS_LOCK(the documented P7 shared-global hazard). Covers every path that does NOT reachexit_clientor the server-timeoutfind_uid/sendto_one: emptylocal[](oldest stays 0 →now+PINGFREQUENCY), listener-skip (FLAGS_LISTEN), recently-active registered (ping >= now-lasttime→ goto, no ping, flags untouched), theFLAGS_PINGSENTping-send branch (idle 121 > ping 120, below 2ping → setsFLAGS_PINGSENT+ rewriteslasttime = now-ping+ sends PING — the inverse of recently-active), young unregistered (firsttime < ACCEPTTIMEOUT, left alone), already-pinged idle below 2ping (folds oldest only), and a mixed multi-fd sweep (listener + recent + idle-pinged + young-unreg) exercising the oldest-fold + final clamps. Asserts each client's post-(flags,lasttime)+ the return value identical. Finding: a freshcalloc'd client needsacptset (realmake_clientsets it to the listener) orsend_message'sacpt != &mesendM bump null-derefs;fd = -1+ a sub-1024-byte PING never tripssend_queuedso there is no real socket write. - L2 — no new file. The entire
ircd-goldensuite runscheck_pingseveryio_looptick (it is the registration-timeout + ping path).golden_registration(boot/loop/timeout) andgolden_channel_joinbyte-identical; the only failure is the documented pre-existinggolden_s_miscstats_treference-C garbage flake ([[p5-s2s-stats-flake]] / P7ff) — a%lu/u_intwidth mismatch in the still-C variadicsendto_one(281470681743360Sqfromva_arg'd call-frame garbage in the frozen reference-C binary vs the correct0Sq/0Yg/0Flfrom Rust), surfaced not caused. No S2S (no command-driven remote-field formatting).
- Cluster choice / Scope. Called once per loop tick from
-
2026-06-06 — P7ii (
ircd.cdelayed_kills— the io_loop K-line sweep) merged. Ported the staticio_looptimer helperdelayed_kills(ircd.c:447) toircd-common/src/ircd.rs, the sibling ofcheck_pings(P7hh). The other of the two remaining loop helpers;io_loopcalls it (ircd.c:1294,rehashed = delayed_kills(timeofday)) only whilerehashed > 0— i.e. after a rehash queues a K-line re-evaluation.- Cluster choice / Scope. Walks
local[dk_lastfd..j](a batch of at mostMAXDELAYEDKILLS); for every local fully-registered person it runsfind_kill, and on a match (kflag == -1) notices the oper channel (sendto_flag "Kill line active for %s"), stampscptr->exitc = EXITC_KLINE, andexit_clients the connection with the kill reason. Returns 1 if work remains queued (incomplete batch, orrehashed == 2— a rehash arrived mid-sweep), else 0. Persistent function-local statics (dk_rehashed/dk_lastfd/dk_checked/dk_killed) carry the batch cursor across calls;dk_rehashed == 0re-arms the sweep fromhighest_fd. - Guard / de-static.
delayed_killsisstatic→ nocref_oracle symbol. De-static'd in ircd.c under#ifndef PORT_IRCD_DELAYED_KILLS_P7ii(thecheck_pings/try_connections/myskprecedent) so the cref archive's prefix-rename exportscref_delayed_kills; the#elsebranch is anextern int delayed_kills(time_t)proto so the still-Cio_loopcaller keeps a declaration.-DPORT_IRCD_DELAYED_KILLS_P7iiadded to theircd_link.omake recipe (alongside the P7c/P7t/P7gg/P7hh defines). The fullircd.o(cref oracle, no PORT define) keeps the non-static body. - Config-resolved body.
MAXDELAYEDKILLS= 200 (config.h:423) andMAXCONNECTIONS= 50 (config.h:150): the#ifdef MAXDELAYEDKILLSbatch block IS compiled, butj = dk_lastfd - 199withdk_lastfd ≤ 49is always < 0 → clamped to 0, so the wholelocal[]is swept in a single call anddk_lastfdalways reaches -1 → the persistent statics reset every call (no multi-call drain) and the trailingreturn rehashed(incomplete-batch path) is unreachable under the locked config — ported faithfully regardless.TIMEDKLINESoff →find_kill'stimedklinesarg is 0 (thecheck_pingsfinding);DEBUGMODEoff → theDebug((DEBUG_DEBUG, "DelayedKills killed…"))no-op. - Faithfulness. The C
for (i = dk_lastfd; i >= j; i--)with itscontinue(which still runsi--) and in-loopj--(on a NULL/non-person slot, only whilej > 0) is modelled by awhile i >= jloop that decrementsibefore everycontinue/iteration end, so the post-loopdk_lastfd = ilands onj-1identically.IsPerson=user && (STAT_CLIENT || STAT_OPER)andBadPtrinlined as privateunsafe fnhelpers. The summarysendto_flag(SCH_NOTICE, "DelayedKills checked %d killed %d in %d sec", dk_checked, dk_killed, currenttime - dk_rehashed)passes atime_t(long) to a%d— a faithful C quirk, passed verbatim (the variadic trampoline reads 32 bits; a no-op until the notice channel exists). The variadicsendto_flagis called (→ P8);find_kill(Rust P6i)/get_client_name/exit_clientresolve through the link seam. - Classification.
io_loopcallee (nomsgtabentry), reached only after a rehash queues K-line re-evaluation (rehashed > 0). → L1-gated: the kill arm is destructive (exit_client) AND requires both a matching K-line conf andrehashed > 0, neither of which the golden suite produces — so unlikecheck_pings,delayed_kills' body has no L2 path at all (golden never rehashes). - L1 —
delayed_kills_diff.rs, 6-case zero-diff vscref_delayed_killsover two isolated worlds (Rustlocal/highest_fd/rehashed+ emptykconf/tkconf→find_killreturns 0, no kill, vs thecref_copies), serialized onGLOBALS_LOCK(the documented P7 shared-global hazard). Covers the non-kill sweep (the inverse of the destructive kill arm): emptylocal[]acrossrehashed∈ {0,1,2} (→ return {0,0,1} — exercises the requeue logic), anIsPersonclient over empty conf (checked, no kill → completes, client left alive: status/flags unchanged + still inlocal[]), non-person (nouser) + userless STAT_CLIENT slots (both!IsPerson→ skipped beforefind_kill), and a mixed multi-fd sweep. Asserts identical return + per-client(status, flags, still-in-local). Awith_userclient gets a zeroedanUser(username "") sofind_killwalks the empty conf and returns 0. - Untested-by-design / L2 — the
kflag == -1kill arm (exit_clientis destructive — thecheck_pings/read_messageL2-gating precedent — and needs both a K-line conf match and a queued rehash). No new L2 file:golden_registrationconfirmed byte-identical (no-regression; the boot/event-loop path is unaffected anddelayed_killsis never entered without a rehash). No S2S (formats no command-driven remote-user wire fields).
- Cluster choice / Scope. Walks
-
2026-06-06 — P7jj (
ircd.csetup_me) merged. Ported the boot-timeme-singleton initializer toircd-common/src/ircd.rs, the last substantive non-spine leaf inircd.c.- Cluster choice —
setup_me(ircd.c:723) is the boot helpermain()calls once (ircd.c:1113) afterbzero(&me)+make_server(&me)+ config read have populatedme.serv->namebuf(server name;make_serverself-pointsme.name → serv->namebuf),me.serv->sid,me.info. The remainingircd.cleaves aresetup_signals(blocked on the still-static signal handlerss_rehash/s_slave),bad_command(exit, untestable),open_debugfile(empty under DEBUGMODE-off) —setup_meis the only one with real, L2-observable logic. - Seam / Guard —
#ifndef PORT_IRCD_SETUP_ME_P7jjaround the body,staticremoved,extern void setup_me(aClient *mp);after#endifso the guardedircd_link.o'smain()resolves the call to the Rust#[no_mangle] setup_me(the cref oracle keeps the full unguardedircd.o).-DPORT_IRCD_SETUP_ME_P7jjappended to theircd_link.omake recipe. Confirmednm target/debug/ircdshowsT setup_me(from Rust). - Faithfulness —
getpwuid(getuid())->pw_name(or"unknown") feeds bothusernamecopies;me.info == DefInfocompares the globalme.infopointer (viaaddr_of_mut!(me)) against theDefInfoconstant (list.c);ME=me.name;SetMe=status=STAT_ME,SetEOB=flags|=FLAGS_EOB;strncpyzt(local macro twin) +strcpy(user->host, mp->name)use the exact bindgen array lengths;PATCHLEVELresolved to the lockedpatchlevel.hliteral"0211030000". No variadic senders called. - Callees —
get_my_name(P7s),find_server_num/find_server_string(P5 s_serv),make_user(P2 list),add_to_client_hash_table/add_to_sid_hash_table(P2 hash),setup_server_channels(P5 channel),mystrdup(P1) — all Rust, imported fromircd_sys::bindings. - Classification / L2-gated (no L1) — not a
msgtabhandler.setup_memutates four shared process-global tables (client hash, SID hash,server_name[]interning, channel hash) plus themesingleton andistat; an L1 differential on the real Rust-side globals can't be isolated/cleaned without leaking channel-hash entries into otherircd-commonL1 tests. Its entire output is observable on everyircd-goldenboot (server name in numerics, SID, 004/005, LUSERSis_users, oper+EOB status, server channels,verstr/infoin the S2S burst), so the golden suite is the gate (P7dd/ee/ff L2-gating precedent). - L2 — golden
registration(x2),s_serv_lusers,s2s_server(introduce),s2s_s_serv_info,s2s_s_serv_map, and 3/4s_miscall byte-identical. Thes_misc::stats_tfailure is the documented pre-existing reference-C uninitialized-garbage flake (...743360Sq/...452800Yg/...on the reference side; Rust correctly emits0Sq/0Yg/0Fl) — see the p5-s2s-stats-flake note, not a regression. - S2S — none needed:
setup_meformats no command-driven remote-user wire fields.
- Cluster choice —
-
2026-06-06 — P7kk (
ircd.csignal-handler + reboot cluster) merged. Ported the contiguous signal blockircd.c:73–215— the SIGTERM/SIGUSR1/SIGHUP/SIGINT handlers (s_die/s_slave/s_rehash/s_restart) plus therestart→server_rebootshutdown path — toircd-common/src/ircd.rs.- Cluster choice — a connected component: the four signal handlers set the io_loop flags (
dorehash/dorestart/restart_iauth),restart(called by Rustlist.rs/s_bsd.rs/s_serv.rs+ still-Cio_loop) callsserver_reboot. Deliberately excludessetup_signals(the installer — needsdummy+ edits the shared forward-proto line 34; its own sub-phase),io_loop,open_debugfile,bad_command,c_ircd_main. - Seam / Guard — one
#ifndef PORT_IRCD_SIGNALS_P7kkover 73–215; the#elsebranch re-declaress_rehash/s_slave(not inircd_ext.h) so the still-Csetup_signals(line 1370) keeps its prototypes —s_die/s_restart/restart/server_rebootare header-declared.-DPORT_IRCD_SIGNALS_P7kkappended to theircd_link.orecipe; the cref oracle keeps the full unguardedircd.o. Confirmednm target/debug/ircdshowsTfor all six from Rust. - De-static —
dorehash/dorestart/restart_iauth(volatile static int→volatile int): read by the still-Cio_loop, written by the Rust handlers, so one definition must serve both — they stay C-defined inircd_link.o, Rust references them through a localextern "C"block; de-static also yieldscref_dorehash/… for L1.s_rehash/s_slave(+ the line-37 forward proto) de-static'd so the prefix-rename exportscref_s_rehash/cref_s_slave(the L1-cref-static-symbol limit). - Config-resolved body —
POSIX_SIGNALS=1 (thesigactionre-arm in each handler compiles),RETSIGTYPE=void,USE_IAUTHON (s_slave+ the SIGCHLD arm),USE_SYSLOGUNDEF (every syslog/closelog/openlog arm dropped),UNIXPORTUNDEF (s_die's unix-socket unlink loop dropped),DEBUGMODEOFF (Debug()no-ops), not__FreeBSD__.MAXCONNECTIONS=50;SCH_NOTICE=ServerChannels_SCH_NOTICE. - Faithfulness — the
sbrk(0)-sbrk0byte delta is(brk as usize).wrapping_sub(sbrk0 as usize) as u32fed to the variadic%u;s_diebroadcasts:%s SDIEviasendto_serv_vwith(*me.serv).sid;restart/server_rebootnotice viasendto_flag(SCH_NOTICE,…);s_restart'sBOOT_TTY→fprintf(stderr)+exitarm uses the module'sstderr_ptr()helper; the fd-close sweep isfor i in 3..MAXCONNECTIONS.IRCD_PATH(Makefile var, absent from bindgen) plumbed via build.rscargo:rustc-env=IRCD_SERVER_PATH→ircd_sys::SERVER_PATHforserver_reboot'sexecv(IRCD_PATH, myargv)(the MOTD/PID/IAUTH path precedent). Thefn as usizesigaction-handler casts go through an explicitunsafe extern "C" fn(c_int)pointer (no warning). - Callees —
flush_connections/logfiles_close/mybasename(Rust/P1),ircd_writetune(P7c, Rust), variadicsendto_serv_v/sendto_flag(C trampolines → P8); libcsigaction/sigemptyset/sigaddset/sbrk/close/isatty/execv/exit/fprintf. Globalsme/tunefile/sbrk0/myargv/bootoptfrom bindings; the de-static'd flags from the local extern block. - L1 —
ircd_signals_diff.rs(3 tests):s_rehashratchet 0→1, 1→2, 2→2;s_slavesetsrestart_iauth;s_restartsetsdorestartwithBOOT_TTYcleared — each zero-diff vs thecref_oracle on the respective flag. Serialized onGLOBALS_LOCK(the P7 L1 shared-global hazard); SIGHUP/SIGINT/SIGUSR1 dispositions snapshotted+restored (the handlers re-arm themselves). The terminating arms (s_die/restart/server_rebootexit/execv;s_restart'sBOOT_TTYexit) are not run — faithful by inspection. - L2 — boot gate: the still-C
setup_signalsnow installs the Rust handlers on everyircd-goldenboot;golden_registration(x2),golden_s_serv_shutdown(die/restart/rehash reject +rehash_success— the io_loop reading the de-static'ddorehash),golden_s_serv_maint(die/restart reject) all byte-identical.golden_s_misc::stats_tfails on the documented pre-existing reference-C uninitialized-garbage flake (…743360Sqon the reference side; Rust correctly emits0Sq/0Yg/0Fl) — see the p5-s2s-stats-flake note, not a regression. - S2S — none needed: the signal cluster formats no command-driven remote-user wire fields.
- Cluster choice — a connected component: the four signal handlers set the io_loop flags (
-
2026-06-07 — P7ll (
ircd.csetup_signals— the boot signal installer) merged. Ported the staticsetup_signals(void)(ircd.c:1388) toircd-common/src/ircd.rs. It is the boot-time signal-disposition installermain()calls once (ircd.c:1033, after config read). P7kk deliberately left it to "its own sub-phase" because it referencesdummyand the four signal handlers — all of which are only now Rust, making it a clean leaf.- Cluster choice / Scope. A self-contained installer: builds a
struct sigactionandsigaction()s it onto SIGWINCH/SIGPIPE (SIG_IGN), SIGALRM (dummy), SIGHUP (s_rehash), SIGINT (s_restart), SIGTERM (s_die), SIGUSR1 (s_slave), SIGCHLD (SIG_IGN+SA_NOCLDWAIT). All callees are Rust:dummy(bsd.rs, P7a),s_rehash/s_restart/s_die/s_slave(ircd.rs, P7kk). The remainingircd.cleaves are now onlybad_command(usage→exit, untestable),open_debugfile(empty under DEBUGMODE-off), and thec_ircd_main/io_loopspine. - Guard / de-static.
setup_signalswasstatic(declared in the line-34 groupstatic void open_debugfile(void), setup_signals(void), io_loop(void);) → nocref_oracle symbol. Split it out:open_debugfile/io_loopstay in the static group;setup_signalsbecomes a plainvoid setup_signals(void);forward proto + its body wrapped in#ifndef PORT_IRCD_SETUP_SIGNALS_P7ll(the P7kk/P7jj precedent). The cref archive compiles without the PORT define → keeps the de-static'd body → the prefix-rename exportscref_setup_signals;ircd_link.ocompiles with-DPORT_IRCD_SETUP_SIGNALS_P7ll(appended to the recipe inircd-sys/build.rs) → body removed,main()'s call resolves to the Rust#[no_mangle] setup_signals.nm target/debug/ircdconfirmsT setup_signalsfrom Rust. - Config-resolved body.
POSIX_SIGNALS=1 (setup.h:347) → thesigactionbranch (not thesignal()#else).SIGWINCHdefined on Linux → itssigaddset+sigactioncompile.USE_IAUTHON → the SIGUSR1→s_slavearm + the SIGCHLD arm (withact.sa_flags = SA_NOCLDWAIT, defined on glibc/musl) compile. not__FreeBSD__→ no SIGTRAP arm.RESTARTING_SYSTEMCALLSundef → no trailingsiginterrupt. - Faithfulness. The
sa_maskis cumulative —sigemptysetis called exactly twice (once at the top before the SIG_IGN/dummy trio, once before SIGHUP), so SIGWINCH/SIGPIPE/SIGALRM share mask{PIPE,ALRM,WINCH}and SIGHUP…SIGCHLD accrete{HUP}→{HUP,INT}→{HUP,INT,TERM}→…,USR1}→…,CHLD}. Modelled exactly. The Cstruct sigaction act;leavessa_restoreruninitialised, but glibc supplies its own restorer inside thesigaction(2)wrapper, so the installed (queried-back) disposition is identical in both worlds regardless; Ruststd::mem::zeroed()foractis harmless. Thefn as usizehandler casts go through an explicitunsafe extern "C" fn(c_int)pointer. - Classification. Boot callee (no
msgtabentry), reached once frommain(). → L1 differential + L2 boot gate. Unlike the wholly-terminating handlers (P7kk), the installer is differentially testable: it mutates process signal dispositions, not shared memory, and those snapshot/restore cleanly. - L1 —
setup_signals_diff.rs, 1-case zero-diff vscref_setup_signals, serialized onGLOBALS_LOCK(process-global dispositions; the P7 shared-global hazard). Snapshot all 8 dispositions →setup_signals()(Rust) → query the 8 →cref_setup_signals()→ query the 8 → restore the originals. Asserts, per signal:sa_flagsidentical between worlds,sa_maskbyte-identical (memcmp thesigset_t), and the world-correct handler is wired — SIG_IGN for SIGPIPE/SIGWINCH/SIGCHLD (identical across worlds), else the world's own symbol (Rustdummy/s_rehash/s_restart/s_die/s_slavevscref_dummy/…); handler pointers differ by design (Rust vs cref symbol), the verified claim being "right handler on right signal with the right mask/flags". Plus a SIGCHLDSA_NOCLDWAIT/ SIGWINCH+SIGPIPE flags-0 spot-check. - L2 — no new file. The still-C
main()callssetup_signalson everyircd-goldenboot, installing the Rust handlers;golden_registration(x2),golden_s_serv_shutdown(die/restart reject),golden_s_serv_maint(close/rehash reject +rehash_success— the io_loop reading the handler-setdorehash) all byte-identical = no regression. - S2S — none:
setup_signalsformats no command-driven remote-user wire fields.
- Cluster choice / Scope. A self-contained installer: builds a
-
2026‑06‑07 — P7mm (
ircd.cio_loop) merged. The event-loop body — the per-tick driver that the still-Cmainruns aswhile (1) io_loop();— is now Rust.- Cluster choice —
io_loopis the last substantive piece of I/O-core logic inircd.c; onlyc_ircd_main(the boot/init sequence) and the trivial helpersbad_command/open_debugfileremain C, left for the final P7 drop step that removesc_ircd_mainandircd.o/ircd_link.oentirely. - Seam —
io_loopwasstatic void io_loop(void). Body guarded with#ifndef PORT_IRCD_IO_LOOP_P7mm; under the guard the file-top forward decl is split into astaticproto foropen_debugfile+extern void io_loop(void);so the still-Cmain(inircd_link.o) resolvesio_loop()to the Rust#[no_mangle]symbol.-DPORT_IRCD_IO_LOOP_P7mmappended to theircd_link.orecipe inircd-sys/build.rs. No cref-archive change (io_loop isstatic→ no oracle needed). - Config‑resolved body — locked config:
DELAY_CLOSEOFF (thenextdelayclose/delay_closetimer arm and itsdelay = MIN(nextdelayclose, delay)line dropped),TKLINEON (if (nexttkexpire && timeofday >= nexttkexpire) nexttkexpire = tkline_expire(0);kept),DEBUGMODEOFF (the twoDebug(...)no-ops and the trailingchecklists()dropped).TIMESEC= 60,MIN(a,b)→a.min(b). - Classification — static utility, no
msgtabentry, called only frommain. No L1:io_loopisstaticso the cref archive exports nocref_io_loop(l1-cref-static-symbol-limit). - Faithfulness —
static time_t delay→ a function-locallet mut delay(it is unconditionally assigned before every read each call, so behaviorally identical). Thewhile (maxs--)drain loop preserves the post-decrement semantics. Already-Rust siblings (calculate_preferenceP7t,try_connectionsP7gg,check_pingsP7hh,delayed_killsP7ii,restartP7kk,ircd_writetuneP7c) called directly;tkline_expire/collect_channel_garbage/timeout_query_list/expire_cache/read_message/flush_fdary/start_iauth/flush_connections/rehashand thenext*/fdas/fdallglobals via bindgen;nextpreference/nextiarestart(not in any*_ext.h) via a localextern "C"block — they remain C globals inircd_link.o.&me/&fdas/&fdallviastd::ptr::addr_of_mut!;time(NULL)→libc::time(null);restart("Caught SIGINT")via ac"…"literal cast. - Verify —
cargo build -p ircd-rs0 warnings;nm target/debug/ircd | grep io_loopshows globalT io_loop(Rust, was statict). L2 byte-identical acrossgolden_registration,golden_channel_join,golden_debug(STATS m/u → count_memory/send_usage),golden_s2s_link(link burst + remote WHOIS + remote-quit round-trip) — every booted Rust ircd drives this loop. - Plan —
docs/superpowers/plans/2026-06-07-p7mm-io_loop.md.
- Cluster choice —
-
2026-06-07 — P7nn (
ircd.cCLI boot helpersbad_command+open_debugfile) merged. The last non-spine logic inircd.c— two file-statichelpers called only fromc_ircd_main. Plan:docs/superpowers/plans/2026-06-07-p7nn-ircd-cli-helpers.md.- Cluster choice —
bad_command(ircd.c:809) andopen_debugfile(ircd.c:1372): two independent leaves with no shared state, both reached only from the boot spine (bad_commandon argv-parse failure,open_debugfileunconditionally at boot). Ported together as the penultimate P7 step so the final step isc_ircd_mainalone. - Config-resolved body —
CMDLINE_CONFIGundef →bad_command's[-f config]%sslot ="";DEBUGMODEundef → its[-x loglevel]%sslot =""andopen_debugfile's entire body (#ifdef DEBUGMODE) compiles out → a pure no-opreturn. The Rustbad_commandissues the twolibc::printfs (the format literal with both%sargs =c"") thenlibc::exit(-1);open_debugfileis an empty fn. - Seam — de-static'd both definitions and their prototypes (split
open_debugfileout of the P7mmio_loopstatic-proto group, added a top-of-filevoid bad_command(void);so the still-Cc_ircd_mainkeeps a declaration once the body is guarded out). Both bodies#ifndef PORT_IRCD_CLI_HELPERS_P7nn-guarded; new define added to theircd_link.orecipe inircd-sys/build.rs. The unguarded cref compile keeps the de-static'd bodies →cref_bad_command/cref_open_debugfile. RED confirmed (undefinedbad_command/open_debugfileat link before the Rust defs); GREENnm target/debug/ircdshows bothTfrom Rust. - Classification / L1 — utility/callee helpers (no
msgtabentry).ircd_cli_helpers_diff.rs, 2 cases, zero-diff vscref_, serialized onGLOBALS_LOCK: (1)bad_commandisfork()-isolated per world — child dups stdout into a pipe, calls the fn (prints +exit(-1)), parent drains the pipe +waitpid; asserts captured stdout byte-identical and wait status identical (exit(-1)→WEXITSTATUS==255). (2)open_debugfileno-op contract via the inverse invariant: snapshot fd 2'sfstatdev/ino, call both worlds, assert fd 2 unchanged (DEBUGMODE off → it must NOT redirect stderr). - L2 / S2S —
golden_registrationbyte-identical (open_debugfileno-op on every boot;bad_commandunreachable from a valid boot). No S2S — neither helper formats remote-user wire fields.
- Cluster choice —
-
2026-06-07 — P7oo (
ircd.cc_ircd_main— the boot spine) merged. THE LAST C FUNCTION WITH LOGIC.- Cluster choice —
main(renamedc_ircd_mainvia-Dmain=c_ircd_main; ircd.c:837–1226), the boot spine and the final unguarded C logic in the tree. Every otherircd.cfunction (P7c/P7t/P7gg–P7nn) was already ported leaf-first; this is the spine they hang off. After it,ircd_link.oholds only data globals (me,bootopt, thenext*timers,tunefile,dorehash, …). - Seam —
#[no_mangle] pub unsafe extern "C" fn c_ircd_main(argc, argv) -> c_intinircd-common/src/ircd.rs; guarded out ofircd_link.owith a new-DPORT_IRCD_MAIN_P7oo(single#ifndefover the wholeint main(...){…}body).ircd-rs/src/main.rsis unchanged — it still callsircd_sys::c_ircd_main(the manual extern decl inircd-sys/src/lib.rs), which now resolves to the Rust definition at link. The cref archive keeps the full unguardedircd.o, socref_c_ircd_mainstill exists (un-runnable as an oracle).nm target/debug/ircdshowsT c_ircd_main;nm cbuild/ircd_link.oshows nomain/c_ircd_main, only data globals (bootopt,me,nextping,tunefile, …). - Config-resolved body (verified in
cbuild/config.h) —CHROOTDIRundef → nochdir/chroot/ircd_res_init; the#if !defined(CHROOTDIR)setuid(euid)block compiled.ZIP_LINKSundef → nozlib_versioncheck;-vprints zlib "not used".CMDLINE_CONFIGundef → no-fcase (-f→default→bad_command).USE_SYSLOGundef → noopenlog/syslog.DEBUGMODEundef →Debug()no-ops,-tdoes nosetuid,-xerrors+exit(0), no-t-without--xcheck,open_debugfileno-op (P7nn), banner trailing%s="\n".IRC_UID/IRC_GIDundef → the setuid-root guard compiled, the inner UID/GID block not.USE_IAUTHon → thevfork/execl(IAUTH_PATH,IAUTH,"-X")/waitiauth-presence check compiled.IRCDCONF_DELIMITER='|'reproduced as a literal for the-vbanner. - Faithfulness notes —
me.serv->sidis[c_char; 5](an array): C'sif (!me.serv->sid)compares its address to NULL → always-false dead code; reproduced as a never-taken branch ((*me.serv).sid.as_ptr().is_null(),#[allow(useless_ptr_null_checks)]).configfile/tunefilekeep their C static-initializers (IRCDCONF_PATH/IRCDTUNE_PATH) — Rust reads the globals, never re-inits defaults. Paths via the existingircd_sysconsts (MOTD_PATHforread_motd;IAUTH_PATH/IAUTHfor the iauthexecl).stderrfatal messages via the existingstderr_ptr()+libc::fprintf; banner/-vvialibc::printf. The argv walk is a literal translation of--argc > 0 && (*++argv)[0] == '-'with a raw*mut *mut c_charcursor + short-circuit-preserving control flow.vforkkept (#[allow(deprecated)]) to match C (child immediately execs/_exits).flagsisc_long,aConfItem::statusisu32(cast accordingly). - Classification / L1 / L2 / S2S — boot spine, not a
msgtabhandler. L2-gated, no L1 (forks iauth, daemonizes,loop { io_loop() }never returns, mutates every global table + themesingleton → not unit-testable; the P7mm/P7jj precedent). Verification: the wholeircd-goldenL2 suite boots the Rust ircd through this exact function and stays byte-identical vs reference-C. The lone failure isgolden_s2s_s_serv_stats's STATS "sq" (sendq) field — the documented pre-existing flake (p5-s2s-stats-flake): uninitialized-sendq garbage, non-deterministic (value changes every run). Proven NOT a regression by stashing P7oo and re-running on clean HEAD, where the Rust side shows the same non-deterministic garbage (259171211542528kBvs the P7oo run's3544950…kB). Flag arms beyond-t/-s/-p standalone, the iauthvfork(skipped by-s), the setuid-root guard, and theBOOT_INETDblock are faithful-by-inspection (not reached by golden). No S2S (the function emits no command-driven remote-user wire fields). - → P7 COMPLETE. All C logic is now Rust. The remaining C in
ircd-sysis data globals + the ~25 variadic sender trampolines (sendto_one/sendto_flag/sendto_serv_butone/… insend_link.o,sendto_iauth/vsendto_iauthins_auth_link.o) — deleted in P8 when call sites adopt a non-variadic Rust sender API.
- Cluster choice —