Inspiration
Every QNX driver, port and robot stack ends up needing a resource manager: a process that owns a /dev path and answers open, read, write and devctl. Today each one is hand-made from the docs: the dispatch and iofunc boilerplate, the thread pool, the pulse timer, the devctl table, the security policy, the build files. Then there is no standard way to prove it works on a real QNX 8.0 target without a manual boot, copy and poke session. We wanted the boring part to be one command and the proof to be automatic.
What it does
resmgr-kit is a host tool (Linux or macOS with a Linux build host, Python, Apache-2.0). It produces QNX 8.0 software and tests it on QNX.
- Write a short YAML spec: device path, state fields with ranges, read format, devctl commands, optional pulse timer.
resmgr-kit gen spec.yamlchecks the spec (a bad range stops with the field name, exit 2) and writes a complete resource manager in C, a shared header, a small client, a qcc Makefile, a buildfile fragment, a secpol snippet and a pytest file.resmgr-kit test spec.yamlbuilds with qcc, starts or reuses QNX 8.0 in QEMU, copies the binaries over ssh, starts the resource manager, runs the generated tests from the host against the live /dev path, printsuname -afrom the target and writes junit.xml. It exits 0 only when every test passes.- Four worked examples (vsensor, estop, counter, vsensor_ai):
/dev/vsensor0(read gives the latest sample, SET_RATE clamps to 1..1000 Hz, pulse timer drives samples),/dev/estop0(write 1 to trip, a client arms a pulse with ARM_NOTIFY and receives it on the trip),/dev/counter0(the codelab's tick counter with a RESET devctl) and vsensor_ai (the sensor with SET_RATE and the write handler generated in AI mode). - Measured on our own runs: vsensor 13 tests passed, estop 15 tests passed on QNX 8.0 under QEMU; the host-side test suite passes with no QNX toolchain.
- AI mode (optional): a devctl or write handler can be marked
impl: aiwith a plain-Englishbehaviour:line.resmgr-kit ai spec.yamlasks a model for the body of each marked region, refuses replies that touch markers, preprocessor lines or unbalanced braces, then builds with qcc and runs the live tests on the target. A compiler error or failing test goes back to the model, up to--max-iterrounds (default 3). Real run: iteration 1 "2 failed, 11 passed", iteration 2 "13 passed": https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/ai-real-run-fail-fix.txt ; single-round run: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/ai-real-run.txt ; two AI regions (SET_RATE and the write handler) green on iteration 1, "15 passed": https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/ai-real-run-two-regions.txt
Why QNX, why real-time
Sensor and actuator nodes in cars, factory cells and physical-AI robots sit on QNX because a resource manager gives each device a POSIX path with message-passing isolation and a deterministic scheduler. resmgr-kit makes that node cheap: the 25-line vsensor YAML becomes 479 lines of C (resource manager, header, client), a 131-line live test suite and 57 lines of Makefile, buildfile and secpol (wc -l: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/line-counts.txt). The suite passes on QNX 8.0 ("13 passed in 4.78s"), and the codelab takes a new user to a tested /dev node in about 15 minutes.
Evidence of QNX use
- https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/resmgr.c.j2 :
dispatch_create,resmgr_attach,pulse_attach,timer_createwithSIGEV_PULSE,thread_pool_create, iofunc handlers. - https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/secpol.j2 and https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/secpol-deny.txt / secpol-allow.txt (secure-mode QNX 8.0, failing and passing case).
- https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/build.j2 (buildfile fragment).
- https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/vsensor-running.txt :
uname -a"QNX noname 8.0.0 ... x86pc x86_64",pidinshowing the vsensor process and threads,ls -l /dev/vsensor0, client devctl replies, node gone afterslay. - https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/aarch64-build.txt : qcc aarch64le cross-build,
filesays "ELF 64-bit LSB pie executable, ARM aarch64". - https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/aarch64-run.txt : the same suite on QNX 8.0 aarch64le under QEMU virt,
uname -a"QEMU_virt aarch64le", 13 passed. resmgr-kit test --secpol examples/estop/estop.yaml: policy pushed with secpolpush and enforced (on -S -T), 15/15 passed: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/secpol-test.txttools/make-target.sh build && tools/make-target.sh start: QNX 8.0 image built with mkqnximage and booted to ssh from nothing: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/make-target.txt- https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/boot-log.txt and hello-test.txt (QNX 8.0 boot and first run).
How we built it
- QNX version: QNX 8.0 (SDP 8.0). Target: QNX 8.0 x86_64 image built with mkqnximage, run under QEMU (x86_64, TCG), and QNX 8.0 aarch64le under QEMU virt. Toolchain: qcc from SDP 8.0. No physical hardware is used.
- Host: Python 3.11+ CLI; qcc runs on a Linux x86_64 host (on a Mac this is a Linux VM, see https://github.com/Tharun2075/resmgr-kit/blob/main/docs/HOST-SETUP.md).
- Real QNX APIs, in the generator template https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/resmgr.c.j2 :
dispatch_create,resmgr_attach,iofunc_attr_init, iofunc read/write/devctl handlers,thread_pool_create,timer_createwithSIGEV_PULSE,pulse_attach,MsgVerifyEventandMsgDeliverEventfor the notify pulse. - Shared header and client: https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/header.h.j2 and https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/client.c.j2
- Security policy: https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/secpol.j2 (type,
allow_attach, abilitiespathspace prot_exec map_fixed public_channel, launcher rule withsettypeidandchannel_connect). Proven both ways on a secure-mode QNX 8.0 image with a small hello resource manager: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/secpol-deny.txt and https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/secpol-allow.txt - Buildfile fragment: https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/build.j2 ; qcc Makefile: https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/Makefile.j2
- Generated pytest suite: https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/templates/test.py.j2
- Runner (build, start or reuse target, scp, run, junit): https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/runner.py ; spec check: https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/spec.py and https://github.com/Tharun2075/resmgr-kit/blob/main/src/resmgr_kit/schema.json
- Example specs: https://github.com/Tharun2075/resmgr-kit/blob/main/examples/vsensor/vsensor.yaml and https://github.com/Tharun2075/resmgr-kit/blob/main/examples/estop/estop.yaml
- Boot and run logs from QNX 8.0: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/boot-log.txt and https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/hello-test.txt
- Architecture and diagrams (CLI pipeline and AI loop): https://github.com/Tharun2075/resmgr-kit/blob/main/ARCHITECTURE.md
- aarch64le:
make TARGET=aarch64lecross-builds withqcc -Vgcc_ntoaarch64le(https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/aarch64-build.txt); built, booted and 13/13 tested on QEMU aarch64 (virt), uname "QEMU_virt aarch64le": https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/aarch64-run.txt ; not yet on Arm hardware. - New in the period: the repository was created in November 2026, after the 2 November 2026 start date, and every file is new work for this hackathon (no fork, no earlier code).
Fault handling (engineering evidence, not a safety claim)
Generated resource managers reject bad input: read and write call the iofunc verify functions, invalid values return EINVAL, a devctl with an undersized payload returns EINVAL, an unknown devctl code returns ENOTTY, the armed-pulse table has a fixed size (16 entries) and is cleared for a client when it closes, and shared state is guarded by a mutex. The generated suite runs on the live target (13 and 15 tests passed) and includes an undersized-devctl test. Pulse-timer period on QEMU: mean 9999.6 us for a 10000 us period, p99 12341.9 us, max 12917.1 us; QEMU under TCG on a Mac, not hardware, so this shows the method, not real-time performance: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/latency.md
Challenges we ran into
All of these were hit for real and are written up in https://github.com/Tharun2075/resmgr-kit/blob/main/docs/TROUBLESHOOTING.md
- Getting QNX 8.0 to run on an Apple Silicon Mac. aarch64 under hvf failed a GICv3 assertion in startup-qemu-virt (hvf has no GICv2); with TCG the kernel booted but the image lacked the virtio disk driver; QEMU nested inside an x86 emulation layer booted but sshd crashed with memory faults. The x86_64 image under native Mac QEMU TCG reaches ssh in about 12 seconds, so that is the supported target. aarch64le runs now too: the SDP has no aarch64 virtio disk driver for the QEMU virt board, so tools/make-target.sh loads the disk image into guest RAM and serves it with devb-ram; the vsensor suite passes 13/13 there: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/evidence/aarch64-run.txt
- The security policy. With the policy enforced, a resource manager fails to attach in two different ways: missing
pathspacegives EPERM, missingallow_attachgives EACCES. Both are needed, plussettypeidandchannel_connecton the launching type soon -Tand clients work.--secpol=openenforces nothing and only harvests a policy; secure mode needs a full system policy, so a snippet alone will not boot. Our first secpol template missed several of these; the fixed template and a host test are on main. - Small traps that cost time: /tmp on the target is RAM so binaries must be copied again after every boot; mkqnximage refuses a non-empty folder;
cpfails on extended attributes on shared VM folders; zsh does not split an ssh command held in a variable. - Keeping a tool that runs shell commands safe: config comes from the user config or an explicit
--config; the{dir}placeholder is shell-quoted; device paths containing..are refused.
Accomplishments that we're proud of
- One command goes from a short spec to a resource manager built with qcc, running on QNX 8.0, and tested live; exit code 0 means every test passed.
- The on-target proof includes the security policy, shown with both the failing and the passing case.
- Documentation written from real failures, an architecture diagram and a host-setup guide for Linux and macOS.
What we learned
- How QNX separates concerns: the resmgr framework gives a path in the namespace, iofunc gives POSIX behaviour, a pulse gives a cheap asynchronous event, and secpol decides who may attach a name at all.
- The two different errors from a failed attach (Operation not permitted vs Permission denied) tell you exactly which policy rule is missing.
- Emulated QNX under QEMU is fast enough to make an on-target test loop practical for every code change.
What's next
- Run on a Raspberry Pi 4/5 board; the aarch64le build targets the Raspberry Pi 4/5 BSP images and is built, booted and 13/13 tested on QEMU aarch64 (virt), not yet run on a board.
- More devctl operations and field types in the spec; a keyvalue example.
- AI mode for read handlers and pulse handlers, with the same build-and-live-test gate.
How to try it (build and run, 5 commands)
Needs QNX SDP 8.0 (free, QNX Everywhere), qcc on a Linux x86_64 host, and a QNX 8.0 x86_64 QEMU target; setup in https://github.com/Tharun2075/resmgr-kit/blob/main/docs/HOST-SETUP.md
Judged version: tag v0.1.1 (git clone -b v0.1.1 https://github.com/Tharun2075/resmgr-kit).
python3 -m venv .venv && .venv/bin/pip install -e .
tools/make-target.sh build && tools/make-target.sh start
.venv/bin/resmgr-kit gen examples/vsensor/vsensor.yaml -o build/vsensor
.venv/bin/resmgr-kit test examples/vsensor/vsensor.yaml
.venv/bin/pytest tests/host -q
tools/make-target.sh builds the QNX 8.0 image and boots it in QEMU (on macOS set QNX_RUN="orb run -m qnx-host"). Without QNX: the first, third and fifth commands need no toolchain.
AI mode disclosure
- AI is optional:
genandtestwork unchanged without it. Without a configured model,resmgr-kit aiprints a clear message and exits 2. - AI output is gated by tests: no generated code is accepted unless the generated tests pass on the QNX target.
- No AI part acts as a safety component of road traffic or critical infrastructure; it drafts code that is tested before use.
Required statements
- Research and demo prototype, not a medical, automotive or industrial product. It has no safety approval and no third-party assessment of any kind, and generated code carries no such claim.
- QNX tools were used under the QNX Everywhere Non-Commercial licence. The entry is public, free, open source and non-commercial.
- Licence: Apache-2.0, detectable in the repo About box: https://github.com/Tharun2075/resmgr-kit/blob/main/LICENSE ; upstream licences and notices kept in https://github.com/Tharun2075/resmgr-kit/blob/main/THIRD-PARTY.md
- All data is simulated; no personal data is collected or stored; no humans appear in the video.
- Third-party software disclosed: QNX SDP 8.0 (qcc, mkqnximage), QEMU, Python, Jinja2, PyYAML, jsonschema, pytest, OpenSSH client, OrbStack (optional Linux build machine on macOS). Licences and terms in THIRD-PARTY.md.
- No physical hardware is used. The QEMU image build steps and instructions stay reproducible for sponsor inspection until 2027-01-29: https://github.com/Tharun2075/resmgr-kit/blob/main/docs/HOST-SETUP.md
- "QNX" is used only to describe the platform this tool targets. No QNX or BlackBerry logo is used as branding; the project is not affiliated with or endorsed by BlackBerry or QNX.
- All text, video and instructions are in English.