zds is running on a 2011 Raspberry Pi 1 Model B (ARMv6, 512 MB) at pi.chadtmiller.com — live and federating with the relay network. Two changes were needed to get there; both are no-ops on 64-bit targets.
1. fix(sync): nowMillis() overflow #
On targets where timespec.sec is 32-bit, ts.sec * 1000 overflows for any
current date, so the server trapped at startup. Widening to i64 before the
multiply fixes it; on 64-bit targets the math is unchanged.
2. feat(core): PortableAtomic #
ARMv6 has no 64-bit atomic instructions, so std.atomic.Value(u64/i64) fails
to compile. PortableAtomic(T) is exactly std.atomic.Value(T) when the
target's native atomic width covers T, and otherwise falls back to a
spinlock-guarded value (acquire via cmpxchgWeak + Thread.yield). The four
64-bit atomics (store next_seq, DatabaseMutex.acquired_at_ms, eventlog
latest_seq, sync crawler_last_notified_ms) switch over.
Verified #
zig build testpasses (zig 0.16.0)- Native 64-bit ReleaseSafe build unchanged/passing
-Dtarget=arm-linux-musleabihf -Dcpu=arm1176jzf_sReleaseSafe build passes- Running in production on the Pi 1 (~7 MB RSS)
Note: a full 32-bit build also needs two small fixes in zat (comptime
struct-size asserts in cbor.zig that hard-code 64-bit pointer sizes, and a
std.atomic.Value(u64) byte counter in transport.zig). A follow-up pull to
the zat repo with those is ready to send if there's interest.
- Claude