P7 — I/O core + event loop + glue (per-cluster progress)#
One-line summary per cluster. Full entries: docs/progress-log/p7.md.
Phase row + plan: PLAN.md P7; plans under docs/superpowers/plans/.
-
P7a DONE:
common/bsd.c(socket write leaf) — porteddeliver_it(the bottom of the send path:send()+ WOULDBLOCK→0/FLAGS_BLOCKED+sendBaccumulation +-errno) and the re-armingdummysignal stub toircd-common/src/bsd.rs; both portable →bsd.odropped outright (no_link.o). L1 differential (5 cases, full FLAGS_BLOCKED set/clear/untouched matrix) zero-diff vscref_; L2 = existing golden suite (deliver_it is the universal write path) stays byte-identical; no S2S/no new L2 (utility TU). -
P7b DONE:
common/packet.c(inbound packet reassembler) — porteddopacket(the only exported symbol; ZIP_LINKS/DEBUGMODE off → just the plainwhile (length>0 && ch2)line-reassembly loop: CR-or-LF framing,receiveB/receiveMcounter accumulation on me/cptr/acpt with theacpt==&meguard,cptr->countpartial-line carry, BUFSIZE-1 overflow cap, and the parse→FLUSH_BUFFER/IsDead→exit_client/IsServer+UNKCMD return handling) toircd-common/src/packet.rs; all callees already Rust →packet.odropped outright (no_link.o). L1 differential (8 cases: single LF/CR, skipped extra CR-LF, two-lines-one-buffer, partial→continuation round-trip, acpt==&me vs distinct-acpt, 600-byte overflow truncation) zero-diff vscref_; serialized on aGLOBALS_LOCK(sharedme/cref_me). L2 = existing golden suite (universal read path) stays byte-identical (golden_registrationconfirmed); no S2S/no new L2 (utility TU, no IsServer-remote-field formatting). -
P7c DONE:
ircd.ctune-file pair (ircd_writetune/ircd_readtune) — ported the tune-file persistence pair (the 7 sizing globalsww_size/lk_size/_HASHSIZE/_CHANNELHASHSIZE/_SIDSIZE/poolsize/_UIDSIZEserialized one-decimal-per-line viasprintf, parsed back viasscanf, theUSE_HOSTHASH/USE_IPHASHmirrors_HOSTNAMEHASHSIZE/_IPHASHSIZE=_HASHSIZE, theBOOT_BADTUNEsilent-return-vs-exit(1)branch, and thelk_size = max(lk_size, ww_size)clamp) toircd-common/src/ircd.rs. First partial port of the centralircd.c→ircd_link.osecond-compile (-DPORT_IRCD_TUNE_P7c, carrying ircd.o's IRCD*_PATH/IAUTH machine-path defines so the surviving C is byte-identical);c_ircd_main/me/signals/restart/server_reboot/the tune callers stay C. L1 differential (ircd_tune_diff.rs, 9 cases: writetune byte-identical files incl. lk<ww + zero/INT_MAX/u32-max edges, readtune global round-trip incl. clamp + hash mirrors + missing-file + BOOT_BADTUNE silent return, write→read round-trip) zero-diff vscref_, serialized on aGLOBALS_LOCK. No new L2 (utility TU, not amsgtabhandler;ircd_readtuneexercised at boot by the existing golden suite —golden_registrationstays byte-identical); no S2S (no remote-field formatting). Theexit(1)arm is untested-by-design (would kill the test process). -
P7d DONE:
s_bsd.csocket/file utility leaves — first (partial) port of the central I/O TUs_bsd.c; ported the three pure libc-wrapper leaves that touch none of the event-loop data globals:get_sockerr(getsockopt(SO_ERROR)-or-saved-errno),set_non_blocking(fcntl F_GETFL→F_SETFL|O_NONBLOCK; failure path calls the still-Creport_error), andwrite_pidfile(truncate+createIRCDPID_PATH,sprintf("%5d\n", getpid())) toircd-common/src/s_bsd.rs. Partial port vias_bsd_link.o(-DPORT_S_BSD_LEAF_P7d, carrying s_bsd.o'sIRCDPID_PATH/IAUTH_PATH/IAUTHmachine-path defines); the event loop +local[]/highest_fd/timeofday/FdAry+ listeners +add_connection/read_message/report_error/get_my_name/add_local_domain/start_iauthstay C.IRCDPID_PATH(a command-line define, absent from bindgen) exposed to Rust via the P6m make---eval+rustc-envpattern →ircd_sys::PID_PATH. L1 differential (s_bsd_leaves_diff.rs, 4 cases: get_sockerr fd<0 errno-passthrough + valid-fd/no-error, set_non_blocking O_NONBLOCK-set-with-untouched-fd-inverse, write_pidfile identical-behavior) zero-diff vscref_, serialized onGLOBALS_LOCK. No new L2 (utility TU;write_pidfilehit at boot,set_non_blocking/get_sockerron every connect — covered by the existing golden boot/connect path,golden_registrationbyte-identical); no S2S (no remote-field formatting). Untested-by-design: get_sockerr'serr!=0branch + set_non_blocking's fcntl-failure→report_error branch (need a pending-error socket / bad fd); write_pidfile's byte rendering is pinned only whereIRCDPID_PATHis writable (its dir is absent in the sandbox → both worlds no-op identically). -
P7e DONE:
s_bsd.cname-resolution leaf (add_local_domain) — ported the next-easiest s_bsd.c leaf after the P7d socket/file trio:add_local_domain(strip one trailing.+size++; if the name is unqualified, lazilyircd_res_init()when!(options & RES_INIT), then append"." + ircd_res.defdnameiffdefdname[0]andstrlen(defdname)+2 <= size) toircd-common/src/s_bsd.rs. Touches none of the event-loop globals — its only dependency is the resolver state (ircd_res/ircd_res_init), already Rust since P6. Partial port via the existings_bsd_link.oseam with a new guard-DPORT_S_BSD_LEAF_P7e(added alongside-DPORT_S_BSD_LEAF_P7d);get_my_name(its only in-TU caller, needsgethostname/gethostbyname/mysk) stays C. RED confirmed the undefined symbol referenced by the now-Rusts_conf.rs+ still-Cs_bsd.c(get_my_name/connect_server); after GREENnmshowsadd_local_domainasTfrom Rust. L1 differential (add_local_domain_diff.rs, 6 cases: trailing-dot-strip/no-append, unqualified-append, the size-guard boundary len+1-vs-len+2 inverse, empty-defdname-no-append, thesize++-enables-append faithfulness check, and the init-trigger branch via$LOCALDOMAINfor determinism — both worlds run their P6-verified-equivalentircd_res_init) zero-diff vscref_add_local_domain, isolated worlds (Rust reads the realircd_res, oracle readscref_ircd_res), serialized onGLOBALS_LOCK. No new L2 (callee TU, not amsgtabhandler; runs at boot vias_conf.cread_conf + onconnect_server—golden_registrationbyte-identical); no S2S (no remote-field formatting). -
P7f DONE:
s_bsd.cdelayed-close leaf (delay_close) — ported theDELAY_CLOSE-gated (=15)delay_close(s_bsd.c:3359): a private static time-sorted linked list of fds awaiting a delayedclose(), swept per call (expired entries, or — under fd pressure whenis_delayclosewait > (MAXCLIENTS-is_localc)>>1— the oldest quarter;fd==-2fromm_closeforces close-all), thenfd>=0is queued attimeofday+15(withset_non_blocking+shutdown(SHUT_RD)); returns the head entry's scheduled time or 0. Faithful: the unsignedint-u_longthreshold (wraps), thetime<now || tmpdel-- >0short-circuit (tmpdel only decrements when not expired), the 46-byte (43 chars+\r\n+NUL) "Too rapid connections" error sent to the new fd. Sames_bsd_link.oseam, new guard-DPORT_S_BSD_DELAY_CLOSE_P7f; reads the still-Cistat(ircd.c) +timeofday(s_bsd.c) globals, calls the Rustset_non_blocking(P7d) +MyMalloc(P2). L1 differential (delay_close_diff.rs, 6 cases: queue-one + inverse time-eviction, unexpired-stays early-break,fd==-2close-all drain, overflow drop-oldest-quarter, chronological-head ordering) zero-diff vscref_delay_close, isolated worlds (realistat/timeofdayvscref_*), serialized onGLOBALS_LOCK(incl. areset()to drain the persistent static lists between tests). No new L2 (callee, not amsgtabhandler — hit by the io_loopdelay_close(-1)/m_close/connection-close paths;golden_registrationbyte-identical); no S2S (no remote-field formatting). -
P7g DONE:
s_bsd.cfd-teardown leaf (close_client_fd) — ported the descriptor-teardown leafclose_client_fd(s_bsd.c:1270): closesauthfdthenfd(flushing its sendQ first via the Rustflush_connections, removing it fromfdas/fdallvia the Rustdel_fd+ clearinglocal[fd]), then drainssendQ/recvQ(DBufClear→dbuf_delete) and zeroespasswd. Config-resolved:SO_LINGERdefined (the linger blocks compile, fired only whenexitc==EXITC_PING),ZIP_LINKSoff (zip_freeomitted). All real callees already Rust (flush_connectionsP3,del_fdP2,dbuf_deleteP1); onlyreport_errorstays C (already anextern "C"decl since P7d; fires solely on asetsockopt(SO_LINGER)failure). Sames_bsd_link.oseam, new guard-DPORT_S_BSD_CLOSE_FD_P7g; reads the still-Clocal[]/fdas/fdallglobals. L1 differential (close_client_fd_diff.rs, 6 cases: client both-fds, server + listenerIsServer||IsListenerfdas+fdall arm, fd<0 only-authfd-closed, both-fds<0 no-op, and the inverse-of-insert recvQ-drain + passwd-zero) zero-diff vscref_close_client_fd, isolated worlds (reallocal/fdas/fdall+ Rustflush_connections/del_fdvscref_*), serialized onGLOBALS_LOCK; inverse invariants checked (fd actually closed via EBADF,local[fd]==NULL, array slot freed).exitc=0everywhere → theSO_LINGER/report_errorbranches untested-by-design; the sendQ flush-then-clear (live socket I/O) is L2. No new L2 (callee, not amsgtabhandler — hit on every disconnect viaclose_connection/exit_client;golden_registrationincl. quit/reuse byte-identical); no S2S (no remote-field formatting). -
P7h DONE:
s_bsd.cconnection-teardown leaf (close_connection) — ported the bookkeeping layer directly above the P7gclose_client_fd:close_connection(s_bsd.c:1341) bumps the per-classircstpstats (is_sv/is_cl/is_ni+ byte/time accumulators), drops outstanding DNS queries (del_queries), reschedules server reconnect (find_conf_exact→nextconnectwith theHANGONGOODLINK/HANGONRETRYDELAYclamp), schedules a hang-on retry for an aborted handshake/connect, notifies iauth (sendto_iauth "%d D") + decrements the P-line acceptor'sclientsrefcount (recursing intoclose_connection(acpt)when the acceptor itself goes illegal), tears the descriptors down via the Rustclose_client_fd, unlinks an illegal listener fromListenerLL, thendet_confs_butmask(cptr,0)+cptr->from = NULL. Config-resolved:USE_IAUTHON → thesendto_iauthblock compiles; DEBUGMODE off. All callees already resolvable (del_queries/find_conf_exact/det_confs_butmaskRust since P6;sendto_iauththe variadic C trampoline;close_client_fdRust P7g). Sames_bsd_link.oseam, new guard-DPORT_S_BSD_CLOSE_CONN_P7h; reads the still-Circstp/nextconnect/ListenerLL/timeofday/meglobals. L1 differential (close_connection_diff.rs, 6 cases: server/client/unknown stats accounting, handshake+connectingnextconnect = now+30, P-line acceptor refcount 5→4, illegal-listenerListenerLLunlink with the inverse — node gone, head intact,fromNULL, confs detached) zero-diff vscref_close_connection, isolated worlds (realircstp/nextconnect/ListenerLL/local/fdas/fdall/me/istatvscref_*), serialized onGLOBALS_LOCK;me.fd/adfdpinned to -1 (innerflush_connectionselse-branch +sendto_iauthno-op). No new L2 (callee, not amsgtabhandler — hit on every disconnect viaexit_client;golden_registrationincl. quit/reuse byte-identical); no S2S (formats no remote-user fields). Untested-by-design: the recursiveclose_connection(acpt)(needs a fully-illegal acceptor conf) + thefind_conf_exactreconnect-reschedule arm (NULL with no conf loaded) + thesendto_iauthwire emission (L2, variadic trampoline). -
P7i DONE:
s_bsd.clistener-list teardown leaf (close_listeners) — ported the layer directly above P7g/P7h:close_listeners(s_bsd.c:427) walks theListenerLLdoubly-linked list and tears down every listener whose conf has gone illegal (IsIllegal(aconf)) —clients>0→ the Rustclose_client_fd(fd torn, node stays in the list),clients≤0→ the Rustclose_connection(fd torn + node unlinked + confs detached +fromcleared); legal listeners untouched; thebcptr = acptr->nextsave handles the in-loop unlink. UNIXPORT off (config.h:339) → theIsUnixSocket/unlinkblock vanishes; both callees already Rust (P7g/P7h) → no new externs (reuses the existingconf_is_illegalhelper). Sames_bsd_link.oseam, new guard-DPORT_S_BSD_CLOSE_LISTENERS_P7i; the only caller is the now-Rusts_conf.rsrehash (s_conf.c:1315). L1 differential (close_listeners_diff.rs, 5 cases: illegal-clients=0 unlinked, illegal-clients>0 stays-linked inverse, legal untouched (fd still open via fcntl), mixed 3-node middle-removed with the two legals relinked, all-illegal drains the list) zero-diff vscref_close_listeners, isolated worlds, serialized onGLOBALS_LOCK. No new L2 (callee, not amsgtabhandler — hit by rehash;golden_registrationbyte-identical); no S2S (no remote-field formatting). -
P7j DONE:
s_bsd.clistener-reactivation leaf (activate_delayed_listeners) — ported the counterpart to P7i'sclose_listeners:activate_delayed_listeners(s_bsd.c:526) walks theListenerLLlist and, for every listener flaggedFLAGS_LISTENINACTIVE, callslisten(fd, LISTENQUEUE=128), clears the inactive bit, and counts it; if any were reactivated it emits onesendto_flag(SCH_NOTICE, "%d listeners activated", cnt)notice. No#ifdefs (DEBUGMODE off → noDebug);listen()'s return is ignored exactly as C. Sames_bsd_link.oseam, new guard-DPORT_S_BSD_ACTIVATE_DELAYED_P7j; no new still-C externs (sendto_flagis the existing variadic trampoline viaircd_sys::bindings, safe in L1 — short-circuits on NULLsvc_ptr;LISTENQUEUEreproduced as a const since it's absent from bindgen). RED confirmed the undefined symbol referenced by the now-Rusts_serv.rs(m_set/burst) +s_misc.rs(check_split); after GREENnmshows itTfrom Rust. L1 differential (activate_delayed_listeners_diff.rs, 5 cases: single-inactive→activated (inactive bit clear + socket actually listening viaSO_ACCEPTCONN), single-active untouched (inverse), mixed[active,inactive,active]only-middle, empty no-op, all-inactive) zero-diff vscref_activate_delayed_listeners, isolated worlds over real TCP-socket fds, serialized onGLOBALS_LOCK; inverse invariant — listeners never removed, already-active nodes untouched. No new L2 (callee, not amsgtabhandler — hit by server-burst/rehash;golden_registrationbyte-identical); no S2S (formats only an integer count, no remote-user fields). -
P7k DONE:
s_bsd.cadd_connection_refuse(connection-refuse leaf) — ported the refuse-path companion toadd_connection(stays C):DELAY_CLOSEon → thedelay=0reset is not compiled, sodelayis honored verbatim;close(fd)unless delayed,ircstp->is_ref++,acptr->fd = -2, thenfree_client(Rust, P2). Partial-ported vias_bsd_link.o(-DPORT_S_BSD_ADD_CONN_REFUSE_P7k). L1 differential (3 cases: delay==0 closes the fd, delay==1 leaves it open — the inverse pair, two refuses accumulateis_ref) zero-diff vscref_;acptris freed inside the call (UAF post-state) so the test compares side effects (is_refdelta + fd fate), andacptr->fd=-2is untested-by-design (no surviving reader). No L2/no S2S (callee, not amsgtabhandler; formats no remote-user fields). -
P7l DONE:
s_bsd.csetup_ping(UDP CPING-socket setup leaf) — ported the one-shot setup half of the server-to-server CPING feature: bind the single sharedudpfdUDP socket. Idempotent (udpfd != -1→ return it, ignoreaconf); config-resolved (AFINET=AF_INET6→fromis asockaddr_in6, theSIN_*macros map tosin6_*;SETSOCKOPTlength issizeof(int)=4 notsizeof(*p);FNDELAY=O_NONBLOCK; DEBUGMODE/USE_SYSLOG off → noDebug/syslog). Faithful assign-then-test:udpfdset fromsocket()before the==-1check, each later failure doesclose(fd); udpfd=-1. Bind addr from a numericaconf->passwdvia the Rustinetpton(P1, falls back tominus_one=all-0xff) elsein6addr_any. Partial port vias_bsd_link.o(-DPORT_S_BSD_SETUP_PING_P7l);udpfdstays a C global (the still-Cread_message/polludp/check_pingread it) → Rust reads/writes the bindgen extern; the CPING-output siblingssend_ping/check_ping/polludpstay C (shareudpfdonly, which stays C). RED confirmed the undefined symbol referenced by the now-Rusts_conf.rsrehash (s_conf.c:2041); after GREENnmshowssetup_pingTfrom Rust. L1 differential (setup_ping_diff.rs, 3 cases: fresh setup opens a non-blockingSOCK_DGRAMrecorded inudpfd, idempotent second call returns the same fd unchanged — the inverse-of-state path, numeric-passwd"::1"drives theinetptonbind-addr branch) zero-diff vscref_setup_ping, isolated worlds (realudpfdvscref_udpfd), serialized onGLOBALS_LOCKwith areset()closing the prior socket between cases; compares the fd's properties (valid/non-blocking/SOCK_DGRAM) not its integer value (worlds open distinct sockets). No new L2 (callee, not amsgtabhandler — hit bys_conf.rsrehash when aconnect{}block has a port;golden_registrationbyte-identical); no S2S (formats no remote-user fields). Untested-by-design: thesetsockopt/bind/fcntlfailure arms (need an induced syscall failure; both worlds take the success path identically). -
P7m DONE:
s_bsd.csend_ping(UDP CPING-output leaf) — ported the output half of the server-to-server CPING (UDP ping) feature, the sibling to P7l'ssetup_ping: advance the per-connect{}sliding-window RTT statistics on the conf'saCPing(lseq++,seq++-then-conditional---, theseq*conFreq>1200window adjustingping/recvd) andsendtoaPingdatagram (pi_cp/pi_id=htonl(PING_CPING)/pi_seq/pi_tv) over the sharedudpfd. Config-resolved (AFINET=AF_INET6→sinissockaddr_in6;IN6ADDRSZ=16; DEBUGMODE/USE_SYSLOG off → noDebug/syslog;PING_CPING=0x02). Faithful: the C guard's first disjunct!aconf->ipnum.s6_addris an array address → always false, so onlyAND16(ipnum)==255(all-0xff unresolved sentinel) andcp->port==0gate; allaCPingcounters areu_long→ unsigned window arithmetic;cp->lseq++post-increments (the packet carries the old value). Partial port via the existings_bsd_link.oseam, new guard-DPORT_S_BSD_SEND_PING_P7m;udpfdstays a C global (shared with the still-Csetup_ping/polludp), Rust reads the bindgen extern → no new still-C externs (true leaf). L1 differential (send_ping_diff.rs, 7 cases: basic send with packet check, the three early returns — unresolved ipnum/zero port/zero conFreq, window recvd>0/recvd==0/recvd==seq) zero-diff vscref_send_ping, isolated worlds (realudpfdvscref_udpfd) each binding a::1UDP receiver torecvfromthe datagram; compares the deterministicaCPingpost-state + the world-independent packet fields (pi_id/pi_seq), excludingpi_cp(live pointer) +pi_tv(gettimeofday); serialized onGLOBALS_LOCK. No new L2 (callee, not amsgtabhandler — reached from the server-connect CPING path;golden_registrationbyte-identical); no S2S (formats no remote-user wire fields). Untested-by-design:pi_tv/pi_cpnondeterministic; thesendtofailure path is(void)-ignored by C → unobservable. -
P7n DONE:
s_bsd.copen_listener/reopen_listeners(listener (re)construction wrappers) — ported the layer directly above the still-C socket constructorinetport:open_listener(s_bsd.c:467) (re)opens one listener (early-return on!IsListener || fd>0; UNIXPORT off → only the inet branch; a delayed-listen P-line before the first rejoin setsdolisten=0+FLAGS_LISTENINACTIVE; dispatches to the still-Cinetport+ the Rustadd_fd(P2)/set_non_blocking(P7d), registering a created fd infdas/fdall), andreopen_listeners(s_bsd.c:512) walksListenerLLreopening every legal closed-fd listener. Partial port via the existings_bsd_link.oseam (-DPORT_S_BSD_OPEN_LISTENER_P7n);inetport(real socket/bind/listen, with its staticset_sock_opts) stays C. L1 differential (open_listener_diff.rs, 6 cases: normal→listening, delayed-before-rejoin→inactive/not-listening, delayed-after-rejoin→listens (inverse),!IsListenerno-op,fd>0no-op,reopen_listenersskips illegal + already-open) zero-diff vscref_(observable fd properties — valid/SO_ACCEPTCONN/O_NONBLOCK— + flags/fdas/fdall/local[fd], since each world opens its own socket), serialized onGLOBALS_LOCK. No new L2 (callee, hit at boot/rehash;golden_registrationbyte-identical); no S2S (no remote-user wire fields). -
P7o DONE:
s_bsd.cadd_listener(listener-constructor wrapper) — ported the layer directly above the now-Rustopen_listener(P7n):add_listener(s_bsd.c:330) builds theme-like listener-stubaClientvia the Rustmake_client/make_link(P2) —FLAGS_LISTEN,SetMe(STAT_ME), selfacpt/from,name = ME(=me.name),firsttime = time(NULL), a one-elementconfslink carrying the passedaconf— opens the socket via the Rustopen_listener, then prepends the client toListenerLL(back-linking the old head'sprevwhen non-empty); returns 0. No#ifdefs. Partial port via the existings_bsd_link.oseam, new guard-DPORT_S_BSD_ADD_LISTENER_P7o; all callees already Rust → no new still-C externs (add_listenerreferenced by the now-Rusts_conf.rsinitconf). L1 differential (add_listener_diff.rs, 3 cases: into emptyListenerLL→ sole node listening+registered with prev/next NULL, prepend before an existing node → new head + old head'sprevback-linked (inverse), two consecutive calls → chain order + back-links) zero-diff vscref_add_listener, isolated worlds (each opens its own socket /make_clientallocates its own pointer → compares observable facts not raw fd/pointer values;me.namepinned toirc.testsoinetport'sME-based sockhost matches;firsttime=time(NULL)asserted non-zero, not compared), serialized onGLOBALS_LOCK. No new L2 (callee, hit at boot/rehash vias_conf.cinitconf;golden_registrationbyte-identical); no S2S (formats no remote-user wire fields). -
P7p DONE:
s_bsd.cinetport(listener socket constructor) — ported the layer directly below the now-Rustopen_listener(P7n): the real socket constructorinetport(s_bsd.c:210). Creates anAF_INET6(AFINET) stream socket, optionallybind()s it (if (port)→in6addr_anywhen ip is unset/non-numeric, else the Rustinetptonwith the all-0xffminus_onefallback), applies itsstaticcalleeset_sock_opts, fillscptr(auth= the ipmask canonicalized to"a.b.c.d"viaDupString/MyMalloc;sockhost="<ip-or-ME>.<port>"viasprintf "%-.42s.%u";ip= thegetsocknameresult;port), registerslocal[fd] = cptr, bumpshighest_fd, and (whendolisten)listen(fd, 128); returns 0, or -1 on a refused (!ipmask/bad ipmask) or failed (socket/bind/getsockname) open.set_sock_optsisstatic(nocref_oracle) → ported as a private Rust twin (config-resolved: SO_REUSEADDR=1, SO_RCVBUF/SO_SNDBUF/SO_SNDLOWAT=8192,sizeof(int)optlen; SO_DEBUG&& 0+ SO_USELOOPBACK-undefined-on-Linux skipped); the Cstatic set_sock_optsstays compiled for its other callerscheck_server_init/connect_server. Partial port via the existings_bsd_link.oseam, new guard-DPORT_S_BSD_INETPORT_P7p;report_error+ the variadicsendto_flagstay C,local/highest_fd/me/minus_one/repliesread via bindgen externs. Thecptr == &meinetd-on-fd-0 KLUDGE (writesreplies[RPL_MYPORTIS]to fd 0) reproduced faithfully but never fires for a listener stub. L1 differential (inetport_diff.rs, 6 cases: normal port=0 listening (full compare — sockhostirc.test.0/auth0.0.0.0/port/socket-options/local[fd]/highest_fdbump), dolisten=0 not-listening (the listen inverse), NULL-ipmask + invalid-ipmask256.0.0.0refuse (return -1 before any socket, the error inverse), wildcardin6addr_anybind →::ip,::1inetptonbind →::1ip — the two bind cases serialized per world over one probed free port) zero-diff vscref_inetport, isolated worlds (each opens its own socket → compares observable fd properties + world-independent struct fields, never the raw fd), serialized onGLOBALS_LOCK. No L2/no S2S (callee, hit at boot/rehash viaopen_listener;golden_registrationbyte-identical; formats no remote-user wire fields). -
P7q DONE:
s_bsd.creport_error(error-reporting output leaf) — ported the genuine clean leaf left in the central I/O TU:report_error(s_bsd.c:151) calls no others_bsd.cfunction, so it ports in isolation, and the linker now resolves its 27 internal call sites (every still‑Creport_error("…", cptr)+ the already‑Rust leaves that called it viaextern "C") to the Rust definition. Deriveshostviaget_client_name(or""whencptr==NULL), refineserrtmpfrom the socket's pendingSO_ERROR(the getsockopt readout, mirroring P7d'sget_sockerr), fires theSCH_ERRORlocal‑opers notice (sendto_flag), sends a NOTICE back through a half‑open (Connecting/Handshake) server link's remotebyuidintroducer (find_uid→sendto_one, the:%s NOTICE %s :+textstrcpy/strncatconstruction), then echoes the formatted error tostderrwhileserverbooting. Config‑resolved:SO_ERRORdefined (getsockopt compiles),DEBUGMODE/USE_SYSLOGoff (noDebug/syslog). The variadicsendto_flag/sendto_one/fprintfare called, not defined — legal in stable Rust (the trampolines stay C until P8). Partial port via the existings_bsd_link.oseam, new guard-DPORT_S_BSD_REPORT_ERROR_P7q; reads the still‑Cserverbooting/glibcstderr, calls the Rustget_client_name(P5)/find_uid(P4). L1 differential (report_error_diff.rs, 4 cases:serverbooting=1+cptr=NULLformatted stderr echo, theserverbooting=0inverse gate → no output,cptrnon‑NULLhost=get_client_name, varied format/errno) captures fd 2 via a pipe redirect and asserts byte‑identical Rust‑vs‑crefstderr; serialized onGLOBALS_LOCK(setsserverbooting/cref_serverbooting+errnoper case). No new L2 (output callee, not amsgtabhandler — theSCH_ERRORerror path is exercised by the existing golden suite;golden_registrationbyte‑identical); no S2S in L1. Untested‑by‑design: theSO_ERRORreadout (needs a pending‑error socket;fd<0skips it identically), thesendto_flagwire emission (L2, variadic), thebysptrremote NOTICE (S2S — needs a connecting peer with a remotebyuid). -
P7r DONE:
s_bsd.cinit_sys(fd-table boot leaf) — ported the cleanest remaining leaf in the central I/O TU:init_sys(s_bsd.c:693), called once fromircd.cmainat boot. Config-resolved to a libc-only body:RLIMIT_FD_MAXis not defined on Linux → the wholegetrlimit/setrlimit+exit(-1)rlimit block is excluded;USE_POLL=1→ the sequentsetdtablesizeblock is excluded; Linux → thesetlinebuf(stderr)branch. So the only callees are libc (setlinebuf/bzero/close) and the only state is the already-exportedfdas/fdall/localglobals (no shared private static with still-C code — unlikeget_my_name/mysk). Body: line-buffer stderr,bzerothe twofdarrays +highest=-1, NULLlocal[0..MAXCONNECTIONS=50]whileclose()ing fds3..50(0/1/2 kept — stderr stays open untildaemonize). Partial port via the existings_bsd_link.oseam, new guard-DPORT_S_BSD_INIT_SYS_P7r;fdas/fdallvia bindgen externs,local[]via the existinglocal_base()helper. RED confirmed the undefined symbol referenced by still-Circd.c:1010; after GREENnmshowsinit_sysTfrom Rust. L1 differential (init_sys_diff.rs, 3 cases: fresh-init zeroes arrays + NULLs local + inverse-of-dirty invariant, closes fds 3..N, keeps 0/1/2 open) zero-diff vscref_init_sys— fork-isolated per world (the close loop is destructive to the test process's fds → each world runs in a forked child, results returned viammap(MAP_SHARED|MAP_ANONYMOUS)which survives the close loop), serialized onGLOBALS_LOCK. No new L2 (boot callee, not amsgtabhandler — the existing golden suite boots through it,golden_registrationbyte-identical); no S2S (formats no remote-user fields). Untested-by-design:setlinebuf(stderr)(unobservable); the rlimit/exitarms don't compile under the locked config. -
P7s DONE:
s_bsd.cget_my_name(server-own-hostname resolver) + de-staticmysk— ported the most leaf-like remainings_bsd.cfunction after P7d–P7r:get_my_name(s_bsd.c:2940), which at boot resolves the server's canonical hostname intome.name(gethostname→add_local_domain→gethostbyname(cname)||gethostbyname(name)+ theh_aliaseswalk, picking themycmp(ME)match) and initialises the outgoing-bind source addressmysk(bzero+sin6_family=AF_INET6/sin6_port=0, then the M-linefind_me()->passwdviainetptonwith theminus_oneall-0xfffallback when it's a digit-led non-v6). Its only in-TU calleeadd_local_domainis already Rust (P7e); all other callees are libc or already-Rust (find_meP6,inetpton/mycmpP1,minus_one/mebindgen). The single blocker — the file-privatestatic struct SOCKADDR_IN mysk(s_bsd.c:55) shared with the still-Ccheck_client(localhost detect) /connect_inet(outgoing bind) — was broken by de-static'ingmysk(a behaviour-preserving storage-class change: single TU, no othermysk), which also makes the cref archive exportcref_mysk(theobjcopyprefix-rename only follows global symbols — the L1 static-symbol limit), giving the L1 test a full cross-worldmyskcompare. Config-resolved:HAVE_GETIPNODEBYNAMEundef → plaingethostbyname;DEBUGMODEoff; themysk.SIN_ADDRwrite at s_bsd.c:3012 is dead#if 0. Partial port via the existings_bsd_link.oseam, new guard-DPORT_S_BSD_GET_MY_NAME_P7s;gethostbynamedeclared via a local extern (absent from the libc crate). L1 differential (get_my_name_diff.rs, 6 cases: M-conf NULL-passwd addr-zero, non-digit-passwd addr-zero inverse, valid2001:db8::1→ parsed addr, digit-but-invalid9zz→ minus_one, resolvablelocalhostcname → gethostbyname+alias-loop, empty cname → BadPtr early return) zero-diff vscref_get_my_name— both worlds call the same libcgethostname/gethostbyname(identical results in one run) + a sharedconf/cref_confM-conf, and the shared-but-isolatedme/cref_meME is pinned toirc.test; asserts thenameoutput buffer + the full 28-bytemysk/cref_myskagree, serialized onGLOBALS_LOCK. No L2/no S2S (boot callee, not amsgtabhandler; the existing golden boot exercises it —golden_registrationbyte-identical; formats no remote-user wire fields). Untested-by-design: the resolved hostname is host-dependent (the test asserts the two worlds agree, not a fixed string); thegethostname == -1early return needs an induced failure (both worlds take the success path identically). -
P7t DONE:
ircd.ccalculate_preference(AC preference leaf) — portedcalculate_preference(ircd.c:387, the auto-connect preference recompute called periodically fromio_loop): walks the globalconflist, fires the already-Rustsend_ping(P7m) on every AC-ableconnect{}C-line (CONF_CONNECT_SERVER|CONF_ZCONNECT_SERVER+port>0), then derivespreffrom that conf'saCPingwindow stats (or the-1sentinel whenseq==0/recvd==0). Partial-port via the existingircd_link.osecond-compile, new guard-DPORT_IRCD_CALC_PREF_P7t(the C body#ifndef-guarded with an#else externprototype so the still-Cio_loopcaller keeps a declaration). Faithfulness: calls the libcpowsymbol (notf64::powf— last-ULP drift would corrupt the(u_int)(f*100.0)truncation); final cast reproduces Cdouble→u_int→int pref. L1 differential (5 cases: skips, recvd==0 sentinel, full-window compute, mixed list) zero-diff vscref_(isolatedconf/cref_confworlds, serialized onGLOBALS_LOCK). L2 = existing golden boot stays byte-identical (locked config has noconnect{}C-lines → loop body is a no-op); no S2S (utility, no remote-user wire fields). Note: thecp==NULLsentinel clause is dead defensive code —send_pingdereferencescp->portfirst. -
P7u DONE:
s_auth.ciauth/STATSreporters (report_iauth_conf/report_iauth_stats) — opened the last P7 TU by porting its two cleanest leaves: list-walking reporters that emitRPL_STATSIAUTH/RPL_STATSDEBUGperiauth_conf/iauth_statsLineItemnode via the variadicsendto_one(report_iauth_confgated onadfd >= 0). De-static'd the two file-static list heads (the P7smyskprecedent) so the still-Cread_iauthwriter keeps them while the Rust readers reference them via extern; partial-ported via news_auth_link.o(-DPORT_S_AUTH_REPORT_P7u). L1 sendQ-capture differential zero-diff (6 cases incl. adfd<0 + empty-list inverses); golden byte-identical (no iauth in golden → reporters are no-ops); no S2S (no remote-user fields). -
P7v DONE:
s_auth.cset_clean_username(last pure-logic leaf) — portedset_clean_username(s_auth.c:44; derivescptr->username≤USERLEN+NUL from the raw ident replycptr->auth: dirty-prefix-on[/@/over-length/leading-:/embedded-whitespace, copy ≤USERLEN chars dropping@/[/whitespace, then free+redirectauthat the interiorusernamebuffer when equal else bumpistat.is_auth/is_authmem) toircd-common/src/s_auth.rs. De-static'd (behaviour-preserving — single TU) sonm -gemitscref_set_clean_usernameand the still-C callers (read_iauth/start_auth) resolve to the Rust def once the body is#ifndef PORT_S_AUTH_CLEAN_USERNAME_P7v-guarded out ofs_auth_link.o. L1 differential (9 cases: free path clean-fits/exact-USERLEN/empty, istat path@/[/over-length/leading-:/interior-whitespace, inverses trailing-whitespace-not-dirty-but-unequal + NULL-auth early-return) zero-diff vscref_on the fullusername[11]buffer +is_auth/is_authmemdeltas + theauth==&usernameself-pointer predicate; serialized onGLOBALS_LOCK(sharedistat). L1 is the gate (utility/callee TU, reached only from the still-C iauth/ident I/O the golden harness doesn't run);golden_registrationstays byte-identical (no-regression); no S2S (no remote-user fields). -
P7w DONE:
s_auth.cident-protocol I/O pairsend_authports/read_authports— ported the RFC1413 ident query/reply pair toircd-common/src/s_auth.rs(the leaf relative to the still-Cstart_auth+ thes_bsd.cevent loop ats_bsd.c:2363/2368).send_authports:getsockname/getpeername(fd)→"theirport , ourport\r\n"→write(authfd), with theauthsenderrfailure path (ircstp->is_abad++, closeauthfd,highest_fdwalk past NULLlocal[],authfd=-1, clearFLAGS_AUTH|FLAGS_WRAUTH); success clears onlyFLAGS_WRAUTH.read_authports:readbuffered across partial reads viacptr->count,sscanfthe"%hd , %hd : USERID : %*[^:]: %512s"grammar, setauth(OTHER→--prefixedMyMalloc, elsemystrdup) +set_clean_username(P7v sibling) +FLAGS_GOTID; no\n/\ryet → early return; bad/empty →is_abad++. Config-resolved (USE_SYSLOG/DEBUGMODE off → no syslog/get_client_name/Debug; AFINET=AF_INET6 →sockaddr_in6/sin6_port; BUFSIZE=512).index→strchr,rindex→strrchr,MyFree→free,ntohs→u16::from_be;sscanfdriven through libc with the exact C format. Seam:-DPORT_S_AUTH_AUTHPORTS_P7wons_auth_link.o; both already global ins_auth_ext.h→ no de-static, the prototype comes from the header. L1 (authports_diff.rs, 10 cases) zero-diff vscref_:send_authportsover a real IPv6-loopback connected socket (sogetsockname/getpeernamepopulatesin6_port— an AF_UNIX socketpair leaves the port bytes untouched, a false diff) + the error/highest_fd-walk paths;read_authportsover socketpair read-ends covering valid/OTHER/bad/ERROR/partial-early-return/EOF + the pre-auth free +istatdecrement. Serialized onGLOBALS_LOCK. No L2/no S2S (utility TU, nomsgtabentry, no live ident peer in the golden harness, no remote-user fields); existing golden suite (golden_registration) stays byte-identical. -
P7x DONE:
s_auth.cident initiatorstart_auth— ported the RFC1413 query initiator (-DPORT_S_AUTH_START_AUTH_P7xon thes_auth_link.orecipe): opens the non-blockingauthfdsocket, derives local/peer addrs fromgetpeername/getsockname(cptr->fd), optionally overrides the bind source from the P-line TLSsource_ip, then either hands off to iauth (adfd>=0: build"<fd> C <themip> <themport> <usip> <usport>"viainetntop+ipv6string+libcsprintf,sendto_iauth; success →close authfd/authfd=-1/FLAGS_XAUTH/return) orbind/connects to[peer]:113(armFLAGS_WRAUTH|FLAGS_AUTH, bumphighest_fd). Config-resolved: NO_IDENT off (full body), USE_IAUTH on (early-return + handoff), USE_SYSLOG/DEBUGMODE off (no syslog/Debug), AFINET=AF_INET6. Calls the Rustset_non_blocking/report_error/inetntop/inetpton; calls the variadicsendto_iauth/sendto_flag(stay C). L1 differential (3 cases:XOPT_REQUIRED && adfd<0early return; iauth-handoff query bytes byte-identical over a shared real IPv6-loopbackcptr->fd; getpeername-failureauthfd-reset) zero-diff vscref_, serialized onGLOBALS_LOCK. Utility/callee TU (nomsgtab) — L1 is the gate; golden suite stays byte-identical (golden_registrationconfirmed); no S2S (noIsServer/remote-field path). -
P7y DONE:
s_auth.ciauth-pipe line parserread_iauth— ported the last non-variadic logic in s_auth.c (s_auth.c:174; the slave-auth pipe drain: persistentobuf/olenpartial-line carry + per-opcode dispatch>/G/O/V/a/A/s/S/U/u/o/D/K/k/garbage) toircd-common/src/s_auth.rs; guarded the C body out via-DPORT_S_AUTH_READ_IAUTH_P7yon thes_auth_link.orecipe (#else externproto for the still-C callers); the file-scope globalsiauth_version/iauth_conf/iauth_stats/iauth_options/iauth_spawnstay C-owned in s_auth_link.o, referenced via extern; the variadicsendto_iauth/sendto_flagare CALLED (stay C). L1 differential (10 cases: O-options incl. flagless-reset, V replace+free, A/a conf add+clear, s/S stats reset+append, U/u ident, U with istat-decrement via per-worldMyMalloc/cref_MyMalloc, gone/mismatch/garbage negatives, obuf/olen partial-line carry round-trip) zero-diff vscref_; serialized onGLOBALS_LOCK. Finding: the per-client prefix uses the portedinetntopwhich expands::1→0:0:0:0:0:0:0:1(a faithful support.c quirk), so the iauth line must carry the expanded IPv6 form. No L2/S2S (utility TU, nomsgtabentry, noIsServer/remote-field formatting; reached only via a live iauth slave the golden harness doesn't run). Onlysendto_iauth/vsendto_iauth(variadic → P8) remain C in s_auth.c. -
P7z DONE:
s_bsd.ccheck_client(ordinary-client access check) — portedcheck_client(the access check run from the Rustregister_user): resolve thegetpeernamepeer addr →cptr->ip/port(via a private Rust twin of the file-staticcheck_init), verify the DNS host↔ip mapping both ways (IP# Mismatch → clearhostp), thenattach_Iline.NO_OPER_REMOTE/UNIXPORTundef → no trailingFLAGS_LOCALblock / no unix branch (so nomyskuse).check_initstays compiled ins_bsd_link.ofor the still-Ccheck_server_init(GCC inlines it into that sole remaining caller) — the P7pset_sock_optsprivate-twin precedent. Guard-DPORT_S_BSD_CHECK_CLIENT_P7z. L1 4-case zero-diff (check_client_diff.rs: no-hostp/empty-conf→-2, hostp-addr-match→kept, hostp-mismatch→cleared, getpeername-fail→-1) over a shared real IPv6-loopback fd + emptyconf/cref_conf; L2 = existinggolden_registration(the success path: real I:line → 0 → client registers) byte-identical; no S2S (noIsServerbranch — servers go throughcheck_server_init/check_server). -
P7aa DONE:
s_bsd.ccheck_server_init+check_server(server-side access check) — ported the sibling of P7zcheck_client(-DPORT_S_BSD_CHECK_SERVER_P7aa):check_server_initattaches the C/N lines for the server name, confirms a C+N pair for a dialed link (IsConnecting/IsHandshake), fires an async DNS lookup of the conf host (count_cnlines+ a stackLink{value.aconf, flags=ASYNC_CONF}+gethost_byname,nextdnscheck=1), then defers tocheck_server;check_serverrunscheck_init(the P7z private Rust twin), validates the resolved host↔ip mapping (IP# Mismatch→ drophp, faithful four-c_ulongover-read), searches C/N lines by hostname/sockhost/ip#,det_confs_butmask, then on a C+N matchattach_confs both + theAND16(ipnum)==255dynamic-ip adoption +get_sockhost(c_conf->host). Both dropped froms_bsd_link.o; the file-staticcheck_init(+ its prototype) loses its last C caller so it is guarded out under the sameP7aasymbol. Config-resolved:UNIXPORT/DEBUGMODEoff. Callees (attach_confs/find_conf/find_conf_host/find_conf_ip/attach_conf/det_confs_butmask/count_cnlines/gethost_byname/get_sockhost/add_local_domain) are Rust;sendto_flagis called (variadic → P8). L1 6-case zero-diff (check_server_diff.rs: init unknown/handshake deny; check_server bad-socket→-2; connected ::1 no-hostp/hostp-match/hostp-mismatch→-1 with agreeing ip/port/sockhost); the C+N success path (return 0/attach) is covered by the existing L2-S2S golden suite (golden_s2s_link/_eob/_wholink a real peer the Rust ircd accepts throughcheck_server_init— all green). No new L2 file. -
P7bb DONE:
s_bsd.cadd_connection(inbound-connection acceptor) + privatecheck_clonestwin — port the per-accept()local-client constructor (make_client→ resolve peer addr intoip/port/sockhost→ clone-rate check → register fd inlocal[]/fdall/client list →start_auth) plus its file-staticclone-rate calleecheck_clones(CLONE_CHECK; persistent backlog list, ported as a private Rust twin — nocref_oracle) via-DPORT_S_BSD_ADD_CONN_P7bb. Config-resolved:NO_DNS_LOOKUP(hostp=NULL, no async lookup,USE_IAUTHalias-forwarding block compiled out),DELAY_CLOSE/CLONE_CHECKon,UNIXPORToff,AF_INET6. L1 differential (normal accept post-state + clone flood over the backlog + the getpeername-fail/IsIllegal refuse inverses;start_authneutralized viaiauth_options=XOPT_REQUIRED+adfd=-1) zero-diff vscref_; L2 =golden_registration(every client connection flows through it) byte-identical,golden_s2s_linkgreen (incoming server links too); no new S2S (formats no remote-user fields, noIsServerbranch). -
P7cc DONE:
s_bsd.cconnect_server+ staticconnect_inet— the outbound server-connection setup (counterpart of P7bbadd_connection): refuse if already linked, else build a client/server stub,connect_inet(socket/bindtomysk+ dup-IP scan),connect(), re-attach+verify C/N lines, register the fd.connect_inetported as a private Rust twin;set_sock_opts(last compiled C caller now gone) guarded out under the same-DPORT_S_BSD_CONNECT_SERVER_P7cc. Finding: the DNS block is dead under AF_INET6 (!aconf->ipnum.S_ADDR= array address, always false). L1 3-case zero-diff (already-present ±remoteby, connect_inet-failure cleanup); no new L2 (golden/S2S dials into the ircd → outbound dial deferred to the event-loop/CONNECT L2). -
P7dd DONE:
s_bsd.cstart_iauth(iauth subprocess respawn) — the deepest boot-subtree leaf (daemonizecalls it). (Re)spawns the external iauth helper over anAF_UNIXsocketpair, recording the parent end inadfd:BOOT_NOIAUTH+adfd>=0+ 90s-throttle guards, thensocketpair→ Rustset_non_blockingboth ends →setsockopt(SO_SNDBUF/RCVBUF, IAUTH_BUFFER=65535)→fork(←vfork; identical here, libc deprecates vfork) → child close-loop/dup2/execl(IAUTH_PATH, IAUTH)→ parent close; the non-first-call live-client burst as"<fd> O"lines. Staticslast/first/iauth_pid→ module-private;IAUTH_PATH/IAUTHexpanded by build.rs intoircd_sys::IAUTH_PATH/IAUTH(thePID_PATHprecedent). Guard-DPORT_S_BSD_START_IAUTH_P7ddons_bsd_link.o. L1 3-case zero-diff (NOIAUTH + already-running early returns + the spawn post-state —adfdnonblocking,iauth_spawn++— with bounded child reaping); burst + full spawn end-to-end → L2/soak (golden boots-t -s=BOOT_NOIAUTH); no S2S. -
P7ee DONE:
s_bsd.cdaemonize(boot detach + resolver/iauth init) — ported the layer directly above the P7ddstart_iauth(called once fromircd.cmainat boot), now a clean leaf since its only non-libc calleesinit_resolver(P6) andstart_iauth(P7dd) are Rust. Config-resolved:TIOCNOTTYdefined on Linux (the ioctl block compiles); thesetpgrparm is the#elsesetpgrp(0, getpid())branch (glibcsetpgrp(void)ignores the args; declared 2-arg to mirror the source). Faithful:bootopt & BOOT_TTY→ short-circuit straight toinit_dgram(no fork/no fd close); elsefclose(stdout)/close(1), (unlessBOOT_DEBUG)fclose(stderr)/close(2), and on a console/tty-not-inetdfork()(parentexit(0)s to detach) →TIOCNOTTYioctl →setpgrp→fclose(stdin)/close(0); then alwaysresfd = init_resolver(0x1f)+start_iauth(0). Partial port via thes_bsd_link.oseam (-DPORT_S_BSD_DAEMONIZE_P7ee). L1 differential (daemonize_diff.rs, 1 case: theBOOT_TTY|BOOT_NOIAUTHshort-circuit —init_resolveropens a validresfdsocket,start_iauth(0)reached-but-no-op underBOOT_NOIAUTHleavingadfd=-1— the inverse check; both worlds identical) zero-diff vscref_daemonize, serialized onGLOBALS_LOCK. Mostly untestable by design: the detach path forks (parentexit(0)s) + closes 0/1/2 — calling it destroys the harness, and even fork-isolation can't measure a function whose job is to detach; the only differentially-safe path (and the only one any harness takes — golden boots-t=BOOT_TTY) is theBOOT_TTYshort-circuit. No new L2 (boot callee;golden_registrationbyte-identical via this path); no S2S (no remote-user fields). Onlyread_message(+ its staticspolludp/check_ping) remains C ins_bsd.c. -
P7ff DONE:
s_bsd.cevent-loop clusterread_message+ 8 statics (completed_connection/read_listener/read_packet/client_packet/ircd_no_fakelag/do_dns_async/polludp/check_ping) — the body ofio_loopand the last logic ins_bsd.c: build the read/write fd_set overfdp+udpfd/resfd/adfd→select()→ dispatch resolver/UDP/iauth reads + auth-fd I/O + listeneraccept()s + writable sendQ flushes + readable packets + dead-socketexit_client.USE_POLLoff → theselect()path; the 8 statics → module-private Rust twins (nocref_oracle); guard-DPORT_S_BSD_READ_MESSAGE_P7ff. Withread_messageported,s_bsd_link.ohas zero functions left — only the data globals. L1 = the differentially-safe empty-loop path (read_message_diff.rs, 2 cases zero-diff); L2 = the entiregolden_*+golden_s2s_*suite byte-identical (every byte flows through it; only the knowngolden_s2s_s_serv_statsreference-C uninitialised-sendq flake fails — [[p5-s2s-stats-flake]]); destructive accept/read/write/exit +polludp/do_dns_asyncare L2-only by design. -
P7gg DONE:
ircd.ctry_connections(auto-connect timer) — ported the static io_loop AC timer (walksconf, picks the best AC-ableconnect{}C-line by lowest-hold/best-pref/highest-class, splices the winner to the list tail, penalises itshold, then defers or dials viaconnect_server); de-static'd (mysk precedent) so the cref archive exportscref_try_connections, guarded-DPORT_IRCD_TRY_CONNECTIONS_P7gginircd_link.owith an#else externproto for the still-C io_loop caller.DISABLE_DOUBLE_CONNECTSundef → dup-IP scan dead. L1 8-case zero-diff (all non-connect_serverpaths incl. the tail-splice + deferred-notice viaiconf.aconnect=0); the dial path is L2-only (golden dials into the ircd — P7cc precedent); no S2S. -
P7hh DONE:
ircd.ccheck_pings(io_loop ping/timeout sweep) — ported the static io_loop timer helper (ircd.c:525): walkslocal[highest_fd..0], pings idle registered links (FLAGS_PINGSENTstate machine), times out unresponsive ones (exit_client; servers get a "No response … closing link" notice; DNS/auth waiters reset or handed to iauth viasendto_iauth), and folds the soonest next-check time into the return value. De-static'd under-DPORT_IRCD_CHECK_PINGS_P7hh(the try_connections P7gg precedent) on theircd_link.orecipe;#else externproto for the still-C io_loop caller. Config-resolved: TIMEDKLINES off →kflagpermanently 0 (find_kill/kill-notice + staticlkillgone, timeout arm always "Ping timeout"); USE_IAUTH on; DEBUGMODE off. Cgoto ping_timeoutmodelled by guarding the if/else on the negated recently-active condition;bysptrkept outside the loop (never reset). L1 (check_pings_diff.rs, 7 cases) zero-diff vscref_check_pingsover isolated worlds (reallocal/highest_fd/mevscref_*), serialized onGLOBALS_LOCK: empty, listener-skip, recently-active-no-ping, the PINGSENT ping-send branch (its inverse), young-unregistered, already-pinged-idle-below-2*ping, mixed multi-fd sweep — asserts per-client (flags,lasttime)+return. Theexit_clienttimeout paths are L2-gated (destructive+variadic, the read_message/P7ff precedent). L2 = the ircd-golden suite runs check_pings every io_loop tick;golden_registration+golden_channel_joinbyte-identical, only the documentedstats_treference-C garbage flake remains. No S2S (no command-driven remote-field formatting). -
P7ii DONE:
ircd.cdelayed_kills(io_loop K-line sweep) — ported the second io_loop timer helper (sibling of P7hhcheck_pings, ircd.c:447): runs only whilerehashed > 0, walkslocal[dk_lastfd..j]andfind_kills every local person,exit_clienting K-line matches. De-static'd under-DPORT_IRCD_DELAYED_KILLS_P7iionircd_link.o(the check_pings precedent;#else externproto for the still-C io_loop caller). Config-resolved: MAXDELAYEDKILLS=200 > MAXCONNECTIONS=50 →jalways clamps to 0 → the sweep always completes in one call (persistent statics reset every call; thereturn rehashedincomplete-batch path unreachable); TIMEDKLINES off → find_killtimedklines=0. L1 (delayed_kills_diff.rs, 6 cases) zero-diff vscref_delayed_killsover isolated worlds (reallocal/highest_fd/rehashedvscref_*+ empty kconf → no kill), serialized onGLOBALS_LOCK: empty across rehashed∈{0,1,2}→return{0,0,1}, person-no-kline completes & survives (the inverse of the kill arm), non-person/NULL skipped, mixed sweep — asserts return + per-client (status,flags,still-in-local). Thekflag==-1kill arm (exit_client, destructive) is untested-by-design AND has no L2 path (golden never rehashes → delayed_kills' body isn't reached);golden_registrationbyte-identical (no-regression). No S2S (no remote-user wire fields). -
P7jj DONE:
ircd.csetup_meboot initializer — ported theme-singleton initializer (ircd.c:723, de-static'd + extern-declared,-DPORT_IRCD_SETUP_ME_P7jjonircd_link.o) toircd-common/src/ircd.rs: passwd-derivedusername/auth,get_my_namesockhost, theSTAT_ME/FLAGS_OPER/FLAGS_EOB/SV_UIDbits, server-name interning (find_server_num/find_server_string),make_user,istat.is_users/is_eobservers, client+SID hash registration,verstr=PATCHLEVEL,setup_server_channels. All callees already Rust; no variadic senders. L2-gated, no L1 (mutates 4 shared global tables + themesingleton +istat→ not L1-isolatable; the P7dd/ee/ff precedent) — golden registration/lusers/s2s_server/s2s_info/s2s_map + 3 s_misc byte-identical (stats_t = documented pre-existing reference-C garbage flake). No S2S (no command wire output). -
P7kk DONE:
ircd.csignal-handler + reboot cluster (s_die/s_slave/s_rehash/s_restart/restart/server_reboot, ircd.c:73–215) — ported the SIGTERM/SIGUSR1/SIGHUP/SIGINT handlers + therestart→server_rebootshutdown path toircd-common/src/ircd.rsvia-DPORT_IRCD_SIGNALS_P7kk(single guard over the contiguous block;#elsere-declares the two non-header handlers for the still-Csetup_signals); de-static'd thedorehash/dorestart/restart_iauthflags (shared with the still-Cio_loop; one C definition, Rust writes via a localextern "C"block) ands_rehash/s_slave(cref oracle).IRCD_PATHplumbed asircd_sys::SERVER_PATHforserver_reboot'sexecv. L1 differential (ircd_signals_diff.rs, 3 tests:s_rehash0→1→2→2 ratchet,s_slaverestart_iauth set,s_restartdorestart-when-not-tty) zero-diff vscref_, serialized onGLOBALS_LOCK, signal dispositions saved/restored. L2 = boot gate (setup_signals installs the Rust handlers) +golden_s_serv_shutdown/_maint(die/restart/rehash reject + rehash_success io_loop path) byte-identical; the terminating arms (exit/execv) are faithful-by-inspection. No S2S (no command-driven remote-user wire fields). -
P7ll DONE:
ircd.csetup_signals(boot signal installer) — ported the staticsetup_signals(ircd.c:1388, called once from the still-Cmain) toircd-common/src/ircd.rs, the last clean leaf before thec_ircd_main/io_loopspine; all callees are now Rust (dummyP7a;s_rehash/s_restart/s_die/s_slaveP7kk). Config-resolved:POSIX_SIGNALS=1 (thesigactionbranch),SIGWINCHdefined,USE_IAUTHON (s_slave+SIGCHLD/SA_NOCLDWAITarms), not__FreeBSD__, noRESTARTING_SYSTEMCALLS; faithful cumulativesa_mask(sigemptysetcalled exactly twice). De-static'd under-DPORT_IRCD_SETUP_SIGNALS_P7ll(split out of the line-34 static proto group; the cref archive keeps the de-static'd body → exportscref_setup_signals) on theircd_link.orecipe;nmconfirmsT setup_signalsfrom Rust. L1 (setup_signals_diff.rs, 1 case) zero-diff vscref_: snapshot all 8 dispositions → call Rustsetup_signals→ query → callcref_setup_signals→ query → restore; asserts per-signalsa_flags+sa_maskbyte-identical between worlds and the world-correct handler wired (SIG_IGN for PIPE/WINCH/CHLD identical; else Rustdummy/s_rehash/… vscref_dummy/… — handler ptrs differ by design), serialized onGLOBALS_LOCK. L2 = the still-Cmaininstalls the Rust handlers on every golden boot →golden_registration/golden_s_serv_shutdown/golden_s_serv_maint(die/restart reject + rehash_success) byte-identical. No S2S (no command-driven remote-user wire fields). -
P7mm DONE:
ircd.cio_loop(the event-loop body) — ported the per-tick loop body (while(1) io_loop()in the still-Cmainnow calls the Rust symbol) toircd-common/src/ircd.rsvia theircd_link.oseam (-DPORT_IRCD_IO_LOOP_P7mm, io_loop de-static'd toextern). Config-resolved:DELAY_CLOSEoff (timer+delay-MIN arms dropped),TKLINEon (tkline_expirearm kept),DEBUGMODEoff (noDebug/checklists). Calls already-Rust siblings directly (calculate_preference/try_connections/check_pings/delayed_kills/restart/ircd_writetune);nextpreference/nextiarestartvia a localextern "C"block (absent from*_ext.h). No L1 (static → nocref_io_looporacle); L2 = whole golden suite (every booted Rust ircd runs the loop) byte-identical — registration/channel-join/debug-stats/s2s-link confirmed. -
P7nn DONE:
ircd.cCLI boot helpers (bad_command+open_debugfile) — ported the last two non-spine file-statichelpers (both called only fromc_ircd_main):bad_command(usage banner +exit(-1); config-resolvedCMDLINE_CONFIG/DEBUGMODEoff → both%sslots"") andopen_debugfile(entire body#ifdef DEBUGMODE→ a pure no-op under the locked config). De-static'd both (+ split the proto out of the P7mmio_loopgroup) so the cref prefix-rename exportscref_bad_command/cref_open_debugfile; guarded the bodies out ofircd_link.ounder a single new-DPORT_IRCD_CLI_HELPERS_P7nn. L1 differential (ircd_cli_helpers_diff.rs, 2 cases) zero-diff vscref_: afork()-isolated stdout+exit-status diff for the terminatingbad_command(byte-identical banner +WEXITSTATUS==255) and the no-op-contract inverse foropen_debugfile(fd 2fstatidentity unchanged — it must NOT redirect stderr). L2 =golden_registrationbyte-identical (open_debugfileruns no-op on every boot). No S2S (no remote-user wire fields). Onlyc_ircd_mainremains C inircd.c. -
P7oo DONE:
ircd.cc_ircd_main— THE BOOT SPINE, the last C function with logic — portedmain(renamedc_ircd_mainvia-Dmain=c_ircd_main, ircd.c:837) toircd-common/src/ircd.rsas#[no_mangle] c_ircd_main, config-resolved to the locked build (CHROOTDIR/ZIP_LINKS/CMDLINE_CONFIG/USE_SYSLOG/DEBUGMODE/IRC_UID/IRC_GIDOFF;USE_IAUTH/TKLINEON;IRCDCONF_DELIMITER='|'):sbrk0/uid setup, the argv flag-parse loop, the setuid-root guard, thevfork/execl(IAUTH_PATH,IAUTH,"-X")iauth-presence check, theinit*/initconf/listener-scan/M-line/SID/split checks +make_isupport,setup_me/check_class/ircd_writetune, theBOOT_INETDblock, the startup banner,mysrand/daemonize/logfiles_open/write_pidfile/dbuf_init, andloop { io_loop() }. Guarded out ofircd_link.oby-DPORT_IRCD_MAIN_P7oo;ircd-rs/src/main.rsunchanged (still callsircd_sys::c_ircd_main→ resolves to the Rust def;nmconfirmsT c_ircd_mainfrom Rust, andircd_link.onow defines nomain/c_ircd_main— only data globals). L2-gated, no L1 (the boot spine forks iauth, daemonizes, never returns — the P7mm/P7jj precedent): the wholeircd-goldensuite boots through it byte-identical (the lone failure,golden_s2s_s_serv_stats's "sq" field, is the documented pre-existingp5-s2s-stats-flakeuninitialized-sendq garbage — proven by re-running on clean HEAD, where the Rust side shows the same non-deterministic garbage). Flag arms beyond-t/-s/-p standalone, the iauthvfork(skipped by-s), the setuid-root guard, andBOOT_INETDare faithful-by-inspection. No S2S. → P7 COMPLETE: all C logic is now Rust; only data globals + the ~25 variadic sender trampolines remain.