A native AmigaOS 3.x port of binkd, the FTN (FidoNet Technology Network) mailer, built without ixemul.library or ixnet.library.
v10.35 is the release to run. Get it from the
releases page or from the
BBS file area as AmiBinkD10_35.lha.
If you are on v10.23 or earlier, upgrade — your outbound mail is not being
delivered. Every bundle was announced as 0 bytes, because this toolchain's
fstat() reports st_size as 0 while returning success. Sessions look
completely normal in the log. Fixed in v10.24 (amiga/fstat.c).
If you are on v10.19 through v10.32, your peers have you logged under the
wrong version. The VER string sent to every node was a separate hardcoded
literal from the one in the startup banner, and it was never updated — it
still read v10.19 while the binary was v10.33. Fixed in v10.33; there is now
one definition behind all three places the version appears. v10.34 also
corrects the format of that string — see below.
One fix, and it is the reason to upgrade if you poll on a schedule.
-
Polls no longer stall mid-session. A poll could stop partway through a handshake and stay stopped for ten minutes to two hours, ending only when the remote gave up waiting. The process stayed alive and the log went quiet, so nothing pointed at a cause. On C-Net/5, which runs polls from the event scheduler, a stalled session holds the scheduler with it — on 30 August a stuck 13:30 poll took the local console login down with it until the machine was restarted.
The mailer was doing stale-lock maintenance on a lock its own live session held.
q_scan_addrs()runs fromcomplete_login()in the middle of the handshake and is handed the remote's AKAs, so the.bsyit reached was the one this session created when it dialled — and it went to the filesystem to tidy it up while the session sat on an unread socket. Stall length trackedkill_old_bsyexactly (~2h while that was 2h, ~15m once it was lowered), which is what identified it.A held lock is not stale, so it is now skipped with no filesystem access at all. Nine stalls in 243 scans before the fix; 36 polls begun and 36 ended across the five-day soak after it.
No protocol or transfer changes. Two things AmiBinkD had been reporting wrongly to every peer, both visible in the binkp handshake.
-
It now says what it is and what it runs on. The
VERstring follows the convention everything else uses — mailer, version, OS, then protocol:AmiBinkD/10.34/Amiga binkp/1.1. Through v10.33 it sentAmiBinkD v10.33-binkp/1.1, which named no operating system and attached the protocol token with a hyphen. Comparebinkd/1.1a-115/Linux binkp/1.1andMystic/1.12A49 binkp/1.0, which is what arrives here from everyone else. -
It now knows what time zone it is in. The handshake's
TIMEfield was sending the right wall-clock time with+0000attached — telling every node it polled that it sat on the Greenwich meridian. binkd normally derives the offset by comparinggmtime()againstlocaltime(), which cannot work here: AmigaOS has no timezone database, and the C runtime'slocaltime()isgmtime(t - __timezone)with__timezonenever set, so the two agree exactly and the difference is zero. It now readsloc_GMTOffsetfromlocale.library— the zone you set in Prefs/Locale. Nothing to configure, correct in any country.If your offset still shows
+0000, open Prefs/Locale, set your zone and press Save (not Use — Use only writes toENV:, which is RAM). Daylight saving is manual: AmigaOS has no concept of it, so Locale holds standard time. Thetzoffconfig keyword overrides Locale if you would rather pin it. -
Documented that AmiBinkD is IPv4-only — and why that is a property of AmigaOS rather than of this port. Roadshow's
sys/socket.hdefines 26 address families ending atAF_MAX 26; there is noAF_INET6orsockaddr_in6anywhere, and AmiTCP and Miami are IPv4-only as well. The readme carries a v6-to-v4 relay recipe for reaching IPv6 callers, with its caveats. Documentation only — AmiBinkD is not IPv6 capable.
- Writes no longer land in the wrong file. Rarely — about 0.2% of log
lines — a write meant for one file appeared in another. The cause is
libnix's file-descriptor table:
___allocfdscans andrealloc()s a shared global with no locking anywhere in its file layer (verified acrossopen,close,write,read,lseek,fopen,fwrite). This port runs sessions as separate Processes in one address space, so two opening files at once can be handed the same slot.Log()was the heaviest user by far — one open and one close per line — and now writes through dos.library directly, never touching that table. Measured after: 4,133 log lines over two days including outbound transfers, zero corrupted. - The name is AmiBinkD everywhere — program strings, filenames, config and docs.
Not a complete fix: the lock-file writer and the transfer paths still use the library's descriptors and can still collide with each other, at a small fraction of the frequency. v10.32's bound on the stale-lock loop means the worst consequence — a poll spinning and stopping outbound mail — cannot recur regardless. Only ever observed under emulation.
Nothing shipped between v10.15 and v10.18. Both intermediate versions
exist as builds and commits in this tree, and both are documented here and
in manual.txt, because the AmigaOS problems they uncovered are worth
passing on to anyone else porting to this platform. Neither is safe to run:
- v10.16 — first build where inbound genuinely ran, but a hung session
permanently leaked an AmigaOS Process, a socket and a bsdsocket.library
instance. 107 of 128 sessions leaked in twelve hours; the leaked
.bsylocks then made the BBS's own poll script abort before it launched the mailer, killing outbound mail for eleven hours witherror: 8as the only symptom. In practice that was worse than v10.15's quieter failure, which is why the brief upgrade recommendation for it was withdrawn. - v10.17 — fixed the semaphore strand behind most of that (105 leaks →
13), but sessions could still hang one at a time inside
touch(). One such hang inside a poll client blocked CNet's event scheduler for 17 hours. - v10.15 — the previous public release, and inbound has been silently broken in it since v10.5. It fails safe: the server stops accepting after the first hang, so nothing accumulates and outbound keeps working. Upgrade from it to v10.18.
Separately, and worth doing whatever mailer you run: if your BBS event script
deletes .bsy/.csy files before polling, make sure a failed delete cannot
abort the script. On AmigaDOS that means wrapping those deletes in
FAILAT 21 / FAILAT 10. A lock file held by a live session is enough to
kill the whole event otherwise, and kill-old-bsy already sweeps stale
locks for you.
Cross-compiles and links cleanly into a loadable AmigaOS binary
(amibinkd), zero references to ixemul/ixnet anywhere in the binary.
Tested live on the user's production Amiberry instance (deployed to
DH0:AmiBinkD/, per-network configs cnet.cfg/araknet.cfg/
disciple.cfg/fidonet.cfg/pinet.cfg/retronet.cfg/amiganet.cfg,
real FTN addresses/domains):
- Outbound (client/poll): repeatedly connects to real remote binkds
(
Mystic/1.12A49and, on fidonet, the real referencebinkd/1.1a-115itself), completes full BinkP handshake incl. CRAM-MD5 auth, exchanges SYS/LOC/ZYZ/TIME/VER/BUILD info, clean session close. - Inbound (server): accepts a real connection from the network hub, runs the full session (or a clean auth failure for a wrong per-node password - a config issue, not a bug), and correctly returns to waiting for the next connection afterward - the original hang this port fought hardest to fix. This first ran at all in v10.16 and only became safe in v10.18: through v10.15 every inbound session silently transmitted nothing and hung, taking the listener with it; in v10.16 and v10.17 sessions ran but leaked. Two dedicated sections below cover this - they are the single most important thing to understand before touching the AmigaOS socket glue or anything that touches a file the mailer holds.
- Multi-node polling in one invocation (
-P addr1 -P addr2 ..., or-P ALLfor every node in the config as of v10.15 - see below), and the equivalent pattern of polling each network via its ownExecute <net>.scrin sequence from a driver script (FTN_Poll): confirmed working through all seven configured networks in one run, including real inbound file reception and successful CNet/5 Toss import of the received packets - not just clean-looking session logs. - Unattended soak tests: several, each one gating a release. The latest (v10.18, 2026-08-10 → 08-11, 19h37m) ran 22 poll cycles and 66 sessions with zero errors and zero warnings - see "Soak test results" below for that run and the earlier ones it supersedes.
Getting here took several rounds of real-hardware-only bugs - Amiberry's
bsdsocket_emu diverges from real Roadshow/real BSD sockets in more than
one place, this toolchain's intmax_t/uintmax_t size assumptions don't
match sys.h's fallback format-string macros, AmigaOS's own
SetFileDate()/utime()/unlink() block forever rather than failing when
another Process holds the object, and two bugs (o_rename(), and a
Makefile with no header dependencies) were entirely our own - and none of
these were visible from cross-compiling alone. See "Real-hardware findings"
below before touching networking, logging, or filesystem code here.
The user's own AmiBinkD-main starting point (from GitHub) turned out to
be upstream binkd given a cosmetic "modernization" pass - reformatted,
several files quietly dropped without checking what depended on them
(readcfg.c/.h, defining the core BINKD_CONFIG struct, was missing
entirely), and main.c/ftn.c were stubs that never actually drove the
real servmgr()/clientmgr() logic already sitting in server.c/
client.c. Its one genuinely new, correct piece was amiga_glue.c
(opens bsdsocket.library directly - the right approach).
Traced the real ixemul dependency to upstream's own historical Amiga
port (mkfls/amiga/Makefile): "you have to install ADE and
ixemul.library version 47.0 or newer". Its branch.c (the
fork-equivalent used to run each binkp session) used ixemul's
ix_vfork()/vfork_setup_child()/ix_vfork_resume() directly - there
was no non-ixemul Amiga concurrency path in upstream at all.
Given that, this port starts from a clean upstream binkd checkout and replaces every ixemul-era assumption with something native, rather than patching the incomplete starting point piecemeal.
Classic AmigaOS has no fork()/pthreads without ixemul, but it does
have CreateNewProcTags() (dos.library) - the native primitive for
spawning a second running unit of execution. Classic AmigaOS is a single
flat shared address space across all tasks/processes (no fork()-style
copy-on-write isolation), so a process spawned this way behaves much
closer to a thread than to a Unix fork() - it shares the parent's
globals, heap, and open library bases directly.
Through v10.4, branch.c's AMIGA case instead ran each binkp session
synchronously, in-process, taking the same fallback path upstream
binkd already has for platforms without fork()/threads (DOS - see
Config.h). That was an honest, working v1: only one binkp session
(inbound or outbound) could be active at a time. v10.5 replaced it with
a real CreateNewProcTags(NP_Entry=...) spawn per session, making
genuine concurrent sessions possible (e.g. an inbound connection arriving
while an outbound poll is already in flight, or multiple networks polled
back-to-back without waiting on each other).
Getting this right took more than just calling CreateNewProcTags:
- Argument handoff with no built-in mechanism.
NP_Entrytakes a bare function pointer - novoid*parameter likepthread_create(). The child is spawned atNP_Priorityone below the parent's current priority (me->tc_Node.ln_Pri - 1); AmigaOS's strictly priority-preemptive scheduler guarantees a ready lower-priority task never runs while a ready higher-priority task hasn't blocked, so the parent can safely writenewproc->pr_Task.tc_UserDataimmediately afterCreateNewProcTags()returns, with zero risk of the child observing it uninitialized - no semaphore/signal handshake needed. (An earlier design draft tried reusingSIGF_SINGLEas a signal-based handshake - wrong, sinceSIGF_SINGLEandSIGF_BLIT, graphics. library's blitter-arbitration signal, are the same physical bit perexec/tasks.h.) bsdsocket.libraryper-Process access. Roadshow's bsdsocket.library denies socket access to any Process other than the one that originally opened it, unless the opener callsSocketBaseTagList(SBTC_CAN_SHARE_LIBRARY_BASES, TRUE, TAG_DONE)(amiga_glue.c'samiga_socket_init()) - without this, every session process but the first would silently fail to use sockets at all.- Shutdown ordering. A
CreateNewProcTags(NP_Entry=...)child has nopr_SegListof its own - only the parent's segment list references the code it's running.exitfunc()'s AMIGA drain loop therefore waits indefinitely (with periodic progress logging) forn_servers/n_clientsto reach zero before actually exiting, rather than giving up after a few seconds the way theHAVE_THREADScase does - exiting out from under a still-running child risks it executing freed memory. - Existing thread-safety infrastructure, already active for AMIGA but
previously unexercised since
branch()never spawned anything concurrent:threadsafe(),MUTEXSEM/EVENTSEM,bsy_list's andftnnode.c's own dedicated semaphores,config_sem. A few genuinely unprotected spots were found and fixed alongside the new spawn path: the bare--n_servers/--n_clientsdecrements at session end (server.c/client.c), andftnq.c'sqn_free()unconditionally clearing every node's in-memorybusyflag on queue rebuild even for nodes whose sessions might still be running (now checksbsy_test()first).
Accepted, documented limitations of this first concurrent release:
errno (libnix's __errno) is a single unprotected global shared across
all concurrently-running Processes, and mypid (CRAM-MD5 nonce seed) and
rand()'s internal state are likewise shared/racy across concurrent
sessions - all judged low-severity and out of scope for this release. See
manual.txt section 05 for the full user-facing writeup.
~/tools/amiga-gcc-toolchain (bebbo's modern m68k-amigaos-gcc 13.4.0b),
-mcrt=nix13 - same convention as cnet-re/RoFTIC_C. Not ixemul.
export PATH="/home/spitfiretn/tools/amiga-gcc-toolchain/bin:$PATH"
make
branch.c: AMIGA case now spawns each binkp session as a real AmigaOS Process viaCreateNewProcTags()(v10.5+; ran synchronously, same path asDOS, through v10.4) instead of calling ixemul'six_vfork(). See the architectural-decision section above for the argument-handoff,bsdsocket.library-sharing, and shutdown-ordering details this required.Config.h: its#error "You must define HAVE_FORK or HAVE_THREADS"now also acceptsAMIGAas a valid third option.sem.h/amiga/sem.c: AMIGA had aMUTEXSEMtype and_InitSem/_LockSem/etc. already, but noEVENTSEMtype and no_InitEventSem/_PostSem/_WaitSem/_CleanEventSem(needed by e.g. theSLEEP()macro) - added both, as a mutex-protected flag polled viaDelay(). Theextern MUTEXSEM hostsem; ...block and its definitions inbinkd.cwere also gated onHAVE_THREADSonly - extended toHAVE_THREADS || AMIGA.iphdr.h: new#elif defined(AMIGA)branch.sock_init()/sock_deinit()callamiga_glue.c'sOpenLibrary/CloseLibrary.soclose()usesCloseSocket(), not regularclose()- bsdsocket handles aren't AmigaDOS file handles. Also definesstruct sockaddr_storageas an alias forsockaddr_in- this toolchain'snetdb.hhas realgetaddrinfo()/getnameinfo()(as bsdsocket.library inline-asm calls, verified working) but never definessockaddr_storage, since there's no real IPv6 support to size it for.amiga_glue.c/.h: the one genuinely-new file from the starting point, kept and extended. Providesamiga_socket_init()/_cleanup(), plus thin wrappers forselect()(→WaitSelect()) andinet_ntoa()(→Inet_NtoA()) - bsdsocket.library exports these under Amiga-specific names, not the plain BSD ones the rest of the codebase calls.run.c:run()(used bysrif.c's mail-event hooks, e.g. "run this program when a file arrives") now callsSystemTagList()- AmigaDOS's native command-line-interpreter call, the direct equivalent ofsystem().run3()(stdin/stdout/stderr-piped external commands - used by exactly one caller, an external-transport feature inclient.c) is stubbed to fail cleanly: making bsdsocket sockets and AmigaDOS file handles interchangeable the way Unix fds are (which a real implementation needs) is its own project, not something to rush.binkd.c:mypid(used by thePID()macro andmd5b.c's challenge nonce) is now set once at startup viaFindTask(NULL)- no real "pid" concept without fork.chld()/sighandler()(real SIGCHLD/waitpid machinery) stayHAVE_FORK-only; confirmed viacommon.h'scheck_child()macro that they're never reachable without it.client.c:n_clients(gatesdo_client()'s "can I start another poll" check, and its "queue is empty, quitting" exit condition) was only ever decremented forHAVE_THREADSorDOS/DEBUGCHILDat the end ofcall()- never forAMIGA. Harmless for a single-Ppoll, but fatal for polling more than one node in one invocation: after the first session, the stale non-zero counter meantdo_client()never correctly re-evaluated the queue, and the process just sat there after logging its own "session closed, quitting..." Fixed by addingAMIGAto the same#elifbranch asDOS/DEBUGCHILD.amiga/rename.c(new file, not present in the AmiBinkD-main starting point): implementso_rename(), whichsys.hmapsRENAME()to forAMIGA/UNIX(upstream's ownif (!RENAME(...))-based finalize/retry logic ininbound.cexpects POSIXrename()semantics- 0 on success). Went through two rounds: it originally called
AmigaDOS's
Rename()correctly, but got the return-value sense backwards (Rename()returns nonzero on success, same convention asLock()/CreateDir()/DeleteFile(), but the wrapper reported that as a POSIX failure and vice versa) and never seterrnoon the real failure path. See finding #8 below - this one was entirely our own bug, not an Amiberry divergence.
- 0 on success). Went through two rounds: it originally called
AmigaDOS's
amiga/touch.c,amiga/delete.c(new files, same pattern asrename.cabove): nativedos.libraryreplacements for libc calls that block indefinitely on this port instead of failing.utime()andunlink()each cost a live production stall before being replaced -unlink()was caught 2026-08-02 hanging an outbound poll for 40+ minutes immediately afterfound old .csy file, with none ofsdelete()'s own bounded-retry error messages ever appearing, which is what proved the task was stuck insideunlink()rather than looping around it.DeleteFile()andSetFileDate()are single bounded calls that return a real error for a locked file, which is exactly what the existing retry logic was written to handle. The rule this port now follows: on AmigaOS, prefer a boundeddos.librarycall that returns an error over any libc wrapper that might wait on a lock. (SetFileDate()turned out to block too - see "The session-hang arc" below.)amiga/getfree.c(new file):getfree()viaLock()+Info(), AmigaDOS's native free-space query, rather than thestatfs/statvfsvariants upstream selects between - none of which this toolchain has.amiga/msleep.c(new file): sub-second sleep, becausetools.c'sLog()retries opening the log file ten times with no delay between attempts. Tenfopen()calls take microseconds, so a competing task holding the file for a few milliseconds makes all ten fail and the message is discarded silently. Not cosmetic: on 2026-08-02 a dropped line made a session look like it hung insidetouch()when it had not, and sent the investigation after a bug that was not there. Sysops lose log lines the same way.Makefile:-MMD -MPplus-include $(OBJS:.o=.d), so headers are real prerequisites. Added in v10.18 after their absence produced a cleanly-linking binary that readconfig->pDomainsfrom the wrong address - see the second half of "The session-hang arc".- Compiler/libc quirks specific to this toolchain (none ixemul-related,
just this specific bebbo build's rough edges):
sys.hneeds-DHAVE_STDARG_Hor it falls back to pre-ANSIva_alist/va_dclvarargs syntax, which corrupts parsing of everything after it in the file.- Needs
-DHAVE_INTMAX_T(toolchain's own<stdint.h>already providesintmax_t/uintmax_t) and-DHAVE_SOCKLEN_T(already providessocklen_t) to avoid conflicting redefinitions. - Any file mixing
sys.h(pulls in<unistd.h>) with<proto/bsdsocket.h>(redefinesgethostname/inet_addr/select/ etc as inline-asm macros) must includesys.hfirst - otherwise the macros corrupt the plain prototypes processed afterwards. Hit this repeatedly; it's now a documented convention, not a one-off fix. srv_gai.c(real DNS SRV-record lookup) needsHAVE_RESOLV_H, which this toolchain doesn't have - excluded from the build;srv_gai.h's own fallback macro (srv_getaddrinfo→getaddrinfo) covers every caller.sys.hfalls back to definingPRIuMAX/PRIdMAXas"lu"/"ld"(4-bytelong) whenever<inttypes.h>hasn't already defined them - which is always, in this build. But this toolchain's realintmax_t/uintmax_t(confirmed via__UINTMAX_TYPE__) is 8-bytelong long, even on this 32-bit target. EveryLog()/msg_sendf()call passing more than onePRIuMAX-formattedboff_t/uintmax_targument in a single format string was corrupting its own variadic argument stream from that point on: each 8-byte value only got half-consumed by the 4-byte-wide%lu, shifting every later argument in the same call by 4 bytes. On this big-endian CPU that reads as the high 32 bits first - which is why a 7475-byte incoming file logged asreceiving foo.pkt (0 byte(s), off 7475)instead of(7475 byte(s), off 0), and, far more consequentially, corrupted the same fields in our outgoingM_GET/M_FILEprotocol messages, which is what was actually causing "missing tmp file" failures on every session with real mail queued. Fixed by definingPRIuMAX="llu"/PRIdMAX="lld"forAMIGAspecifically, ahead of the generic fallback.- This toolchain's
libgcc.ais missing double-precision soft-float routines (__adddf3/__muldf3/etc) under every CPU/FPU flag combination tried - a genuine toolchain gap (the symbols exist as text in the archive butld/ar/nmhere were all built without LTO plugin support and can't read them;~/tools/.../liblto_plugin.soexists but isn't wired up). Rather than touch the shared toolchain (other projects depend on it) or hand-write a software IEEE754 library, removed the only two realdoubleusages in the whole codebase (both were purely cosmetic - a live transfer-percentage counter inprotocol.c, and post-transfer CPS figures inprotocol.c/inbound.c's log lines) and rewrote them as integer/ fixed-point math. Also excludedsnprintf.cfrom the build - the toolchain's ownlibnixalready provides realsnprintf/vsnprintf, and upstream's fallback implementation needslong double(pow10/round) for%fsupport, which drags in the same brokenlibgccdependency for code we don't even need.
Every one of these compiled and linked fine, and looked correct from the header/API surface alone - each was only caught by actually running on real Amiberry. If something networking-related here seems to work in cross-compilation but misbehaves live, check this list before assuming the C code is at fault:
getaddrinfo()/getnameinfo()aren't implemented, despite<inline/bsdsocket.h>declaring them as real bsdsocket.library vector calls and this toolchain'snetdb.hhaving the matching constants - calling them caused a wild-jump crash (Guru8000000B, Line-1111/ unimplemented-instruction) on the very first call, before the config file was even opened. Fixed by forcingrfc2553.h's AMIGA path to always use upstream's own self-contained emulation (gethostbyname()- based) instead of trusting the real vector - seeiphdr.h's#undef getaddrinfoetc. andrfc2553.h's&& !defined(AMIGA).ioctl(FIONBIO)/fcntl(O_NONBLOCK)don't work on socket descriptors - they're AmigaDOS file-handle calls, and bsdsocket sockets aren't AmigaDOS file handles without ixemul's translation layer. Silently failed ("No such file or directory") every time, meaning sockets were never actually non-blocking. Fixed iniptools.c'ssetsockopts(): AMIGA now usesIoctlSocket(), bsdsocket.library's real equivalent.- A select()-ready listening socket's
accept()is not guaranteed non-blocking, unlike real BSD sockets. This was the original, hardest-to-find bug: server accepted a connection fine, butaccept()then blocked forever right afterselect()had just reported that exact socket as ready - no crash, no error, just silence. Every other socket in the codebase gets set non-blocking viasetsockopts()(protocol.c, on the accepted session socket) but the listening socket itself never did on any platform, since it was never needed before. Fixed inserver.c'sdo_server(): explicitlysetsockopts()the listening socket too, and treatEWOULDBLOCK/EAGAINfromaccept()as a normal retry instead of a fatal error. WaitSelect()'ssignalsparameter (for waking on Exec signals likeSIGBREAKF_CTRL_C, not just socket activity) doesn't work - passing it made no difference; Ctrl-C/Breakstill couldn't interrupt a blockedselect()call, hanging a stuck process past even aBreak <pid> C(needed a full reboot to clear).- Calling
WaitSelect()too rapidly breaks it - a first fix attempt for #4 polled in a tight 0.25s loop instead, checkingSetSignal()for CTRL_C between calls. That surfaced yet another bug: after a handful of rapid successive calls,WaitSelect()started returning-1witherrnoleft at 0 ("No error"), no real error condition. Fixed inamiga_glue.c'sselect(): when the caller already provides a bounded timeout (true almost everywhere in this codebase), make exactly oneWaitSelect()call - matching original/vanilla call frequency - then check CTRL_C once after, viaSetSignal(0, mask)(notCheckSignal()- this toolchain's<proto/dos.h>resolves to an olderndk13-includevariant that doesn't declare it). Only polls (in 1s steps) for the rarer case of a caller wanting to block indefinitely. - Reverse DNS (
backresolv) on a private/non-routable IP can hang the session - not an Amiberry bug exactly, but a real trap: withbackresolvenabled, an inbound connection from a LAN address (e.g.192.168.x.x) triggers a synchronous reverse-lookup that can never resolve, blocking that session until the remote side's own protocol timeout gives up first. Through v10.4's synchronous-only concurrency model this blocked everything else too; since v10.5's real concurrency it only blocks the one affected session process, but it's still a session that never completes on its own.backresolvis purely cosmetic (nicer hostnames in the log) - fine to leave disabled. n_clientssilently never decremented for AMIGA (client.c'scall()) - same class of bug asn_serversinserv()(server.c), but not harmless like that one:n_servers's only consumer (check_child()) is a no-op withoutHAVE_FORK, whilen_clientsdirectly gatesdo_client()'s decision to poll the next queued node. A single-Ppoll never surfaced it (nothing left to decrement for); only testing multiple-Paddresses in one invocation - or the equivalent, polling several networks back-to-back via separateExecute <net>.scrinvocations from a driver script - exposed it as a hang right after the first session's own "session closed, quitting..." line. See theclient.cbullet above for the fix.o_rename()(amiga/rename.c) had success/failure backwards, and never seterrno- unlike the other findings here, this was a bug in code we wrote for this port, not an Amiberry/bsdsocket_emu divergence, but it was just as invisible until live testing: AmigaDOS'sRename()returns nonzero on success (the standard AmigaDOS BOOL convention, same asLock()/CreateDir()/DeleteFile()), but the wrapper reported that as a POSIX failure (-1) and a real AmigaDOS failure as POSIX success (0) - inverted - and set noerrnoon the failure path either.inbound.c's finalize-the-received-file logic checkserrno(EEXIST/EACCES/EAGAIN) to decide whether to retry under an alternate filename or give up; with both bugs stacked, a rename that had already succeeded on disk got reported as failed, with whatever staleerrnohappened to be sitting around (often 0, logging the actively misleadingcannot rename foo.pkt to it's realname: No error!). This silently orphaned a real backlog of received-but-never-finalized packets under their temp names inInbound_Temp/before it was caught - clearing on the next successful Toss run once the fix landed. Fixed by inverting the return mapping and translatingIoErr()to a realerrnovia a small switch (EEXIST/ENOENT/EBUSY/ENOSPC/EROFS/EXDEV/EINVAL/ENOMEM,EIOfallback).- UDP/datagram sockets don't reliably work at all - discovered while
chasing finding #11 below. A standalone test program doing nothing but
OpenLibrary("bsdsocket.library")+socket(AF_INET, SOCK_DGRAM, 0)- one UDP send/receive hung indefinitely, twice, on two different
instance ages (including immediately after a full guest reboot) -
frozen before any actual network I/O, meaning the problem is in
bsdsocket_emu's own socket handling, not anything DNS/UDP-protocol specific. This project has no current use for UDP (BinkP is TCP-only) so it's undeveloped rather than fixed - noted here so nobody reaches for a UDP-based feature on this platform without testing it in isolation first.
- one UDP send/receive hung indefinitely, twice, on two different
instance ages (including immediately after a full guest reboot) -
frozen before any actual network I/O, meaning the problem is in
- A blocking
bsdsocket.librarycall's internal completion notification never reaches a spawned, non-opener Process - the hardest bug in this whole project, and the real explanation behind what looked like several separate problems. Since v10.5, every outboundconnect()(and, it turned out, everygethostbyname()call too) runs inside aCreateNewProcTags-spawned child (branch.c) that isn't the Process that originally openedbsdsocket.library(amiga_glue.c'samiga_socket_init(), called once in the top-level process, withSBTC_CAN_SHARE_LIBRARY_BASESopted in so children can use that same shared instance at all - see the concurrency section above). That function's own comment already flagged the relevant documented tradeoff (SBTC_SIGIOMASK-style per-Process signal delivery only reaches "whichever Process last configured it") but reasoned only aboutselect(), which this codebase already uses in bounded-polling mode, not signal-wait mode. It missed that a blocking library call's own internal completion notification likely depends on that exact same mechanism - so a spawned child's blockingconnect()/gethostbyname()call never gets woken up, even though the real underlying operation (confirmed via a livetcpdumpcapture: TCP handshake and the remote's data both completing in well under a second) succeeds just fine at the kernel level the whole time. Two non-blocking-socket workarounds (select()-based, then a manual poll-loop) were both tried first and both failed identically live, which is what proved this wasn't about blocking-vs-non-blocking connect() at all. Fixed by giving each spawned child its own private, unsharedbsdsocket.libraryinstance for its whole session- redefining
BSDSOCKET_BASE_NAME(the macro all ~40 ofbsdsocket.library's call-site stubs resolve through) to a function,amiga_current_socketbase(), that returns a Task's own private base (stashed intc_UserData) if it opened one, or falls back to the existing shared base otherwise - so every other Process (the top-level opener, inbound session children, which were never affected since their I/O is already non-blocking+select()-based) sees zero behavior change. Confirmed live across all 7 configured networks, an overnight soak with zero failures, and (once the same diagnosis was applied togethostbyname()too) a further two-day, two-reboot soak with ~60 clean poll cycles per network.
- redefining
Not a code bug, but cost real debugging time so it's worth recording:
the driver scripts that poll each network in sequence (cnet.scr,
pinet.scr, etc., invoked in turn by FTN_Poll) are plain AmigaDOS
Execute scripts, which use ; for comments - # is not a comment
character and Execute tries to run it as a literal (nonexistent)
command. Two of the seven per-network .scr files had #-prefixed
header comments (leftover from a Unix-shell-style template) that made
Execute fail immediately on the first line with Unknown command /
failed returncode 10, aborting not just that script but the whole
calling FTN_Poll chain - which looked identical to a code-level hang
until the exact stopping point was isolated by running each .scr
standalone.
This is the most consequential bug the port has had, and it hid behind a plausible-sounding assumption for four releases.
Symptom. Every inbound session logged incoming from ... and
incoming session with ..., then produced nothing — no error, no
timeout, no close. Meanwhile the remote gave up with Session timeout /
Authorization failed. Because a hung session never released the server
slot, the second connection after a restart was refused outright, so
inbound mail died within minutes of every start and only a restart
appeared to "fix" it. Outbound polling was flawless throughout, which is
exactly what made this so easy to misread as a network or peer problem.
What the sockets showed. The decisive measurement was on the host, not in the log:
ESTAB Recv-Q 285 ...:24554 <- peer bytes_received:285 (no bytes sent at all)
The peer's greeting had arrived and was never read, and we had never put
a byte on the wire — despite the log dutifully printing send message NUL SYS .... Those log lines record frames being queued into the output
buffer, not transmitted. Both halves of the session's I/O were dead, not
just the read side.
Cause. servmgr runs in the Process that opened
bsdsocket.library (binkd.c calls servmgr() directly), so accept()
is fine. Each session is then spawned as its own Process by branch() —
and that child went on using the shared SocketBase for a socket it
did not own.
v10.12 diagnosed precisely this ambiguity for outbound connect() and
fixed it with a private per-child library base, but explicitly exempted
inbound on the reasoning that the shared "select()-based I/O path ...
never depended on signal delivery in the first place". That was wrong:
amiga_glue.c's select() is implemented on WaitSelect(), which
is a signal-wait. Its readiness signals go to whichever Process the
library last associated as "the caller" — never the child. So the child's
select() never reported the socket readable or writable, and the
session sat forever.
Fix. AmigaOS descriptors are meaningless across SocketBases, so the
socket has to be transferred rather than shared — bsdsocket.library's
documented mechanism for exactly this:
do_server(), afteraccept():ReleaseSocket(fd, UNIQUE_ID)detaches the socket and returns a transfer id. That id, plus the address family, is whatbranch()hands the child. Ifbranch()fails the parent re-ObtainSocket()s it, so the socket is never orphaned inside the library with no owner left to close it.serv(), in the child:amiga_open_private_socketbase()first, thenObtainSocket(id, family, SOCK_STREAM, 0)to re-materialise the socket inside that private base. The base is closed aftersoclose(), since the socket lives in it.
Non-AMIGA builds keep the original path untouched under #else.
A symptom that looked like a second bug. While inbound was broken,
stalled sessions also never honoured timeout (nettimeout,
DEF_TIMEOUT = 5 min), lingering 46 minutes and longer. That needed no
separate fix: the timeout is driven by the same select() loop that was
dead. With select() working, a dead-air probe session now tears itself
down in ten seconds.
Verified live (2026-07-31, v10.16): five consecutive real inbound
sessions from the hub in 44 seconds, full handshake and CRAM-MD5 auth,
two packets received into Inbound/, clean downing server... teardown
each time, no leftover .bsy locks, listener still accepting afterwards.
Outbound unchanged — the same run's 5:00a poll pulled 13 files /
45,581 bytes from fidonet.
Lesson for anyone extending this port: any Process that is not the
one which opened bsdsocket.library must have its own library base, and
must obtain its sockets through ReleaseSocket/ObtainSocket. Sharing a
base across Processes via SBTC_CAN_SHARE_LIBRARY_BASES makes calls
succeed while silently breaking everything that depends on per-Process
signal delivery — which includes WaitSelect(), not merely blocking
connect().
Making inbound run (v10.16, above) exposed what happens when a session that runs can also hang. Two releases and two distinct bugs later it is closed. Both bugs are the same shape, and it is the shape that matters more than either instance: a call that blocks forever instead of failing, made while holding something other sessions need.
Inbound went dead daily. n_servers ratcheted upward until it crossed
max_servers (default 100) and every incoming session was refused with
too many servers. Outbound kept working throughout — separate process per
cycle — which is exactly what masked it.
Counting step markers across a 13-hour run pinned it:
handoff: child base= 213 inbound children started
handoff: child closing 108 -> 105 stranded
pass 0 SELECT in/out 236/235 select is fine
pass 0 bsy_touch in/out 236/136 <- 100 stranded here
bsy_touch() held a single global semaphore across touch() and Log()
for every entry in bsy_list. One session blocking in that I/O pins the
semaphore, and every sibling then blocks forever in ObtainSemaphore() on
the next pass of its protocol main loop. It is self-amplifying: stranded
sessions keep their .bsy entries, so the list grows, so the lock is held
longer, so more sessions strand.
Two changes, either of which alone breaks the chain:
TryLockSem()— non-blocking acquire viaAttemptSemaphore()(amiga/sem.c,sem.h).bsy_touch()now skips its pass rather than ever blocking on the lock. Touching.bsyfiles is cosmetic upkeep andBSY_TOUCH_DELAYalready tolerates being early or late.- No I/O under the lock.
bsy_touch()claims the pass, copies eachfa/btout under a brief lock, releases, then touches unlocked. Safe because cells are never freed (bsy_get_free_cell()reusesFA_ZERO'd ones) andbsy_add()only prepends, so it cannot splice into the part of the list still ahead of the walk.
Worth recording as a dead end: an earlier double-checked lock did not help. Cutting the number of acquisitions does nothing about a lock held across blocking I/O.
v10.17 measured 105 leaks → 13. Better, not fixed: a session could still
hang alone inside touch() itself. Counting markers across a 26-hour run
split the behaviour cleanly by time of day:
inb_done() commit path
day (07:04-21:00): touch in 66 / out 63 fine
night (21:00-09:06): touch in 7 / out 0 every one hung
The difference was the BBS's own overnight file-catalog jobs holding
Inbound_Temp. touch() is SetFileDate() on this port — written
precisely because the generic utime() blocked — but it blocks too when
another Process holds the object. It does not fail, it never returns,
AmigaOS gives it no timeout, and the session has no watchdog.
The cost was never just leaked sessions. One such hang inside a poll client
meant the driver script never finished, so CNet's event scheduler stayed
blocked for 17 hours: outbound mail dead, tossing stopped, packets piling
up in Inbound/, inbound sessions accumulating toward max_servers.
Fix: new config keyword set-file-dates, default off on AmigaOS and
on everywhere else so upstream behaviour is unchanged. Gated at
bsy_touch() (bsy.c), inb_done() (inbound.c) and the GET-violation
path (protocol.c), plus a backstop inside amiga/touch.c itself so
srif.c — and anything added later — is covered without anyone having to
remember. What it gives up is cosmetic: received files carry arrival time
rather than the sender's timestamp.
Measured live over 18h, spanning the overnight window that broke v10.17:
v10.16 v10.17 v10.18
saturated 13h ~4 days no
children start/close 213/108 46/33 89/89
n_servers peak 100 cap 14 -> 56 5
inb_done touch in/out 66/63* 7/0* 351/0
scheduler events hung 17h 59/59 finished
* day/night split above; v10.18 never calls touch() at all.
More dangerous than the hang, and worth its own warning: adding
set_file_dates to the middle of BINKD_CONFIG shifted every later
member. The Makefile rule was a bare %.o: %.c, so editing readcfg.h
rebuilt only translation units whose .c had also changed — ftnq.o,
ftnaddr.o, client.o and server.o kept the old offsets.
The binary linked. It ran. It read config->pDomains from the wrong
address: every domain but the last came back unknown domain, and six of
seven networks silently stopped polling their hub. Nothing crashed; it just
quietly stopped calling out.
The struct change was legal — the build was not. Fixed with -MMD -MP
and -include of the generated .d files. Verified: ftnq.o now depends
on readcfg.h, and unknown domain went 36 → 0 after a clean rebuild.
If you are working from an older checkout of this tree, make clean
before trusting a build.
Every count above came from step markers through banner(), the protocol
main loop and inbound.c's commit path. They are not in the shipped build
(about 800 KB of log per day), but they are preserved whole and
re-appliable:
git apply diag-instrumentation.patch # re-add
git apply -R diag-instrumentation.patch # remove
Two cautions if you use them. Read the counts filtered by timestamp,
never by line position — the log has two writers with independent
offsets, and position-based analysis produced a confident false negative.
And if you have nolog masks in your config, comment out handoff:* and
clientmgr* first: masked, these greps return zero, which reads as "no
sessions" rather than "not logged".
Upstream binkd's -P takes one FTN address per switch, so this BBS drove
it the way the "Status" section above describes: one .cfg and one
.scr per network (cnet.cfg + cnet.scr, fidonet.cfg +
fidonet.scr, ...), invoked in sequence by FTN_Poll. Seven networks
meant fourteen files to keep in step, and every config-wide change (a new
inbound path, a loglevel bump, disabling backresolv) had to be made
seven times. FidoBlitz, the other Amiga binkp mailer on this system,
instead accepts fidoblitz -p -PALL fidoblitz.cfg - one config listing
every uplink, one command that polls all of them.
v10.15 adds the same thing here, so AmiBinkD -p -PALL AmiBinkD:AmiBinkD.cfg
polls every network in one run (rofftn.scr). AmiBinkD.cfg already
listed all seven domains/addresses/nodes because the server side
(AmiBinkD -s AmiBinkD.cfg) has always used the merged config; this makes
the client side use the same one file.
Implementation (poll_all_nodes() in ftnnode.c, dispatched from
binkd.c's poll-creation loop when the -P argument is ALL,
case-insensitively): iterate the config's node array with the existing
foreach_node() and create_poll() for each, i.e. the same
per-node work poll_node() already did, minus the address parsing.
ALL can't collide with a real -P argument because it isn't a valid
Fido-style address - the old code path would just have logged
"ALL cannot be parsed as a Fido-style address".
Two nodes are deliberately skipped rather than polled:
- Nodes with no host to call (
hostsunset or-).q_not_empty()already refuses to call those, so creating polls for them would only litter the outbound with.dlofiles nothing ever picks up. Logged at loglevel 4 and counted in the summary line. - Our own addresses (anything in
config->pAddr), in case one is also listed as anode.
Note the concurrency consequence, which is a config matter rather than a
code one: with every uplink pollable in a single run, the clientmgr will
spawn up to maxclients outbound sessions at once, and the default is
100 - i.e. all seven networks simultaneously, where the per-.scr
pattern was strictly one at a time. This BBS's AmiBinkD.cfg now sets
maxclients 2 (what fidoblitz.cfg uses for the same node list) plus
call-delay 5, because do_client() sleeps call_delay - default 60s -
every time it finds maxclients sessions already running, which would
otherwise idle a full minute between each pair of polls. The per-network
.cfg/.scr files are untouched and still work if a single network ever
needs to be polled by itself.
A sysop could not tell where one session ended and the next began, and the useful lines were buried. Three things fixed that, and only the first is code:
- Five lines in
client.c— a blank line before each outbound session and before the finalEND, plus an explicitENDmarker. Stock binkd runs sessions together with nothing between them and finishes onthe queue is empty, quitting.... The separation is the single biggest readability win and there is no way to get it from config. loglevelandnolog, which binkd already ships — config, not code.loglevel 4is the useful setting: level 3 is what emits the remote's identity block (SYS/ZYZ/LOC/NDL/VER/TIME), so at level 2 sessions look anonymous. SeeAmiBinkD-example.cfgfor a commented mask set.- Five message strings shortened for 80-column width, measured against
a real poll:
BEGIN120 → 68 columns,rcvd:89 → 71,Polling(wascreating a poll for) 82 → 70,Outgoing:/Incoming:(wasoutgoing/incoming session with),END84 → 66. Over-80 lines per poll went from 9 to 4.
That third item is a deliberate divergence from stock binkd, made for line width and portability. If an upstream merge ever conflicts on wording, this is why. An earlier attempt that renamed messages purely to match a reference log was reverted — it diverged from every other binkd log in FTN and broke anything that parses them, all for cosmetics obtainable from config. Do not re-introduce message renames for looks.
Two nolog traps that cost real time:
- One mask per WORD.
nolog receiving *addsreceivingand*, and*matches every message — the log goes completely silent while the mailer runs normally. Masks must be single tokens;*spans spaces on its own, so*->*Inbound*still matchesx.pkt -> Inbound/x.pkt. - Masks hide your own diagnostics.
handoff:*andclientmgr*cover the counters that found the whole v10.16-v10.18 leak. Comment them out before diagnosing a stall.
The mailer no longer identifies itself as part of any one BBS package. It
reports VER AmiBinkD v10.18-binkp/1.1, the same shape remotes use
(Mystic/1.12A49 binkp/1.0). Branding lives in the distribution's text
files only.
- No zlib/bzip2 compression (
WITH_ZLIB/WITH_BZLIB2not defined - matches the historical Amiga build, which also shipped without them). - No DNS SRV-record lookups (see
srv_gai.cnote above). run3()'s piped external-transport feature is stubbed (logs and returns failure) - not a core binkp/FTN feature, only one caller.- Multi-week production-scale soak testing. Every release since v10.5 has been gated on an unattended overnight run (see "Soak test results" below), and v10.18 has now held clean across a full night with zero errors - but that is nights, not weeks, and on one system.
errno's exposure at everyTCPERR()/TCPERRNOcall site besides thegetpeername()/getsockname()critical section fixed for real concurrent load (client.c's outbound connect/socket/bind,server.c's servmgr setup,iptools.c's ioctl paths) - same class of shared-global race as finding #10 above, but forerrnospecifically rather than bsdsocket.library's internal notification mechanism. Unconfirmed as an active problem at these other sites, not yet fixed.backresolv(reverse/PTR lookups) is disabled in this BBS's deployed configs as a precaution, even though finding #10's fix likely also covers it (same call class, same spawned-child pattern) - just hasn't actually been re-tested live the way outboundgethostbyname()was.conlogis the one element of v10.18 not proven. It was disabled here on 2026-08-01 on suspicion of freezing CNet's Control window when the poll runs underExecute, and re-enabled for the v10.18 soak, which was clean- but 19 hours is not proof. If your BBS front-end freezes during or
after a poll, comment out
conlogbefore investigating anything else.
- but 19 hours is not proof. If your BBS front-end freezes during or
after a poll, comment out
- Per-node password mismatches surfaced during testing are a config
issue (
AmiBinkD.cfg'snodelines vs. what the hub expects), not a code bug - worth double-checking all configured nodes, not something this port needs to fix. - One tossed fidonet packet (
5d79da03.pkt) logged7 msg(s) (0 dupe(s)/7 bad)by CNet's own Toss - not yet investigated; likely pre-existing malformed mail rather than anything in this port, but worth a look if it recurs on fresh packets.
v10.18 — 2026-08-10 → 2026-08-11, 19h37m. The release soak, run
unattended under the normal 30-minute FTN_Poll schedule across all seven
networks:
- 22 poll cycles: 22
BEGIN/ 22END, no unmatched starts. - 29/29 scheduled events finished.
- 66 sessions, all
OK; 82 packets received; both queues drained. - Zero errors, zero warnings.
- Zero
find_tmp_name: ... busy, and zero orphaned partials left inInbound_Temp(seekill-old-partial-filesbelow).
Two long-standing cosmetic items from earlier releases are gone as of this
run and are no longer listed as open: the .csy/.bsy error unlinking '...': Text file busy that used to fire on essentially every session, and
the rare error unlinking '...Inbound_Temp/*.dt': No such file or directory. Both were addressed by the ETXTBSY retry and by amiga/delete.c
replacing unlink() with a bounded DeleteFile().
One config change came out of this soak and is in the shipped example:
kill-old-partial-files 2h. Thirteen orphaned .dt/.hr pairs had
accumulated in Inbound_Temp, and every session logged find_tmp_name: ... Text file busy scanning past them. Two hours is long enough for an
interrupted transfer to be resumed on the next poll; the 2013 Amiga port
used 30 seconds, which is aggressive enough to destroy a still-resumable
partial.
Earlier soaks, each gating its release: an overnight run after finding
#10's fix (14/14 clean cycles per network); a two-day, two-reboot run
confirming that fix also covers gethostbyname() (~60 clean cycles per
network, one non-reproducing blip on the first reboot); a 14.5h run for
v10.17 (0 too many servers, against v10.16 saturating in 13h); an 18h run
for v10.18 spanning the overnight window that broke v10.17 (89/89 children
start/close, 59/59 scheduler events). The original 2026-07-19 run predates
the concurrency path entirely and is superseded by all of the above.
binkd is by Dima Maloff and its many contributors; this is a port of
upstream binkd/1.1a-115, not a rewrite. COPYING and HISTORY are
upstream's and unmodified.
Rudi Timmermans (X-TReMe BBS) wrote the earlier Amiga port, AmiBinkD v5.00-v9.02 (2012-2013), built against ixemul.library. This port starts from clean upstream rather than from his tree, but it carries his name for the obvious reason — he did this first, on harder ground, and the log format his v9.01 produced is close enough to this one that the two are recognisably the same program a decade apart.
GPL-2.0-or-later, inherited from binkd. This is a port of
pgul/binkd, whose every source file carries
the GNU General Public License v2 header, so this work cannot be released
under anything more permissive. The full text is in LICENSE (and COPYING,
as upstream ships it).
binkd is copyright Dima Maloff and others. The AmigaOS port is by Gary "Spitfire" McCulloch.