-
-
QNX 8.0.0 boots in QEMU and runs its own acceptance gates: core, device, deadlines, SLM restart and forecast all pass.
-
Staff acknowledge on the device: `ack who=Clinic.Team_1` written to /dev/fridge0 is accepted once; a duplicate is refused.
-
Limits change atomically (an inverted range is refused), and the advisory trend reports to_high with an ETA before any alarm.
-
The daemon is killed with signal 9; SLM restarts it and a new process serves /dev/fridge0 again.
-
The audit exported over the QNX serial console is verified on the host: checksum, SHA-256 chain, byte-identical replay.
-
`fgctl report` on that audit: chain checked first, who acknowledged and when, and the unknown interval after the restart.
-
The HTML inspector report rendered from the same QNX boot, published at docs/evidence/sample-report.html.
Inspiration
A fridge door left ajar at closing time is an ordinary mistake, and the clinic still has to answer for it the next morning. CDC guidance says a temperature excursion requires immediate action and asks staff to document when it happened, the minimum and maximum temperatures, how long the vaccine may have been affected and who reported it. Vaccine appearance is not a reliable indicator of exposure, and failing the cold chain can mean extra doses for patients and more wastage and cost for providers. We wanted a guard that makes excursions, escalation and missing observations inspectable, instead of reducing everything to a reassuring green light.
We chose QNX for three reasons this project demonstrates on the target. Fixed priorities keep the sampler and alarm checks passing under lower-priority CPU load. A crashed daemon is one restartable process under SLM, not a reboot. A resource manager lets any POSIX client read the fridge without a custom protocol. It is also a market QNX already serves: its medical devices page names patient monitoring and drug delivery systems.
Our submission is a working software prototype with a simulated sensor on QEMU. It is not a medical device, a validated monitoring system or evidence that any vaccine is safe to use.
What it does
Cold-Chain Guard exposes a simulated fridge through /dev/fridge0. A POSIX read returns temperature, sensor validity, alarm state and advisory trend. An atomic write changes the temperature limits and hysteresis; invalid commands leave them unchanged.
The portable core tracks excursions, sensor loss, recovery and an escalation ladder. Staff acknowledge an active alarm through the same device, printf 'ack who=Clinic.Team_1\n' > /dev/fridge0: the name goes into the audit and is synchronized before the write returns, escalation stops, and alarm=1 stays set until the temperature recovers; a fault that continues re-arms after 60 minutes. A second acknowledgement, an invalid name or an acknowledgement with no active alarm returns EINVAL and changes nothing. The name is not authenticated, and there is no external notification service: an audit event is not proof that a message reached someone.
The next morning, fgctl report turns a verified audit into one HTML page that a clinic manager or inspector can read on a phone or print. Each excursion gets a card with its start, end, duration, minimum, maximum and who acknowledged it and when, or not acknowledged. The report checks the whole chain before printing anything, separates sessions at every restart gap, and states what the prototype does not record: calendar date and time, room temperature, vaccine inventory and actions taken. The sample report in the repository was generated from the audit exported by a real QNX boot.
An explainable linear forecast offers advice about movement toward a limit. Sensor gaps and accepted limit changes reset its window. It cannot delay, suppress or clear the actual alarm.
SLM restarts the daemon after an injected process death. The resumed audit preserves its verified prefix and declares an unknown interval, with process-relative clock and alarm-state reset. It does not invent missing readings or preserve an ongoing escalation deadline across a crash.
Our host tool, fgctl, validates scenario files and summarizes verified audit records. A deterministic replay runs the production core and storage modules on QNX, exports the audit over the serial console, then checks its checksum and chain on the host. Comparing that export byte for byte with a host replay of the same CSV also catches a self-consistent truncated replay. This comparison is specific to the deterministic fixture, not a guarantee for a live sensor log.
How we built it
We separated a portable C11 core from the QNX adapter. src/core/ contains the alarm state machine, SHA-256 audit chain and advisory forecast. src/fridged/main.c registers the resource manager with resmgr_attach, installs POSIX handlers through iofunc, and drives sampling with a CLOCK_MONOTONIC timer delivering SIGEV_PULSE events into the dispatch loop.
The daemon selects fixed SCHED_FIFO priority and a _NTO_CHF_FIXED_PRIORITY channel; timer pulses use the same explicit priority. config/slm-fridged.xml supplies restart policy and device-path readiness. Our boot scripts cross-compile with QNX SDP 8.0 qcc -Vgcc_ntox86_64, assemble a QEMU image with mkqnximage and run acceptance checks on QNX 8.0.0 x86_64.
On the host, Make builds with strict warnings, AddressSanitizer and UndefinedBehaviorSanitizer. On the target, checks exercise real resource-manager reads and writes, application deadline acceptance under lower-priority CPU load, crash restart, advisory reset behavior and serial export. These are pass/fail checks against our synthetic application fixtures. We publish no benchmark, measured timing, throughput or performance comparison of QNX.
Challenges we ran into
A correct hash chain does not prove that an export is complete. We deliberately removed a valid tail and recomputed the transfer checksum; the remaining chain still verified. The replay workflow now requires equality with an independently run host replay of the same input. Live logs still need an external trusted final anchor to detect valid tail removal or full-chain replacement.
A restart also cannot tell us what happened while the process was absent. We made the gap part of the data model. Complete corrupt records prevent startup; only an incomplete suffix can be discarded after its prefix verifies, and the next gap records that discard. The demo uses volatile /tmp storage, so synchronization calls are exercised without claiming power-loss persistence.
Mutation checks exposed weaknesses in our tests, including an assertion that accidentally matched sensor recovery when it meant temperature recovery. We tightened the assertions rather than treating a green test suite as sufficient evidence.
Accomplishments that we're proud of
We can follow one reproducible path from a CSV scenario to a QNX target replay and a host-verified audit, and anyone can recheck that audit without a QNX license from the literal boot console in docs/evidence/. The same repository contains the device adapter, supervisor fixture, host tools and acceptance tests, with documented failure cases and limits.
Our demo is the real QNX console: the boot reports successful core, device, application-deadline, restart, forecast and serial-export gates, then a live session reads the device, changes its limits and kills the daemon under SLM. The audit exported by that same boot is then verified on the host against a fresh replay. Separate deliberate mutations are rejected, as recorded in docs/build-plan.md. Host checks do not substitute for QNX execution.
We also published a companion codelab that takes a Mac developer from headless SDP setup to a resource manager built and booted on QNX in QEMU.
What we learned
Recovery must describe uncertainty, not hide it. A new process serving the device is useful evidence; it does not establish continuous observation. A checksummed export is useful evidence; it does not establish authenticity. A predicted crossing is useful advice; it does not establish clinical safety.
QNX resource managers let us present the guard through ordinary file operations, while explicit pulse priorities and supervision make the operating-system integration concrete and testable.
What's next for Cold-Chain Guard
We want to validate a physical temperature probe on supported hardware, anchor the audit to calendar time, then test persistent media and power-loss behavior. A Raspberry Pi 5 and a 1-Wire probe are possible next steps, not completed integrations. External notifications, authenticated operator identity, stalled-process detection and trusted audit anchoring also remain future work. Physical sensing and any clinical use require validation beyond this prototype.